Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

601edbeb03cc17a04d7ef75d78deddf3c51cd45c84d0850effc475cc2f6ca0b5
Timestamp (utc)
2021-02-19 23:02:03
Fee Paid
0.00007886 BSV
(
0.01000000 BSV
-
0.00992114 BSV
)
Fee Rate
987.3 sat/KB
Version
1
Confirmations
315,633
Size Stats
7,987 B

3 Outputs

Total Output:
0.00992114 BSV
  • jrun kronoverseM0{"in":0,"ref":["d9a001b6c3bf9bb01f9b36bf8f1205c0f70170856a45e964002633644ea5e062_o1","63504c52af73ddcda917e7c1ae44e550fa1e9c100748310f90fa3d2116ff094d_o1","7bdc5790e34a0a7adf4c529fdc5880f714149bad3efdf7ceb2a870286b8f05d3_o1","68b0772a4f166e9e67e518ba6a53c03d7b66575d33ff132094856dbfbedf2d7f_o1","e9c568244b6cf874b22072812cdfd51d272b4e831f5cdf3912d48745bc7c701e_o1"],"out":["263f5a176cf87d971decfc66761239e89677c68645f326fabb29e808219da5bb"],"del":[],"cre":["mvRVAvD9PafWVegCaPh4SUCLUuBay6QUz4"],"exec":[{"op":"DEPLOY","data":["class Agent extends EventEmitter {\n constructor(wallet, blockchain, storage, bsv, lib) {\n super();\n this.wallet = wallet;\n this.blockchain = blockchain;\n this.storage = storage;\n this.bsv = bsv;\n this.lib = lib;\n this.address = wallet.address;\n\n this.coinScript = bsv.Address.fromString(wallet.address).toTxOutScript().toHex();\n this.pubkey = wallet.pubkey;\n this.purse = wallet.purse;\n this.paymail = wallet.paymail;\n\n this.eventHandlers = new Map();\n this.jigHandlers = new Map();\n this.messageHandlers = new Map();\n this.kindSubHandlers = new Map();\n this.originSubHandlers = new Map();\n this.channelSubHandlers = new Map();\n this.queue = Promise.resolve();\n this.processCount = 0;\n\n this.handled = new Set();\n }\n\n addToQueue(process, label = 'process') {\n const processCount = this.processCount++;\n console.time(`${processCount}-${label}`);\n const queuePromise = this.queue.then(process);\n this.queue = queuePromise\n .catch(e => console.error('Queue error', label, e.message, e.stack))\n .then(() => console.timeEnd(`${processCount}-${label}`));\n\n return queuePromise;\n }\n\n init() { }\n async onJig(jigData) {\n if(this.handled.has(jigData.location)) return;\n this.handled.add(jigData.location);\n let handler = this.jigHandlers.get(jigData.kind);\n if (!handler) return;\n const label = `${this.processCount++}-jig-${jigData.type}-${jigData.location}`;\n try {\n console.time(label);\n const jig = await this.wallet.loadJig(jigData.location);\n if (!jig) {\n console.log(`JIG: ${jigData.type} ${jigData.location} missing`);\n return;\n }\n const [txid, vout] = jigData.location.split('o_');\n const spend = await this.blockchain.spends(txid, vout);\n if(spend) {\n console.log(`JIG: ${jigData.type} ${jigData.location} spent`);\n return;\n }\n // await jig.sync();\n // if (jig.location !== jigData.location) {\n // console.log(`JIG: ${jigData.type} ${jigData.location} spent`);\n // }\n await handler.bind(this)(jig);\n } finally {\n console.timeEnd(label);\n }\n }\n\n async onMessage(message, ipAddress) {\n if(this.handled.has(message.id)) return;\n this.handled.add(message.id);\n let handler = this.messageHandlers.get(message.subject);\n if (!handler) {\n console.log('No Handler:', message.subject);\n return;\n }\n const label = `${this.processCount++}-msg-${message.subject}-${message.id}`;\n try {\n console.time(label);\n const result = await handler.bind(this)(message, ipAddress);\n return result;\n } finally {\n console.timeEnd(label);\n }\n }\n\n async onEvent(event, payload) {\n let handler = this.eventHandlers.get(event);\n if (!handler) throw new Error('Invalid handler:', event);\n const label = `${this.processCount++}-event-${event}`;\n try {\n console.time(label);\n const result = await handler.bind(this)(payload);\n return result;\n } finally {\n console.timeEnd(label);\n }\n \n }\n\n static hexToBytes(hex) {\n let bytes = new Uint8Array(32);\n for (let i = 0; i < 64; i += 2) {\n bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);\n }\n return bytes;\n }\n\n generateHashchain(size) {\n const hashchain = [];\n // const hashchain = new Array(size);\n let hash = hashchain[size - 1] = this.wallet.randomBytes(32);\n for (let i = size - 2; i >= 0; i--) {\n hash = hashchain[i] = Sha256.hashToHex(Agent.hexToBytes(hash));\n }\n return hashchain;\n }\n\n async getCoins(ownerScript) {\n return this.blockchain.jigIndex(\n ownerScript, \n {criteria: {kind: KronoCoin.origin}},\n 'script'\n );\n }\n\n async selectCoins(amount, ownerScript) {\n const coins = [];\n let acc = 0;\n for(let coinData of await this.getCoins(ownerScript || this.coinScript)) {\n if(acc >= amount) break;\n const coin = await this.wallet.loadJig(coinData.location);\n coins.push(coin);\n acc += coin.amount;\n }\n if (acc < amount) throw new KronoError(402, 'Insufficient balance');\n return coins;\n }\n\n async getBalance(ownerScript) {\n console.log('getBalance');\n const coinIndex = await this.getCoins(ownerScript || this.coinScript);\n const balance = coinIndex.reduce((acc, coin) => acc + coin.value.amount, 0);\n console.log('Balance', balance);\n return balance;\n }\n\n async pickAndLock(jigs, lockSeconds = 120) {\n const now = this.wallet.now;\n for(let j of jigs) {\n console.log('Jig:', j.location);\n if(await this.storage.exists(`lock:${j.location}`)) {\n console.log('Locked:', j.location);\n continue;\n }\n await this.storage.pipeline()\n .set(`lock:${j.location}`, now.toString())\n .expire(`lock:${j.location}`, lockSeconds)\n .exec();\n const jig = await this.wallet.loadJig(j.location);\n return jig;\n }\n }\n\n\n async cashout(ownerScript, paymentAmount, deviceGPS) {\n const message = this.wallet.buildMessage({\n subject: 'CashoutRequest',\n payload: JSON.stringify({\n paymentAmount,\n ownerScript\n })\n });\n\n const cashoutMsg = new this.lib.SignedMessage(\n await this.blockchain.sendMessage(message, CashierConfig.postTo)\n );\n if(cashoutMsg.reply !== message.id ||\n cashoutMsg.from !== CashierConfig.pubkey ||\n !cashoutMsg.verify()\n ) throw new Error('Invalid Response');\n \n let {cashoutLoc, rawtx} = cashoutMsg.payloadObj;\n const t = await this.wallet.loadTransaction(rawtx);\n rawtx = await t.export({sign: true, pay: false});\n const txid = await this.blockchain.broadcast(rawtx);\n\n const paymentMsg = this.wallet.buildMessage({\n subject: 'CashoutPayment',\n payload: JSON.stringify({\n cashoutLoc,\n txid,\n deviceGPS\n })\n });\n await this.blockchain.sendMessage(paymentMsg, CashierConfig.postTo);\n \n }\n}",{"deps":{"CashierConfig":{"$jig":0},"EventEmitter":{"$jig":1},"KronoCoin":{"$jig":2},"KronoError":{"$jig":3},"Sha256":{"$jig":4}},"hash":"ae6944df159dccd6ecff9f86229c88148d4956e3220c66707307b06953e00588","sealed":false}]}]}
    https://whatsonchain.com/tx/601edbeb03cc17a04d7ef75d78deddf3c51cd45c84d0850effc475cc2f6ca0b5