Chia - Retrieve transaction from blockchain

Hi,
I’m new to blockchain so I apologize for my questions.
How can I retrieve a transaction from blockchain without using the wallet, just the transaction id? I need to recover as many information as I can (memos field included) from the network.
Thanks in advance.
Regards,
Francesco

You can find transaction information on a Chia block explorer like Spacescan https://www.spacescan.io/

You can also use the full node RPC to get this information. On Chia, transaction id = name/id of the coin that was spent. You can get the coin record, then use that to fetch the full puzzle reveal + solution. Or, using coinset.org: endpoint 1 endpoint 2

1 Like

Thanks for your reply.
When I get the puzzle reveal and the solution, is it possible to use them to obtain the transaction data? If so, how?
Thanks again

1 Like

You’d run the puzzle reveal with the solution. The output is known as the condition list, which you’d walk through, most likely searching for CREATE_COINs with your recipient’s puzzle hash.

Coinset has an endpoint that will run the puzzle and give you conditions indexed by their opcode; the downside is that you won’t have that endpoint if you ever run the code against your full node’s RPC.

I found out that I created a transaction that spends coins without creating it; when I try to get the coin record using the name (the field “name” which is the same of transaction id), the “coin_records” field is empty; so I didn’t find a way to get the puzzle reveal and solution. Any clues? Sorry to bother, but I can’t find a solution, even in the documentation.
Many thanks

That’s weird - make sure you’re on the same network (testnet coins won’t be available on the mainnet network). Would you be able to share part of one such transaction? (make sure to remove the signature so someone can’t broadcast it)

The transaction id is “0x12f5384fc31c77064085d1b74e6d90c43ea436c6504c00ece1bc42074b1a1cf3”. Many thanks

Are you getting that from the wallet RPC? In that case, it’d be the hash of the mempool item and you’d have to use this endpoint, which would only return an item until the transaction is confirmed (included in a block).

Right, but the command “chia wallet get_transaction -tx 0x12f5384fc31c77064085d1b74e6d90c43ea436c6504c00ece1bc42074b1a1cf3 -v” says that the transaction is confirmed:
‘confirmed’: True,
‘confirmed_at_height’: 2001008,
‘created_at_time’: 1738848206, etc.
So I think it’s not in mempool anylonger but in a block, isn’t it?

The Chia wallet keeps a local database of transactions and their statuses. That information would be lost if you deleted the wallet database - you can’t recover it from the blockchain because the spend bundles (transactions) in a given block are all combined when the block is farmed. Apologies for the confusion; I thought you were referring to what SpaceScan (and other community projects) are calling transaction id.

No need to apologize, my fault because of my english. So is there a way to retrieve a spend bundle (memos included) from the blockchain? My problem is that I’ve to send data (a JSON) to the blockchain and give a way to retrieve the same data from an explorer or using an API. Is it possible?
Many many thanks

Before I recommend using Sage, can you tell a bit more about your use-case? Do you need the full transaction spend bundle or just to list the coins sent to an address, along the memos they’re sent with? If it’s the latter, you can bech32m decode the address to get the puzzle hash corresponding to that address, and then you can get coin records via get_coin_records_by_puzzle_hash. Having the records of the coins in that address, you can then look up the parent spend (the tx made by your wallet with the memos - parent_coin_info is the parent coin’s name, and confirmed_block_index is the parent’s spent_block_index) and get memos via the process I mentioned above.

You can also try Mixch - Pawket Developer for inspection tools

@stl: a useful inspection tools to verify my transaction, thanks!
@yakuhito: thanks for your answers. I should retrieve as many transaction data as possible from the network bypassing my wallet (to detach the retrieval from it, to avoid to depend on wallet db). Unfortunately I didn’t understand exactly what you suggested me, I’m still bad at it: if I have a transaction spend bundle (returned by my “create_signed_transaction” call), which are the steps I should execute to retrieve all the transaction infos (memos field included)?

Really sorry to bother both of you.
Many thanks in advance,
Francesco