Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

3eb0c292659d204975b375f702aeb2ac55331349f488cd4cf216b46ee3d3c346
Timestamp (utc)
2021-06-04 13:55:45
Fee Paid
0.00004066 BSV
(
0.00868196 BSV
-
0.00864130 BSV
)
Fee Rate
519.2 sat/KB
Version
1
Confirmations
296,428
Size Stats
7,831 B

3 Outputs

Total Output:
0.00864130 BSV
  • jrun cryptofightsM“{"in":0,"ref":["d6edec4a1c79ea975d3fe3608ddaccb9a3e5d69d908114055c8b7733deb9b134_o1","8c553dac717565e5bde088297dc9413b4accf1f15ddae11487060dd2a5027bd8_o1","49932fba5a7a47d91cd61007a993eaefaf12b99344ab1240419aab2ab0eed6db_o1","3f41b320ac0e3fc2930585ba768436c89f1f2d42896be9824c982793d482df77_o1","5334f688050535806987424ec00ba75b74a2087c8c3945765dd9107ac81af1a7_o1","9f0e192f744258c3484a1c19fa88ef68e46ee6cf75acc78cfe2ad5a0d2340d0e_o1","aa2ebcab82c10e20f2f8cb0751fc5e1692252ce71fe3ba62c75a984da7d8e1f9_o1","e2f4d8e09c9835156a2a221aedd8bb04db191d9642573906439bbd889dde40d0_o1","870c20f2e1b5f421a3083f749776c059e5bf227d6b2d555f11ffda2306389c56_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1","7f3428d59ff3a459ae9e09cbdeb1637bcc9e612b23ccffcb794c02d37ca5156c_o1"],"out":["bc7452460561e1d8b219a628dbfaba6919b2ebbf868045d34ecefd51ff0293b2"],"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, disguise] = 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 disguise,\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, 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.sig = sig;\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 || actionIndex === undefined) {\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 } else {\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 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, i.metadata, i.item, 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":"042516f94854ee86d5652cbc6e5ca755f4aca51d9a79f7138cad721b91cb108e","metadata":{"app":"Cryptofights","emoji":"⚔","name":"Battle","publisher":"FYX"}}]}]}
    https://whatsonchain.com/tx/3eb0c292659d204975b375f702aeb2ac55331349f488cd4cf216b46ee3d3c346