Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

21638565f530cdd53307cb8a2cc6963c7308bccf8db6089ffd653de642428ea3
Timestamp (utc)
2021-05-08 23:06:27
Fee Paid
0.00004278 BSV
(
0.00976430 BSV
-
0.00972152 BSV
)
Fee Rate
547.4 sat/KB
Version
1
Confirmations
301,221
Size Stats
7,815 B

3 Outputs

Total Output:
0.00972152 BSV
  • jrun cryptofightsMƒ{"in":0,"ref":["061794f23a21f2d4f65b73512757be2927494acc42b1df875cce6d29b67d6fb5_o1","fd7455fa0868b80da50fb2703db3f7bdb6b70bad3b0518600ef19dd17406c612_o1","fbd6c2e49d5caa71dc241e969a2c84e5d32c17cbbfca0998fb5d60a6e628167d_o1","013ba7f4d0fe70aef6b6fa0f7a466ce98bfa38b452ddba20e5d7f98547edb303_o1","397d3e4ed2c605de9e9605514eadd083f617bc0256f10d622266492dec63cb31_o1","0388093d0fbe67cbf69791185954954519e087750836a38c57b5041ca4e032a9_o1","ea9ac349faaaffd00c377bea089a2e445f58e257c5faa45870d43b95c44a9833_o1","bc700a373105719b97b89741ad64a41497933c62b1031faff16a94417cd96107_o1","3804f0268973ca6b38d9594211c9662133ca9e53a743c3fdfa9080344e660c04_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1","44c68a2a6aa9108e2a712698b0dc072ab4bcd4f7f03c8c15ec59f636e6fbd67a_o1"],"out":["e44be2527c729d84e30ee082733efec3f509bfc73efc4285db5a5b2d008dbde7"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Battle extends FyxJig {\n init(validator, rules, players, id, timestamp) {\n this.id = this.random = id;\n this.timestamp = timestamp;\n this.rules = rules;\n\n this.battlePlayers = players.map(player => this.joinBattle(player));\n this.battlegroundTier = rules.tier;\n this.dice = new Dice(id);\n this.state = BattleUtils.buildBattleState(this.battlePlayers, this.dice);\n\n this.turnCount = 0;\n\n this.satoshis = rules.reward || 546;\n\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.status = Constants.Status.Open;\n this.stateHistory = [];\n this.actor = players[this.state.playerToAct].userId;\n this.stage = 'created';\n \n this.owner = this.validator = validator;\n }\n\n joinBattle(player) {\n const { userId, pubkey, owner, items, fighter, skills, tags } = player;\n \n if(this.rules.fee) {\n if (fighter.satoshis < this.rules.fee) throw new Error('Insufficient Fighter Satoshis');\n fighter.setSatoshis(fighter.satoshis - this.rules.fee);\n } else {\n fighter.auth();\n }\n \n items.forEach(item => item && item.auth());\n const [mainhand, offhand, armor, hat] = items.map(i => i && i.item && FyxClass.deepClone(i.item));\n\n return {\n userId,\n pubkey,\n owner,\n fighter,\n mainhand,\n offhand,\n armor,\n hat,\n skills,\n tags: tags || []\n };\n }\n\n begin(timeout) {\n if (this.stage !== 'created') throw new Error('Invalid Stage');\n this.timeout = timeout;\n delete this.stage;\n }\n\n resolve(random, timestamp, timeout, actionIndex, clientTimestamp, sig) {\n // console.log('Resolve', this.location);\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n if (!BattleUtils.validateRandom(random, this.random)) throw new Error('Invalid Random');\n this.random = random;\n \n this.stateHistory[this.turnCount] = this.getState();\n const state = FyxClass.deepClone(this.state);\n state.actionLogs = [];\n this.dice = new Dice(random);\n if (timestamp < this.timeout) {\n if (actionIndex === -1) {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n } else {\n const attacker = this.battlePlayers[this.state.playerToAct];\n const skill = attacker.skills[actionIndex];\n if (!skill) throw new Error(`${attacker.fighter.displayName} used an invalid Skill ID: ${actionIndex}`);\n this.state = skill.run(this, state, this.dice, timestamp);\n }\n } else {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n }\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this.timeout = timeout;\n this._endTurn();\n }\n\n forfeit(message, timestamp) {\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n this.stateHistory[this.turnCount] = this.getState();\n const playerIndex = this.battlePlayers.findIndex(p => p.userId === message.from);\n const player = this.battlePlayers[playerIndex];\n const victorIndex = this.battlePlayers.findIndex(p => p.userId !== message.from);\n const victor = this.battlePlayers[victorIndex];\n \n const state = FyxClass.deepClone(this.state);\n state.victor = {\n pubkey: victor.pubkey,\n owner: victor.owner,\n fighter: victor.fighter,\n userId: victor.userId\n };\n state.actionLogs = [{\n playerIndex: playerIndex,\n actionLogMessage: `<gradient=!player${playerIndex}-color><b>${player.fighter.metadata.name.toUpperCase()}</b> <gradient=!log-color> Forfeited`\n }];\n state.playerToAct = victorIndex;\n state.status = Constants.Status.Forfeit;\n this.state = state;\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this._endTurn();\n }\n\n _endTurn() {\n if (this.status !== Constants.Status.Open) {\n this.victor = {...this.battlePlayers[this.state.playerToAct]};\n }\n this.turnCount++;\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.actor = this.battlePlayers[this.state.playerToAct].userId;\n }\n\n finalize() {\n console.log('Finalizing Battle');\n this.stateHistory[this.turnCount] = this.getState();\n if(![Constants.Status.Complete, Constants.Status.Forfeit].includes(this.status)) throw new Error('Invalid Status');\n const victor = this.victor;\n const loser = this.battlePlayers.find(p => p.userId !== victor.userId);\n this.xp = Battle.LevelXPReward[loser.fighter.level];\n \n if (!victor.tags.includes('bot')) {\n const items = issueRewards(this.dice, this.battlegroundTier);\n this.rewards = items.map(i => new FyxItem(victor.fighter.owner, {name: i.displayName, classId: i.classId}, i, i.satoshis));\n }\n \n this.battlePlayers.forEach(player => new BattleToken(player.fighter.owner));\n this.owner = victor.fighter.owner;\n this.status = Constants.Status.Finalized;\n }\n \n getState() {\n const state = {\n ...this.state,\n location: this.origin,\n origin: this.origin,\n actor: this.actor,\n battleId: this.id,\n random: this.random,\n stateHash: this.stateHash,\n timestamp: this.timestamp,\n turnCount: this.turnCount,\n timeout: this.timeout,\n battleStatus: this.status\n };\n return state;\n }\n}",{"LevelXPReward":[0,100,200,300,600,1200,2400,0,0,556,713,913,1170,1498,1919,2458,3148,4032,5164,6614,8472],"MaxRounds":100,"deps":{"BattleToken":{"$jig":0},"BattleUtils":{"$jig":1},"Config":{"$jig":2},"Constants":{"$jig":3},"Dice":{"$jig":4},"FyxClass":{"$jig":5},"FyxItem":{"$jig":6},"FyxJig":{"$jig":7},"Sha256":{"$jig":8},"expect":{"$jig":9},"issueRewards":{"$jig":10}},"hash":"ec2d5c134aeabf51b38795658d4b1b20a3cc6c46a2b65bf1834bf2b738138b18","metadata":{"app":"Cryptofights","emoji":"⚔","name":"Battle","publisher":"FYX"}}]}]}
    https://whatsonchain.com/tx/21638565f530cdd53307cb8a2cc6963c7308bccf8db6089ffd653de642428ea3