I'm working on a TG bot used for exchange of crypto <-> fiat.

Each customer is assigned a wallets which he is to send coins to, however he wants to, priour to receiving fiat. The same wallet then gets used by a user for all future transactions.

One customer = one wallet for all the TXs, that is.

A bot, on the other hands, is supposed to identify whether or not a wallet has been topped up for a certain deal or trade. Once topped up, an operator gets notified and gives fiat to a customer.

Issue: how to identify if a certain incoming transaction corresponds to a particular trade?


  • Customer could, theoretically, open a deal and abandon it.

  • Customer could also open 5 subsequent deals, abandon first 4, and then proceed only with the latest one -- send coins to a wallet.

  • Customer could open a deal, send coins, receive fiat and then open a new deal for the same amount right away.

  • And I can't force a customer to attach a special deal ID to a transfer because not all the wallets, nor even blockchains, support this.

  • The sum of a deal may not be used because it's not unique.

How would a bot identify which transaction on blockchain, in a wallet, belongs to which deal of a user? And whether there's even been any transaction for the current deal at all?

Note that it works the way I've described - in Telegram. There're no smart contracts, nor web3 wallets on a website, and this is a requirement.

1 Answer 1


This is more of a design question for your application, but since it's essentially an escrow with two participants, your bot and your user, you'll be best off having a smart contract that manages escrows.

Using a PDA defined by the user's wallet address, you can ensure only one escrow per user, and then your bot can listen for transactions into your smart contract, and take action based on that.

I'm not sure of what's available when developing on TG, but if you can send funds, then you should equally be able to interact with any smart contract given a client library.

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.