Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

7b321a1d0de501b4f33f843ea985138ce47ddaefdba7522aac5c4c8840a78bb1
Timestamp (utc)
2021-05-30 19:43:46
Fee Paid
0.00004172 BSV
(
0.00968627 BSV
-
0.00964455 BSV
)
Fee Rate
509.2 sat/KB
Version
1
Confirmations
298,961
Size Stats
8,193 B

3 Outputs

Total Output:
0.00964455 BSV
  • jrun cryptofightsMü{"in":0,"ref":["300abdec926693375381c1cd4bc899b2236cdb062ff39d4389672f8ce8ac3953_o1","d6edec4a1c79ea975d3fe3608ddaccb9a3e5d69d908114055c8b7733deb9b134_o1","8321c011aa2fea6b85a762e47c7da830b3aff0712deb22ed646e4437050db12c_o1","49932fba5a7a47d91cd61007a993eaefaf12b99344ab1240419aab2ab0eed6db_o1","3f41b320ac0e3fc2930585ba768436c89f1f2d42896be9824c982793d482df77_o1","397d3e4ed2c605de9e9605514eadd083f617bc0256f10d622266492dec63cb31_o1","0388093d0fbe67cbf69791185954954519e087750836a38c57b5041ca4e032a9_o1","ea9ac349faaaffd00c377bea089a2e445f58e257c5faa45870d43b95c44a9833_o1","bc700a373105719b97b89741ad64a41497933c62b1031faff16a94417cd96107_o1","3804f0268973ca6b38d9594211c9662133ca9e53a743c3fdfa9080344e660c04_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1","5722bae9268e49eb4aeb3c4ef3a8400616e66bd2876d81a02c63f5966a6a7f83_o1"],"out":["563e3ab5f5ff1606d7a7aaa85f98522b99567231ddc0f6ac36ce48d613f98bee"],"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 this.actionToken = new ActionToken(this.owner, this.battlePlayers[this.state.playerToAct].fighter.owner);\n }\n\n resolve(random, timestamp, timeout) {\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 const actionIndex = this.actionToken.actionIndex;\n if (timestamp < this.timeout) {\n if (actionIndex === -1 || actionIndex === undefined) {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n } else {\n this.actionToken.destroy();\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.actionToken = new ActionToken(this.owner, this.battlePlayers[this.state.playerToAct].fighter.owner);\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":{"ActionToken":{"$jig":0},"BattleToken":{"$jig":1},"BattleUtils":{"$jig":2},"Config":{"$jig":3},"Constants":{"$jig":4},"Dice":{"$jig":5},"FyxClass":{"$jig":6},"FyxItem":{"$jig":7},"FyxJig":{"$jig":8},"Sha256":{"$jig":9},"expect":{"$jig":10},"issueRewards":{"$jig":11}},"hash":"81cd35053c6d23d1dc48aa17fc9d57b4c0cccb7d6ec795c21ddfc73fe78fe261","metadata":{"app":"Cryptofights","emoji":"⚔","name":"Battle","publisher":"FYX"}}]}]}
    https://whatsonchain.com/tx/7b321a1d0de501b4f33f843ea985138ce47ddaefdba7522aac5c4c8840a78bb1