Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

a059ea1844573baa3c5ab53cd8c7916db0266feae032b96e5bec4aec9a8f7a6a
Timestamp (utc)
2021-03-30 03:23:16
Fee Paid
0.00004256 BSV
(
0.00978203 BSV
-
0.00973947 BSV
)
Fee Rate
502.7 sat/KB
Version
1
Confirmations
309,128
Size Stats
8,466 B

3 Outputs

Total Output:
0.00973947 BSV
  • jrun cryptofightsM {"in":0,"ref":["3958767325e54a59f90891c50565b5fac4ef5ca35deea122ab9dd896ad99cdb8_o1","9de2defb91982526a2107c589be79f3a7dfe832baa4699dc96222d0fa7cdb2f1_o1","a4e10b6dc81f65d6f7ad57bb4e697c6e17a2d8c673a82f736faa622c9ad26776_o1","2221bd3b605ccb0ecb0cb2562b6f2e98ca8324cc0f0d08f1434fc16deab9f7e0_o1","e36108409e6e05169baef9a91c646aa541a24391b9dd9268f13dbcf3bad1eca5_o1","3c82231bba261a39defdba25060edd1459edb19c8998f9a9256c58cebb8339b1_o1","64259b038d46c8592a6fb2701fa513af9d19b4ce15138d44defd7f64a8d981cc_o1","10a93abc437717ca372957a65304904f9bc61a7bc332c322a9533712e2f72eaf_o1","fef505c39a983e6f1ac0e49c9a508c93b50f2607b9b5fd7148adfec68355835c_o1","f0205b4a47f4d9d006b13e94ab59e692d66af01138d95008ea3ce57a017f5e77_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1","9266a272a7cb98af115a300556f758c9abde602d58605352abb24a2ab04bf7b9_o1"],"out":["72bd16a053d61f7a9f72a4f1aeb7d88440be2223efe309d3e1889ffe8c32cf92"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Battle extends KronoJig {\n init(validator, rules, players, id, timestamp) {\n this.id = this.random = id;\n this.timestamp = timestamp;\n this.validator = validator;\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 this.turnCount = 0;\n\n this.satoshis = 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\n joinBattle(player) {\n const { EquipSlot } = Constants;\n const { userId, pubkey, owner, items, fighter, skills, coins, tags } = player;\n fighter.auth();\n\n let coinLock;\n let feeCoin;\n if(this.rules.fee) {\n const coin = coins.pop();\n if(coin) coinLock = coin.owner;\n if(coins.length) {\n coin.combine(...coins);\n }\n if (coin) {\n feeCoin = coin.send(Config.address, this.rules.fee);\n }\n\n }\n\n let mainhand = items[EquipSlot.Mainhand] && items[EquipSlot.Mainhand].item ? KronoClass.deepClone(items[EquipSlot.Mainhand].item) : null;\n const offhand = items[EquipSlot.Offhand] && items[EquipSlot.Offhand].item ? KronoClass.deepClone(items[EquipSlot.Offhand].item) : null;\n const armor = items[EquipSlot.Body] && items[EquipSlot.Body].item ? KronoClass.deepClone(items[EquipSlot.Body].item) : null;\n items.forEach(item => item && item.auth());\n\n return {\n userId,\n pubkey,\n owner,\n coinLock,\n fighter,\n mainhand,\n offhand,\n armor,\n skills,\n coin: feeCoin,\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 = KronoClass.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 = KronoClass.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.displayName.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 this.xp = Battle.LevelXPReward[victor.fighter.level];\n if(this.rules.fee) {\n console.log('Reward:', this.rules.reward);\n let coins = this.battlePlayers.map(p => p.coin);\n const coin = coins.pop();\n coin.combine(...coins);\n console.log('Coin Amount:', coin.amount);\n coin.send(victor.coinLock, this.rules.reward);\n }\n \n if (!victor.tags.includes('bot')) {\n this.rewards = issueRewards(this.dice, this.battlegroundTier, victor.owner);\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,435,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},"KronoClass":{"$jig":5},"KronoCoin":{"$jig":6},"KronoItem":{"$jig":7},"KronoJig":{"$jig":8},"Sha256":{"$jig":9},"expect":{"$jig":10},"issueRewards":{"$jig":11}},"hash":"953488d443246a678b5cd86d3d4a0ad81c1d7e4a8aff37334552c9486acefa21"}]}]}
    https://whatsonchain.com/tx/a059ea1844573baa3c5ab53cd8c7916db0266feae032b96e5bec4aec9a8f7a6a