Skip to content
forked from celo-org/rosetta

go server implementation of the Rosetta API spec

License

Notifications You must be signed in to change notification settings

xiaoxiaff/rosetta

Repository files navigation

Celo Rosetta

A monitoring server for celo-blockchain

Overview

Starting rosetta

To run rosetta do:

    rosetta run [options]

Where rosetta is the binary.

  • If on development you can replace rosetta by go run main.go

Example for RC1:

Prerequisites:

  • Download celo-monorepo branch rc1 and yarn && yarn build
  • Download celo-blockchain branch rc1-tracing-fix and make all
  • Download rosetta branch master update go.mod and make gen-contracts && make all
  • Run make rc1-env to create an empty datadir with the genesis block
rosetta run \
  --genesis ./envs/rc1/genesis.json \
  --geth ../celo-blockchain/build/bin/geth \
  --staticNode "enode://5e0f4e3aaa096e2a2db76622b335cab4d3224d08d16cb11e8855a3a5f30c19d35d81a74b21271562e459495ab203c2f3a5a5747a83eb53ba046aeeb09aa240ff@34.83.110.24:30303"
  --datadir "./envs/rc1"

Example for Alfajores:

Prerequisites:

  • Download celo-monorepo branch alfajores and yarn && yarn build
  • Download celo-blockchain branch alfajores-tracing-fix and make all
  • Download rosetta branch master update go.mod and make gen-contracts && make all
  • Run make alfajores-env to create an empty datadir with the genesis block
rosetta run \
  --genesis ./envs/alfajores/genesis.json \
  --geth ../celo-blockchain/build/bin/geth \
  --staticNode "enode://05977f6b7d3e16a99d27b714f8a029a006e41ec7732167d373dd920d31f72b3a1776650798d8763560854369d36867e9564dad13b4b60a90c347feeb491d83a9@34.83.42.50:30303"
  --datadir "./envs/alfajores"

Example for RC0:

Prerequisites:

  • Download celo-monorepo branch rc0 and yarn && yarn build
  • Download celo-blockchain branch mc/rosetta-rc0 and make all
  • Download rosetta branch rc0 update go.mod and make gen-contracts && make all
  • Run make rc0-env to create an empty datadir with the genesis block
rosetta run \
  --genesis ./envs/rc0/genesis.json \
  --geth ../celo-blockchain/build/bin/geth \
  --staticNode "enode://33ac194052ccd10ce54101c8340dbbe7831de02a3e7dcbca7fd35832ff8c53a72fd75e57ce8c8e73a0ace650dc2c2ec1e36f0440e904bc20a3cf5927f2323e85@34.83.199.225:30303" \
  --datadir "./envs/rc0"

Running with the docker image

Docker image is configured by default to:

  • Use geth binary inside the image
  • Use /data as datadir (should to be mounted)
  • Expects genesis.json to be at /data/genesis.json
  • HttpServer listens on port 8080

To run the docker image do:

docker run -v "${PWD}/envs/rc0:/data" -p 8080:8080--name rosetta gcr.io/celo-testnet/rosetta:0.1 run \
  --staticNode "enode://33ac194052ccd10ce54101c8340dbbe7831de02a3e7dcbca7fd35832ff8c53a72fd75e57ce8c8e73a0ace650dc2c2ec1e36f0440e904bc20a3cf5927f2323e85@34.83.199.225:30303"

Dev Guide

Setup

You need:

Makefile requires the following env variables:

  • CELO_BLOCKCHAIN_PATH: By default defines as ../celo-blockchain
  • CELO_MONOREPO_PATH: By default defines as ../celo-monorepo

go.mod is set up to build celo-blockchain from ../celo-blockchain. Which is the default path, if you need to change it DON'T COMMIT IT

Build Commands

Important commands:

  • make all: Builds project (compiles go project, compiles bls-zexe)
  • make gen-contracts: Regenerates contract wrappers
  • make test or go test ./... to run unit tests
  • go build ./... to build all modules (only compiles, doesn't generate or compile rust library)

Managing Generated Contracts

Rosetta requires a few Celo Core Contracts

  • The list of required contracts is defined on scripts/gen-contracts.go file
  • Generation requires acces to celo-blockchain & celo-monorepo.
  • Generation assumes both projects are already properly built
  • To run generator do make gen-contracts

How to build Docker Image

Commands:

  • make docker-build
  • make docker-publish

How to run rosetta-validator

go get -u github.com/coinbase/[email protected]
mkdir validator-data 
go run examples/generate_balances/main.go \
  https://storage.googleapis.com/genesis_blocks/alfajores \
  validator-data/bootstrap_balances.json
rosetta-validator check:complete

About

go server implementation of the Rosetta API spec

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.9%
  • Other 2.1%