Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hoping to get some guidance. I'm trying to make a utility function that will accept an array of UTXO data like this:
- ```
- [
- {
- txid:
- "bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90",
- vout: 3,
- amount: 0.00002015,
- satoshis: 2015,
- height: 594892,
- confirmations: 5
- },
- {
- txid:
- "bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90",
- vout: 2,
- amount: 0.00000546,
- satoshis: 546,
- height: 594892,
- confirmations: 5
- }
- ]
- ```
- And return an array of Boolean values indicating if each UTXO is part of an SLP
- token transaction or not.
- Given the above input, the correct output should be:
- ```
- [ false, true ]
- ```
- Here is the raw transaction data from the full node that corresponds to the data above:
- ```
- "vout": [
- {
- "value": 0,
- "n": 0,
- "scriptPubKey": {
- "asm": "OP_RETURN 5262419 1 47454e45534953 534c5053444b 534c502053444b206578616d706c65207573696e6720424954424f58 646576656c6f7065722e626974636f696e2e636f6d 0 8 2 0000000bcdf49b00",
- "hex": "6a04534c500001010747454e4553495306534c5053444b1c534c502053444b206578616d706c65207573696e6720424954424f5815646576656c6f7065722e626974636f696e2e636f6d4c0001080102080000000bcdf49b00",
- "type": "nulldata"
- }
- },
- {
- "value": 0.00000546,
- "n": 1,
- "scriptPubKey": {
- "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
- "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
- "reqSigs": 1,
- "type": "pubkeyhash",
- "addresses": [
- "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
- ]
- }
- },
- {
- "value": 0.00000546,
- "n": 2,
- "scriptPubKey": {
- "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
- "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
- "reqSigs": 1,
- "type": "pubkeyhash",
- "addresses": [
- "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
- ]
- }
- },
- {
- "value": 0.00002015,
- "n": 3,
- "scriptPubKey": {
- "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
- "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
- "reqSigs": 1,
- "type": "pubkeyhash",
- "addresses": [
- "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
- ]
- }
- }
- ],
- ```
- The above transaction data was returned by a full node and is from a token creation. vout 3 is the change from the transaction. It has the same txid, but should not be classified as an SLP UTXO (e.g. should result in false being returned). vout 2 contains some part of the SLP token (either the token or the minting baton), so it should be classified as an SLP UTXO.
- From the guidance I've received thus far:
- - An easy way to tell if a UTXO does **not** belong to an SLP token is to send its TXID to rest.bitcoin.com for validation. If it returns false, then we can know for sure that UTXO is safe to spend.
- - If the TXID for the UTXO returns true, then we have to dig a little deeper to verify that it indeed an SLP token UTXO, and not a change address like vout 3 above.
- - The only way to do that, is by inspecting the OP_RETURN data in the transaction.
- ## Guidence Needed:
- - What part of the OP_RETURN data in the transaction above tells me that vout 3 is change and not part of the SLP token?
- - How do I decode this line to get the specifics of the SLP transaction?
- `"asm": "OP_RETURN 5262419 1 47454e45534953 534c5053444b 534c502053444b206578616d706c65207573696e6720424954424f58 646576656c6f7065722e626974636f696e2e636f6d 0 8 2 0000000bcdf49b00"`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement