Closed kunalransing closed 2 years ago
@kunalransing
Right now there is no api in cardano-client's backend layer to get transactions by block number. There is an api in AddressService to get transactions, but that may not be the best one for your use case.
But you can directly access the provider specific endpoint to fetch that. Like for Blockfrost, you can check this REST endpoint to get transactions for a block number.
https://docs.blockfrost.io/#tag/Cardano-Blocks/paths/~1blocks~1{hash_or_number}~1txs/get
There is a Java library for Blockfrost. You may want to try that to access the above endpoint https://github.com/blockfrost/blockfrost-java
Alternatively, you can check Oura project if you prefer a push based approach
https://github.com/txpipe/oura
Hope that helps.
@kunalransing
Right now there is no api in cardano-client's backend layer to get transactions by block number. There is an api in AddressService to get transactions, but that may not be the best one for your use case.
But you can directly access the provider specific endpoint to fetch that. Like for Blockfrost, you can check this REST endpoint to get transactions for a block number.
https://docs.blockfrost.io/#tag/Cardano-Blocks/paths/~1blocks~1{hash_or_number}~1txs/get
There is a Java library for Blockfrost. You may want to try that to access the above endpoint https://github.com/blockfrost/blockfrost-java
Alternatively, you can check Oura project if you prefer a push based approach
https://github.com/txpipe/oura
Hope that helps.
Hi @satran004 Thanks for your help. I have used https://cardano-mainnet.blockfrost.io/api/v0/blocks/{hash_or_number}/txs.
Hi, I'm new to Cardano. I'm developing a java application to send/receive coins. I need to know when someone sends funds to my address but I didn't find any subscribe-like function. Also, I didn't find anything to get transactions by block number. @satran004 Please help. Thanks.