Hey there Stacks community, Faried here from Tintash. We had the opportunity to implement the Rosetta API Specifications for Stacks 2.0 and wanted to share that it’s now ready for you to use! The APIs are available on the Stacks 2.0 testnet and will be accessible in all future API versions.
The Stacks Blockchain API implements the Rosetta Specification version 1.4.6 and benefits from explicit design choices and tooling for simpler and more reliable blockchain integrations. As Rosetta Specifications are getting more attention in the industry and gain more adoption, there will be more changes needed to support the latest specifications. We have extended the current Stacks Blockchain API implementation to fully support the latest Rosetta Specifications and will continue to update the API to support future versions of the Rosetta Specifications.
Fortunately, most of the existing API endpoints were already very close to specifications and we were able to do with just a translation layer. There were however, other endpoints which were new for Stacks API and had to be implemented from scratch. A big thank you to @diwaker and @zone117x who were a constant help as we worked to add Rosetta support.
More about Rosetta
Rosetta has a great validation mechanism of its own in the form of rosetta-cli and it can check the correctness and completeness of the API with significant context of the chain state. To make this more robust, we have a separate Docker image that one can run rosetta-cli against to validate correctness. This can be used to either run a local mocknet for development, or connect with the existing testnet:
$ docker build -t stx-rosetta:stable https://raw.githubusercontent.com/blockstack/stacks-blockchain-api/master/stx-rosetta.Dockerfile # other options for STACKS_NETWORK are: dev (local development), # mocknet (same as testnet), and mainnet (will work when it is launched). $ docker run -d -p 3999:3999 --mount source=rosetta-data,target=/data \ --name stx-rosetta -e STACKS_NETWORK=testnet stx-rosetta:stable
After syncing with the blockchain, you can perform queries by using the rosetta-cli tool, or by hitting the API endpoints. Sample configuration files for rosetta-cli are in the repository, and the API documentation (including Rosetta endpoints) is at https://blockstack.github.io/stacks-blockchain-api/. It is also part of the CI/CD pipeline and validates the API correctness and completion on each deployment.
This is the first big undertaking of Tintash Devs: Faried, Faizan, Nouman and Asim and we all had a blast working on Stacks 2.0 and becoming part of the Stacks ecosystem.
We are all really excited to dive further into the disk state in mempool as well as mining next and see what documentation and tooling can help the community in better understanding the block states and mempool in Stacks 2.0.