Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

d96f3ed5cc3720e58c212895b2f463ca837fc95dc8c2d8eb49d7e2d6eadd9a3f
Timestamp (utc)
2021-04-10 06:43:45
Fee Paid
0.00002709 BSV
(
0.00996785 BSV
-
0.00994076 BSV
)
Fee Rate
514.2 sat/KB
Version
1
Confirmations
306,887
Size Stats
5,268 B

3 Outputs

Total Output:
0.00994076 BSV
  • jrun kronoverseMÂ’{"in":0,"ref":["157ff6df310f662d464a1f41023c1a0f567161f6a8e01b8a1b62319beeaeb8a9_o1","2ddf434d82b9b591cf9800f0e71fa3b691abc7ad539d0df3c9da4523b0adca78_o1","ac4c6b123063dc0b372ef023584186d912d71501edf80e837da8d3be118ba3ae_o1","753da8bc4fe79a871f1a52a6410af0f022b680329d52ececda371645538772f1_o1","19e755509d4f93bf8d1631b164f5cc91006e22d2cee65e7faaec2132935365c3_o1","429d216161dae3fb4af5ec79fc654eba3b68439635e7b991fe0f04a60369df61_o1","63e0e1268d8ab021d1c578afb8eaa0828ccbba431ffffd9309d04b78ebeb6e56_o1","f0205b4a47f4d9d006b13e94ab59e692d66af01138d95008ea3ce57a017f5e77_o1"],"out":["820c8864fdd6ce43ddd80d82c072144be982b1033ca59065f1560a664f33d4d4"],"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: FyxCoin.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},"FyxCoin":{"$jig":4},"FyxError":{"$jig":5},"Group":{"$jig":6},"Sha256":{"$jig":7}},"hash":"11c9a966a736f346dcdc160c9c9f7156d31db5bc49851d6c76c9bc5ed62355b2","sealed":false}]}]}
    https://whatsonchain.com/tx/d96f3ed5cc3720e58c212895b2f463ca837fc95dc8c2d8eb49d7e2d6eadd9a3f