Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

4ff2677f75c0d5f82143cdc03d5e9a4855af9f9a226d265bb1659fa1c064099b
Timestamp (utc)
2021-01-13 04:16:03
Fee Paid
0.00002615 BSV
(
0.01000000 BSV
-
0.00997385 BSV
)
Fee Rate
513.3 sat/KB
Version
1
Confirmations
327,410
Size Stats
5,092 B

3 Outputs

Total Output:
0.00997385 BSV
  • jrun kronoverseMá{"in":0,"ref":["b3878396e872bf4dcffc6df0f4f1469a63a970182fe40c9020630f83c2c21211_o1","4d617f1388bbe63358c6380087b337a16e33dd0cd4c3c940b12ebca7dee5927f_o1","796f6c13c4539ee8e56f943d323ade91ec8dd9b8c8a269d803bbbf69616c7bc1_o1","1f8616c29bd9a248eb2fbd6f0a1ccac0491c9465c5f82676ccd79f0b50cd1a69_o1","b61ceaab3690af8868f1b305d30b9ea37688681de59732610963091f7b8277da_o1","589e107231b17445bc648ace9e1a852d201409a3ed42280c3f5ff4033c1a28ac_o1"],"out":["c9a0cf8e4d6271f820f0804ea5d24774452ef85882ae507f11514b39dff44971"],"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},"KronoCoin":{"$jig":4},"Sha256":{"$jig":5}},"hash":"4ce8bd6fedb7c09a261cb917955c414fbd9a8ad13e6959347f26d6eaf5785565","sealed":false}]}]}
    https://whatsonchain.com/tx/4ff2677f75c0d5f82143cdc03d5e9a4855af9f9a226d265bb1659fa1c064099b