Davidson-Souza / rpc-utreexo-bridge

A simple and fast Utreexo bridge node. For a signet running instance of the API, use api.dlsouza.lol
MIT License
3 stars 1 forks source link

Are there any ready-to-use dumps for utreexo #2

Open MCJOHN974 opened 3 weeks ago

MCJOHN974 commented 3 weeks ago

Hi! I found this repo and what to do some project based on it. I want to get utreexo for some latest blocks (I'm ok with format this repo use). I tried to run code from this repo using esplora API, and found that it will taka around 10 days to fetch to the latest blocks. Probably, you have some utreexo dumps you can share?

GradleD commented 2 weeks ago

Using Esplora API Efficiently Batch Requests Instead of fetching blocks one by one, you can retrieve multiple blocks in a single request. The Esplora API supports batch requests through its endpoints, allowing you to gather data more quickly.

Example of Fetching Multiple Blocks You can utilize the /blocks endpoint to get the latest blocks. However, to implement batching effectively, you may need to create a custom solution since Esplora does not have a dedicated batch endpoint. Here’s a suggested approach:

Fetch Latest Blocks:

Use the following endpoint to get the latest block details:

GET /blocks/tip/height This returns the height of the latest block. Retrieve Blocks in Batches: Create a loop that fetches multiple blocks using their heights. For example, if you want to get the last 10 blocks, you can do:

for i in {0..9}; do
    curl "https://blockstream.info/api/block/$(($latest_height - $i))"
done

Considerations Rate Limits: Be aware of any rate limits imposed by the API to avoid being throttled. Error Handling: Implement error handling for failed requests to ensure your application can recover gracefully. Parallel Requests: If your application allows, consider making parallel requests using asynchronous programming techniques to further speed up data retrieval.

Davidson-Souza commented 2 weeks ago

Hi! I found this repo and what to do some project based on it. I want to get utreexo for some latest blocks (I'm ok with format this repo use). I tried to run code from this repo using esplora API, and found that it will taka around 10 days to fetch to the latest blocks. Probably, you have some utreexo dumps you can share?

I don't. We may change some stuff, so I didn't bother. The esplora thing is totally not optimized, I made this to keep up after ibd, because I have one running on signet. I don't think esplora will ever let us do this mich request, even with batching