Finding DigiAssets transactions on the blockchain

From DigiByte Wiki
Jump to navigation Jump to search

DigiAsset encoding is found in the OP_RETURN data.

You can find additional detailed in formation here on GitHub

If you are using DigiByte-Core to find transactions that contain DigiAsset information, you will want to be checking in the OP_RETURN details for a transaction (Naturally iterating through all transactions in a block etc).

For example:


getrawtransaction 477d80fe1ad594937e2dd8869ecafe4373f484bd25c9650ae3c80b6ec23e70b7 1

We specifically want:

    {
      "value": 0.00000000,
      "n": 2,
      "scriptPubKey": {
        "asm": "OP_RETURN 44410215000a012091",
        "hex": "6a0944410215000a012091",
        "type": "nulldata"
      }
    },

The OP_RETURN data starting with 4441 means "DA" for "DigiAsset", and the "02" is the DigiAsset version, followed by "15" meaning "No Metadata" so we're just doing a plain transfer of DigiAssets in this transaction.


You can read more about the OP_CODES: https://github.com/DigiByte-Core/DigiAssets-Protocol-Specifications/wiki/OP_CODEs


If you are so inclined, you can also decode that OP_RETURN value from Hex to ASCII to see the "DA", paste the "44410215000a012091" in to here: https://www.convertstring.com/EncodeDecode/HexDecode



We can look at another example:


getrawtransaction 5cd98839593f89307e5b6154936163fc4db99494326eb7604e78bf6526ed75da 1

We specifically want:

    {
      "value": 0.00000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_RETURN 444101015c00ca6d3856ef5d3bfe2f824800975b92af89bbb7162cdb3fa03c0853ca1b54015220f0ccb8b2308fe74c69f2610bb18704304f201400201410",
        "hex": "6a3e444101015c00ca6d3856ef5d3bfe2f824800975b92af89bbb7162cdb3fa03c0853ca1b54015220f0ccb8b2308fe74c69f2610bb18704304f201400201410",
        "type": "nulldata"
      }
    },

This is an issuance transaction, we know based on it containing the SHA hash, as well as looking at the first few bytes. "4441" is "DA" for DigiAsset, "01" for the DA version, "01" for "SHA1 Torrent info_hash + SHA256 of metadata in 80 bytes OP_RETURN" followed by the details.