For a web app, I'm wondering is there an API/SDK that enables you to execute some code every time an address receives ADA, NFT, or native token? The wallet address receiving does not change. If not, what repos should I start at for building this sort of functionality?

For example, I'm selling NFTs on my website and my wallet address is shown which anyone can send a specific amount of ADA to in order to get a random NFT from the collection. I want to execute the functions which pick a random NFT from the collection to mint every time my wallet receives the specified amount of ADA.

  • You have a lot of answers, good time to mark one as accepted :-)
    – gRebel
    May 5, 2022 at 8:05

5 Answers 5


There are different ways.

You can do what jnprogrammer said, or you can run the graphql setup https://github.com/input-output-hk/cardano-graphql providing an entire stack of tools including the API (graphQL).

The graphQL query you're looking for could look like this

query {
  transactions(where: {outputs: {address: {_eq:"addr1..."}}}) {
    outputs {

and you'll receive a list of sending address and receiving address with the amounts in lovelace

If you don't want to build and run any of that yourself, you could also use a public API. I am not sure if there are any reliable public graphQL endpoints out there, but e.g. blockfrost.io offers a REST API. The downside of that is you rely on a third party and you depend on that service being up to date with the network and always up and running. On the other hand, depending on your experience and admin skills, it can also be the more reliable option :)

  • Thanks for the reply! That's exactly what I was looking for from an API standpoint, and your clarification is much appreciated, I may go with the REST API after some investigating. Now if I can just find a way to get that query to trigger every few minutes or so in my web app, it would be as close as possible to constantly "listening" to all sending addresses. Oct 17, 2021 at 15:23
  • 3
    Just to follow on this good answer, you might use the websocket-link with Blockfrost github.com/blockfrost/blockfrost-websocket-link Oct 19, 2021 at 7:13

I believe this guide would help you out: https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-wallet/

  • this is polling, not listening
    – Eugene
    Dec 31, 2021 at 21:00

How about running a Cardano node and build a script that queries the target address and produces something consumable by your API?

  • Thanks for the reply! This sounds something I would be interested in doing, but where do I start with this "script"? Excuse me for my inexperience, but this script is somehow connected to the cardano-node I'm running? Something "consumable" by my API means an output the code in my web app could interpret? Oct 17, 2021 at 15:17

All the above solutions can do the job, but you'll end up polling the blockchain on each one. Another solution though is using tangocrypto services. Their webhooks feature will allow you to "react" to different blockchain events such as PAYMENT. So you just need to set up a webhook and start listening to a specific address. You will get a callback notifying you every time the address receive a payment.


What info do you wanna get specifically? If it is just the UTXO's at an address and you are running a node then the following script suffices.


cardano-cli query utxo --mainnet --address $(cat ~/path/to/file.addr) > ~/UtxosAtAddress

If you would like more info on transactional data you could run the cardano-db-sync package in along side the node. Via this you can query a lot of data, but it does require some PostgreSQL knowledge.

Now if you have no interest in running a node or the cardano-db-sync, you could also query third party api's. A nice one to mention is Blockfrost that has multiple languages supported. For more info on this see their website [1]

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.