This is implementation of the Rosetta API for Gear-based blockchains, such as Vara Network.
Rosetta API is a development tool created by Coinbase that makes it easier for blockchains to work with a range of third-party applications, exchanges like Coinbase, wallets, OTC desks and other services. As the integration kit by Coinbase, Rosetta API helps Gear-based blockchains integrate with Coinbase's existing platforms.
-
Install Yarn
-
Install dependencies and build the project
yarn install yarn build
-
Run server in different modes
- Offline mode:
yarn start:offline
- Online mode:
- Connected to development node:
yarn start:dev
- Connected to test network:
yarn start:test
- Connected to Vara network:
yarn start:vara
Also you can specify custom ws and http addresses to connect to networkyarn start:dev --ws wss://host:port --http http://host:port
- Connected to development node:
- Offline mode:
If you have need to specify different port of Rosetta API server you
- Offline mode
docker run -dt -p 8080:8080 ghcr.io/gear-tech/rosetta-api
- Online mode on testnet
docker run -dt -p 8080:8080 -v /tmp/gear:/data ghcr.io/gear-tech/rosetta-api:testnet
- Online mode on vara
docker run -dt -p 8080:8080 -v /tmp/gear:/data ghcr.io/gear-tech/rosetta-api:vara
Server will be running on port 8080
- Go to
server/networks
- Create file
network-name.json
- Use
development.json
file as a template
- Install rosetta-cli tool
- Run Gear node in development mode with flag
--pruning archive
- Generate a Gear node spec file:
./gear build-spec --dev > dev.json
- Add a prefunded account to spec file:
There is a nodejs script that can to do it automatically. (
test/set-prefunded-acc.js
)node ./test/set-prefunded-acc.js path/to/generated/dev.json path/to/rosetta-cli/config.json
- Run the Gear node using this command:
gear --chain /path/to/dev.json --tmp --alice --pruning archive --rpc-methods Unsafe --rpc-cors all
- Run Rosetta API server
- Run tests:
check:construction
- This test will check the correctness of a Rosetta Construction API Implementation
/path/to/rosetta-cli --configuration-file ./test/development/config.json check:construction
check:data
- This test will check the correctness of a Rosetta Data API Implementation
/path/to/rosetta-cli --configuration-file ./test/development/config.json check:data
See the documentation on using the rosetta-cli tool here