Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

153def6a5e05ff7b4635772e420d9deb21a24f83f434b7e272a79d2d702d2c8c
Timestamp (utc)
2021-03-11 21:46:47
Fee Paid
0.00002660 BSV
(
0.00999303 BSV
-
0.00996643 BSV
)
Fee Rate
504.3 sat/KB
Version
1
Confirmations
316,184
Size Stats
5,274 B

3 Outputs

Total Output:
0.00996643 BSV
  • jrun kronoverseM˜{"in":0,"ref":["4e8ca099fd5131acf48d8bc6227e7768d7836cc6d76fdb392719c3ea5d2ed234_o1","2995e22361121e35f77feb0abe0fbc7c462e24785a1831315ba8c5e18208e7bf_o1","1c36ee5d8f4305fc84d71f73942c9fd7f24245cde11b9be4cfcd3deeab5f5e06_o1","ec397909103c0316a34ab65b9f923a7a765c275ce0bcf1c24c18fd6c59e01a0f_o1","63e0e1268d8ab021d1c578afb8eaa0828ccbba431ffffd9309d04b78ebeb6e56_o1","c40bb88355f4b0ffe1b4de2997b8964fe4aef84f85c48c7ec3d0b8add3ea261d_o1","2c98aa17df8d8d476fdf2f9c775ea10cc0576fd9603c1ef0fc802d1aabac269a_o1","2281f052a3bdcba2be117260c9ad6663bf437662464edbbb6e8a5d7c6181ac91_o1"],"out":["2fffed5b88d9510722666097dfaf6d3779bf7841eba785e31e69630c48bfee25"],"del":[],"cre":["mvRVAvD9PafWVegCaPh4SUCLUuBay6QUz4"],"exec":[{"op":"DEPLOY","data":["class CashierAgent extends Agent {\n async init() {\n this.messageHandlers.set('CashInRequest', this.onCashInRequest);\n this.messageHandlers.set('CompletePayment', this.onCompletePayment);\n // this.messageHandlers.set('CashOutRequest', this.onCashOutRequest);\n // this.messageHandlers.set('CashOutPayment', this.onCashOutPayment);\n }\n\n async onCashInRequest(message, ipAddress) {\n const cashInMessage = this.wallet.buildMessage({\n payload: JSON.stringify({\n deviceGPS: message.payloadObj.deviceGPS,\n paymentAmount: message.payloadObj.paymentAmount,\n ipAddress,\n pubkey: message.from,\n })\n });\n\n const {cashierScript, paymentId, domain, payer} = await this.blockchain.sendMessage(cashInMessage, `${CashierConfig.baseUrl}/payment`);\n let paymentData = await this.storage.hgetall(paymentId);\n\n if(!paymentData || !paymentData.location) {\n const resp = await this.lib.fetch(`${CashierConfig.baseUrl}/agents/${domain}/coinLock`);\n const {location} = await resp.json();\n paymentData = {\n cashierScript,\n lock: location,\n payer,\n paymentId,\n };\n await this.storage.hmset(paymentId, paymentData);\n }\n console.log('paymentData', paymentData);\n \n return paymentData;\n }\n\n async onCompletePayment(message) {\n if(message.from !== CashierConfig.paymentPubkey) throw new Error('Invalid sender');\n const { paymentId, amount} = message.payloadObj;\n const {lock, payer} = await this.storage.hgetall(paymentId);\n\n const Coinlock = await this.wallet.loadJig(lock);\n const coin = await this.sendCoin(new Coinlock(payer), amount);\n await coin.sync();\n console.log('Coin:', coin.location, coin.amount);\n }\n\n async sendCoin(to, amount) {\n const coins = await this.wallet.loadJigIndex({\n criteria: {\n kind: KronoCoin.origin\n },\n project: {value: false}\n });\n console.log('Coins:', coins.length);\n const coin = await this.pickAndLock(coins, 120);\n if (!coin) throw new Error('no coins');\n return coin.send(to, amount);\n }\n\n async onCashOutRequest(message) {\n const { paymentAmount, ownerScript } = message.payloadObj;\n const coinIndex = await this.getCoins(ownerScript);\n const coins = [];\n let total = 0;\n for(const c of coinIndex) {\n if(total > paymentAmount) break;\n const coin = await this.wallet.loadJig(c.location);\n coins.push(coin);\n total += coin.amount;\n }\n if(total < paymentAmount) throw new Error('Inadequate Balance');\n const cashOut = new CashOut(coins, paymentAmount);\n await cashOut.sync();\n\n const t = this.wallet.createTransaction();\n t.update(() => {\n cashOut.execute();\n });\n const rawtx = await t.export({sign: true, pay: true});\n return {\n cashOutLoc: cashOut.location,\n rawtx\n };\n }\n\n async onCashOutPayment(message) {\n const {cashOutLoc, deviceGPS} = message.payloadObj;\n const cashOut = await this.wallet.loadJig(cashOutLoc);\n await cashOut.sync();\n if(cashOut.paymentAmount !== cashOut.coin.amount ||\n cashOut.coin.owner !== this.address \n ) throw new Error('Invalid CashOut');\n\n const cashOutMsg = this.wallet.buildMessage({\n payload: JSON.stringify({\n deviceGPS,\n paymentAmount: cashOut.paymentAmount\n })\n });\n return this.blockchain.sendMessage(\n cashOutMsg,\n CashierConfig.cashOut\n );\n }\n}",{"deps":{"Agent":{"$jig":0},"CashOut":{"$jig":1},"CashierConfig":{"$jig":2},"EventEmitter":{"$jig":3},"Group":{"$jig":4},"KronoCoin":{"$jig":5},"KronoError":{"$jig":6},"Sha256":{"$jig":7}},"hash":"e2e3f769c35fe9c28b5bf2fedf0af23aae8ac9791c18e0a9569ccbf35fafcc10","sealed":false}]}]}
    https://whatsonchain.com/tx/153def6a5e05ff7b4635772e420d9deb21a24f83f434b7e272a79d2d702d2c8c