Building and running Rosetta from source code
In Running with Docker, you learned that the Docker container runs the mina daemon, mina-archive, and Rosetta API.
If you already have mina-archive up and running, you can also build and run the Rosetta API natively and wire it to the existing mina daemon and mina-archive.
To run mina daemon and mina-archive natively, follow the Archive Node page instructions.
The easiest way to build Rosetta natively is to use the Nix development environment.
-
Clone the official mina repository and switch to the
compatible
branch. -
If you don't already have Nix on your machine, install it following the steps in the nix/README.md.
-
Run the
./nix/pin.sh
script to enable submodules to be available to the build:./nix/pin.sh
-
Launch the development shell:
nix develop mina
-
Build Rosetta app:
dune build --profile=mainnet src/app/rosetta
-
After a successful build, the Rosetta app is available here:
_build/default/src/app/rosetta/rosetta.exe
You can run it with following command:
MINA_ROSETTA_MAX_DB_POOL_SIZE=64 \
_build/default/src/app/rosetta/rosetta.exe --port 3087 \
--graphql-uri <URL to Mina GraphQL instance>
--archive-uri postgres://<username>:<password>@<host>:<port>/<db_name>