Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

d627286a15eaace2a6610ca80c9691cf769ecf27aa198c685c328b2154d4a7db
Timestamp (utc)
2021-04-10 05:15:51
Fee Paid
0.00002712 BSV
(
0.00996972 BSV
-
0.00994260 BSV
)
Fee Rate
514.1 sat/KB
Version
1
Confirmations
311,593
Size Stats
5,275 B

3 Outputs

Total Output:
0.00994260 BSV
  • jrun kronoverseM˜{"in":0,"ref":["6a3514e86407870e54db3747f57e29ee486903e870f05b272f46533d38f520be_o1","c133d43d2a75e91333942fc7edea8406cbd11cbcb586395b003092ee80891833_o1","ac4c6b123063dc0b372ef023584186d912d71501edf80e837da8d3be118ba3ae_o1","ffe8d58f9274df6da5c0e1ac368fa80e3ab57ac0a1b9cd5d4251580ebab128b8_o1","63e0e1268d8ab021d1c578afb8eaa0828ccbba431ffffd9309d04b78ebeb6e56_o1","64259b038d46c8592a6fb2701fa513af9d19b4ce15138d44defd7f64a8d981cc_o1","cb105ff1622e20234a956960361c40b0bbe37563ed022886284900af2e29bb20_o1","f0205b4a47f4d9d006b13e94ab59e692d66af01138d95008ea3ce57a017f5e77_o1"],"out":["00860855cb3b72bb05ce5e47bf9ae19603d3b0013fdf9a6fc122772be3d0a4ca"],"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":"e2ee48b83d68998a00d2fb7383b2515e46bf00aebf991ab72ad37c525f437f2f","sealed":false}]}]}
    https://whatsonchain.com/tx/d627286a15eaace2a6610ca80c9691cf769ecf27aa198c685c328b2154d4a7db