Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

9d45421dc0ef8b7bcf3d35cb71e125b500e8506103abec2de9f3fd66ba9c8ebe
Timestamp (utc)
2021-03-11 06:19:41
Fee Paid
0.00002660 BSV
(
0.00998974 BSV
-
0.00996314 BSV
)
Fee Rate
504.3 sat/KB
Version
1
Confirmations
312,458
Size Stats
5,274 B

3 Outputs

Total Output:
0.00996314 BSV
  • jrun kronoverseM˜{"in":0,"ref":["445f1d66f8210ab375fffefcb23881a02a41450cc83de938c60f5bd501a05ddc_o1","0d9f08e15de9a7bccfb51eeed55f1c1f1199cbc6b83b77506a0084194908e9a1_o1","7bca2b942e00e4001c8a30b4d95210c8d9be3901cb6533045f71bac59294ed2e_o1","cdfcbce65a987532275ccf349b3a952bcf2716a906f12367565c08d87c3712e9_o1","63e0e1268d8ab021d1c578afb8eaa0828ccbba431ffffd9309d04b78ebeb6e56_o1","5a0e8f9d40d2caec2204826628c8a5ada7264b0d8efbeca0a28ff876ab66f36f_o1","fa381fdfbdca6a30abde4b8fbd00b949bdd0821b564aa09258106ad3959b8697_o1","1cccf52c2639cf27a93b28a2b100eedd7a4f8dcb6fcb4245ffdab38ff7b66855_o1"],"out":["486d3eab4d9dd5ceb7e640cd662b39daa52bf30be40fb0a6691ef355cbbcaa4d"],"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/9d45421dc0ef8b7bcf3d35cb71e125b500e8506103abec2de9f3fd66ba9c8ebe