Hello all, who can help me with a problem bugging me for days now. I am using the dkackman’s chia-dotnet that is basically a C# RPC interface lib.
I want to recover the SENDER WALLET ADDRESS in a CAT transaction using RPC.
I have tried:
private static async Task GetAddressFromPuzzle(TransactionRecord transaction)
//Open the full_node endpoint to get the return address
EndpointInfo full_node_endpoint = Config.Open().GetEndpoint(“full_node”);
using HttpRpcClient full_node_rpcClient = new HttpRpcClient(full_node_endpoint);
FullNodeProxy full_nodeProxy = new FullNodeProxy(full_node_rpcClient, “chia_originservice”);
//Get the parent coin from the full node
string parentcoin = transaction.Additions.First().ParentCoinInfo;
CoinRecord coinRecord = await full_nodeProxy.GetCoinRecordByName(parentcoin);
//convers puzzlehash to address
Bech32M bech32M = new Bech32M();
string? address = bech32M.PuzzleHashToAddress(coinRecord.Coin.PuzzleHash);
This code works perfectly for a Coin (Chia) but gives me another wallet address for a CAT (if I try send a CAT to this address does not return in the sender wallet).
Can someone explain what is different with CAT’s? What I am missing?
Once you get the parent’s parent coin id and its spent block height (the confirmed_block_index of the parent should be the same as the spent_block_index of its parent’s parent) , you can find the CoinSpend using get_puzzle_and_solution.
Once you have the CoinSpend, you can run the puzzle_reveal with the solution and get the list of conditions which should include (CREATE_COIN <outer_ph> amount (<inner_ph>)) and you can get the CAT wallet address from the inner_ph.
Second method: Because CAT curries in the inner puzzle, we can uncurry parent’s puzzle and find the inner puzzle hash from the 3rd uncurried arguments.
Do you have any example of CAT coins you want to find the senders on testnet or mainnet?