Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. Hoping to get some guidance. I'm trying to make a utility function that will accept an array of UTXO data like this:
  2.  
  3. ```
  4. [
  5. {
  6. txid:
  7. "bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90",
  8. vout: 3,
  9. amount: 0.00002015,
  10. satoshis: 2015,
  11. height: 594892,
  12. confirmations: 5
  13. },
  14. {
  15. txid:
  16. "bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90",
  17. vout: 2,
  18. amount: 0.00000546,
  19. satoshis: 546,
  20. height: 594892,
  21. confirmations: 5
  22. }
  23. ]
  24. ```
  25.  
  26. And return an array of Boolean values indicating if each UTXO is part of an SLP
  27. token transaction or not.
  28.  
  29. Given the above input, the correct output should be:
  30.  
  31. ```
  32. [ false, true ]
  33. ```
  34.  
  35. Here is the raw transaction data from the full node that corresponds to the data above:
  36.  
  37. ```
  38. "vout": [
  39. {
  40. "value": 0,
  41. "n": 0,
  42. "scriptPubKey": {
  43. "asm": "OP_RETURN 5262419 1 47454e45534953 534c5053444b 534c502053444b206578616d706c65207573696e6720424954424f58 646576656c6f7065722e626974636f696e2e636f6d 0 8 2 0000000bcdf49b00",
  44. "hex": "6a04534c500001010747454e4553495306534c5053444b1c534c502053444b206578616d706c65207573696e6720424954424f5815646576656c6f7065722e626974636f696e2e636f6d4c0001080102080000000bcdf49b00",
  45. "type": "nulldata"
  46. }
  47. },
  48. {
  49. "value": 0.00000546,
  50. "n": 1,
  51. "scriptPubKey": {
  52. "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
  53. "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
  54. "reqSigs": 1,
  55. "type": "pubkeyhash",
  56. "addresses": [
  57. "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
  58. ]
  59. }
  60. },
  61. {
  62. "value": 0.00000546,
  63. "n": 2,
  64. "scriptPubKey": {
  65. "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
  66. "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
  67. "reqSigs": 1,
  68. "type": "pubkeyhash",
  69. "addresses": [
  70. "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
  71. ]
  72. }
  73. },
  74. {
  75. "value": 0.00002015,
  76. "n": 3,
  77. "scriptPubKey": {
  78. "asm": "OP_DUP OP_HASH160 70083e743742ad726a3a8f3a511d9a89f979dd63 OP_EQUALVERIFY OP_CHECKSIG",
  79. "hex": "76a91470083e743742ad726a3a8f3a511d9a89f979dd6388ac",
  80. "reqSigs": 1,
  81. "type": "pubkeyhash",
  82. "addresses": [
  83. "bitcoincash:qpcqs0n5xap26un2828n55gan2ylj7wavvzeuwdx05"
  84. ]
  85. }
  86. }
  87. ],
  88. ```
  89.  
  90. 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.
  91.  
  92. From the guidance I've received thus far:
  93.  
  94. - 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.
  95.  
  96. - 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.
  97.  
  98. - The only way to do that, is by inspecting the OP_RETURN data in the transaction.
  99.  
  100. ## Guidence Needed:
  101.  
  102. - 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?
  103.  
  104. - How do I decode this line to get the specifics of the SLP transaction?
  105.  
  106. `"asm": "OP_RETURN 5262419 1 47454e45534953 534c5053444b 534c502053444b206578616d706c65207573696e6720424954424f58 646576656c6f7065722e626974636f696e2e636f6d 0 8 2 0000000bcdf49b00"`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement