1

we are trying to integrate polkadot support for our exchange. Currently we want to monitor the blockchain and see if any of our address receive deposits, I am currently doing this by checking the extrinsics and see if the method transfer or transfer_keep_alive is called and see the destination of the transfer is equal to our address. Is this enough of do i need to check the events as well not quite sure

2 Answers 2

2

I am currently doing this by checking the extrinsics and see if the method transfer or transfer_keep_alive is called and see the destination of the transfer is equal to our address

Calling methods does not guarantee success. It is best to ALWAYS listen for events. In many cases an Event can also be emitted from an Extrinsic where you would not expect it. This applies to many other blockchains as well. In the case of Substrate you probably also only want Finalized Events.

There are indexing services which conveniently ingress the events and make them queryable et. al in case you need to quickly bootstrap your backend.

1
  • 1
    Exactly this. We also have an integration guide with a specific note about monitoring deposits: "If you want to monitor deposits into an address, keep in mind that several transactions can initiate a balance transfer (such as balances.transferKeepAlive and a utility.batch transaction with a transfer inside of it). Only monitoring balances.transfer transactions will not be sufficient. Make sure that you monitor events in each block for events that contain your addresses of interest to ensure that you can properly credit deposits." Oct 14, 2022 at 5:24
1

I think this should depend on what you want to support for the target chain. (allow the users to deposit tokens to your exchange in what way)

If you want to support XCM, then you should also check those pallets' logic.

For the pallet-balances, I think transfer, transfer_keep_alive and transfer_all are enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.