Flow of operation for Deposit

Hey Guys,

Can you please have a look at the below steps and let me know if i am missing any steps for a user deposit?

  1. Get the latest block information through /network/status
  2. Query the specified block information through /block
  3. Judge whether a fork occurs through block_identifier.hash and parent_block_identifier.hash
  4. Analyze transactions to obtain transaction details
  5. Analyze other_transactions to obtain txId and obtain transaction details through /block/transaction
  6. Get txId = transaction_identifier.hash
  7. Get operations loop analysis operation
  8. Get type = operation.type; status = operation.status
  9. Comparison (type == “input” || type == “output”) && “success”==status This condition must be fulfilled
  10. When type == “input”, get fromAddress = operation.account.address
  11. Get when type == “output” toAddress = operation.account.address; value = operation.amount.value; symbol=operation.amount.currency.symbol; decimals=operation.amount.currency.decimals
  12. The comparison symbol== “ADA” && decimals == 6 must be established
    13.amount = value/1000000
    14: Get the final fromAddress, toAddress, amount at this time

Hi @Mando!

Welcome to the Rosetta community! Apologies for the late response.

I am assuming you are using Rosetta APIs in an application to talk to a UTXO based blockchain like Cardano (yay). Your approach for detecting deposits/confirming withdrawals looks correct at a high level.

Like you mentioned, you would

  • periodically fetch the latest block.
  • handle reorgs.
  • fetch transactions, and filter out transactions that are of interest to you. For instance, transactions that have operations affecting an address you are interested in.
  • from the transaction operations you would determine debits and credits and take appropriate actions.

Hope that helps! Thanks!

1 Like