0

I want to get the mempool data and find out which tranactions are ordinal inscription transaction. So if I want to find the mempool that will be confirmed and find how many ordinal inscription transactions are there what shell I check. Is there a way to do this using bitcoin-cli?

Initially I thought first getting the bestblock by

    # Get the blockhash of the best block, but not right for now
    cmd = ['bitcoin-cli', 'getbestblockhash'] # Shall get the last nconfirmed block
    result = subprocess.run(cmd, capture_output=True, text=True)
    best_block_hash = result.stdout.strip()
    # Get transaction IDs from of the block
    cmd = ['bitcoin-cli', 'getblock', best_block_hash]
    result = subprocess.run(cmd, capture_output=True, text=True)
    mempool_txids = json.loads(result.stdout)

Assuming I have the txids of the last memblock how can I understand if the transaction is a ordinal inscription transaction?

1 Answers1

0

Since Bitcoin core is unaware of Ordinals, I guess you'd have ask it for the raw tx data and parse the witness data looking for the "ord" fingerprint, following Casey Rodarmor's specification. You might also want to check the Inscription MIME type etc to distinguish BRC-20 from other inscription types.


Look for ASCII "ord" (hex 6f7264) at the appropriate offset in the second† witness component. It is described in the documentation

See How to differentiate between BTC transactions and BRC20 transactions on a blockchain?

†strictly penultimate IIRC.

RedGrittyBrick
  • 26,841
  • 3
  • 25
  • 51
  • "txinwitness": ["4491854e7bd95a6cb10955829e37b899bdb3682950922d4cfe7aa14f38e0e7976a6786ee6bf4cb4a07dc7672e4955180f9425081d11f2fd03387de7ea344ecce", "20117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423eac0628a3d1958801750063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800397b2270223a226272632d3230222c226f70223a227472616e73666572222c227469636b223a224d585243222c22616d74223a2233353030227d68", "c0117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423e" ], this is the witness data how do I look for "ord" finger print – Gencehan ARPAÇAY Jun 07 '23 at 13:11
  • Look for ASCII "ord" (hex 6f7264) at the appropriate offset in the second witness component. It is described in the documentation – RedGrittyBrick Jun 07 '23 at 14:41