Jump to content
Debasish

Reconciliation of Transaction with balances

Recommended Posts

Requirement - For a given address(rh2EsAe2xVE71ZBjx7oEL2zpD4zmSs3sY9) till a particular date fetch the balance and reconcile with all the transactions

Steps Followed :

1. Fetch MaxLedger By Date - https://data.ripple.com/v2/ledgers/2019-07-22   output - ledger_index - 48836766

2. Get the Balance for an Address with ledger_index - 

https://data.ripple.com/v2/accounts/rh2EsAe2xVE71ZBjx7oEL2zpD4zmSs3sY9/balances?ledger_index=48836766&currency=XRP

output - "value": "199.888"

3. Pull out all the transactions and and add or substract based on inflow and outflow for the particular address

https://data.ripple.com/v2/accounts/rh2EsAe2xVE71ZBjx7oEL2zpD4zmSs3sY9/transactions?descending=true&limit=1000&end=2019-07-22&marker=

output - with all the transactions for that particular address till the specified date.

4. choose all the transactions which are less then or equall to 48836766 and then take the affected nodes array for each transaction to identify whether the address we are reconciling has a outflow of XRP(-ve) or inflow of XRP(+ve).

From the affected nodes array the fields which i am considering is with key 

  • "ModifiedNode" and "CreatedNode" with LedgerEntryType:"AccountRoot"

(please find the image attached)

- Reconcilliation is perfect for couple of addresses i did.

Please help me if my steps are proper or do i need to consider any extra things in affected nodes .

 

Note : i have considered the fee also spent by the particular address as well.

 

transactions.png

modified_Node.png

Share this post


Link to post
Share on other sites

I’m not sure of what you are trying to achieve here.  Are you trying to check if invariants are always applied?  Like a sanity check on the ledger?

Any audit on the ledger is always a good thing,  but to be honest I would be shocked if you found a discrepancy.

After looking again...   ah,  are you trying to get a scripted way to see if an account is growing or shrinking since a certain date?

Share this post


Link to post
Share on other sites

Thank you for the quick response.

you are correct it is for auditing. 

For example someone provides his address and wants to pull all his transactions in his account till date(09/08/2019) and when we sum up all his transactions it should be equal to the balance he has till that date in his account. 

So in the above post i had mentioned the steps i am following to achieve the same. Can you please validate if that is the right way to go ahead.

Share this post


Link to post
Share on other sites

The data API service is a layer of metadata on top of ledger data and it can be wrong. I recommend writing your implementation against rippled APIs, hosting one yourself that you can query and using the public infrastructure by Ripple (s1/s2) as a backup/failover only.

Edited by Sukrim

Share this post


Link to post
Share on other sites
1 hour ago, Sukrim said:

The data API service is a layer of metadata on top of ledger data and it can be wrong. I recommend writing your implementation against rippled APIs, hosting one yourself that you can query and using the public infrastructure by Ripple (s1/s2) as a backup/failover only.

Thanks Sukrim for the heads up . could you please point me to some of the rippled Apis if any one is using and have exposed their Apis.Below is the list of validator nodes, if you have some info if some of them are have exposed their Apis for public.

https://minivalist.cinn.app/validators

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...