How do I integrate Rosetta API with a Bitcoin fork?

How do I use Rosetta to integrate a Bitcoin fork? Is there a basic starting point for doing this? Interested in how this works and then making a block explorer.

Apologize in advance @travanx for not having a blog post or something of the sort that walks through a reference implementation! We are looking to put something like this together once we release the Wallet API. Below, I’ve outlined some high-level steps to create a Bitcoin-based implementation!

Integrating Rosetta

Write Rosetta API Implementation

There is an example of creating a mock server here (you could imagine replacing the stubbed block responses with requests to your node).

In the coming days, many more teams will share their implementations in the #ecosystem. You should follow activity there for more examples of how to write an implementation. Additionally, the blog post I wrote links to Celo’s implementation.

If you start a repository, I’m happy to take a look and let you know if anything looks off (post your progress on this thread)!

Single Dockerfile

Create a Dockerfile that starts both the Bitcoin-based node and your Rosetta Node API implementation (what you built in the previous step).

In the case of Bitcoin, this could involve using a base Dockerfile like this one and adding some steps to pull in your Rosetta implementation (which could live in a different repository but is cloned in the Dockerfile).

Validating Correctness

Once you have a running node + Rosetta Node API middleware, run the rosetta-cli check command to make sure your implementation passes basic correctness checks (ex: responses are formatted correctly, balances are correctly accounted for). You can find more information about the rosetta-cli tool here.

Other Expectations

There is a collection of other expectations integrators listed here.

Building Block Explorer

Working on a block explorer depends a lot on the storage backend you want to use but I’ve attached some useful resources below…

Quick Syncing Intro

I’d recommend reading this blog post for a quick primer on how to sync blocks from a Rosetta implementation.

Syncer + Parser Package

We spent a lot of time working on the syncer and parser packages to make it easy to sync blocks from a Rosetta Node API implementation and extract all balance changes, respectively. You can look for an example of how these are used in the rosetta-cli repository.

Good luck!

1 Like

Thank you so much. Going to attempt a Denarius (D) Rosetta implementation with the team. Big fan of docker so that will make this easier to figure out.

1 Like