#definition #connector #rosetta #shared #chain #traits #client-server

rosetta-core

Provides traits and definitions shared by the server and client crates

4 releases (breaking)

0.4.0 Jun 29, 2023
0.3.0 Jun 29, 2023
0.2.5 May 1, 2023
0.1.0 Mar 30, 2023

#4 in #rosetta

Download history 48/week @ 2024-07-19 31/week @ 2024-07-26 33/week @ 2024-08-02 35/week @ 2024-08-09 27/week @ 2024-08-16 25/week @ 2024-08-23 27/week @ 2024-08-30 27/week @ 2024-09-06 23/week @ 2024-09-13 42/week @ 2024-09-20 37/week @ 2024-09-27 11/week @ 2024-10-04 18/week @ 2024-10-11 23/week @ 2024-10-18 13/week @ 2024-10-25 27/week @ 2024-11-01

82 downloads per month
Used in 15 crates (9 directly)

MIT license

200KB
3K SLoC

Rosetta SDK Documentation

The Rosetta is a set of tools for blockchain integration, it's goal is make blockchain integration simpler, faster, and more reliable. This repo provides a framework for Analog’s chronicles — special nodes hosted by time node operators — to simplify their interactions with Analog-connected chains in a manner compliant with the Analog Network’s protocol.

Repository structure

This repo contains the following modules:

  • rosetta-core. Provides traits and definitions shared by the server and client crates.
  • rosetta-server. This is a generic implementation of the Rosetta Server. The Rosetta Server is a standalone server that a connector on any Analog-supported chain can connect to and listen to the port specified in the settings.
  • rosetta-client. This is a standard client that interacts with the Rosetta Server.
  • rosetta-types. It contains the request and response structs used by the client and server. It is initially autogenerated using the openapi-generator.
  • rosetta-crypto. It has cryptographic primitives used by the rosetta-client.
  • rosetta-wallet. This is a command line interface (CLI) built with the rosetta-client.
  • rosetta-cli. This is a CLI built with the rosetta-client.
  • rosetta-docker. This is a generic Rosetta Server testing infrastructure.
  • chains. These are chain-specific client/server components.

Getting started

To get started with the Rosetta SDK, ensure you have following dependencies installed:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install --locked svm-rs
cargo install --locked dprint
cargo install --locked cargo-deny

rustup target add wasm32-unknown-unknown --toolchain stable
rustup target add wasm32-unknown-unknown --toolchain nightly

sudo apt install shellcheck # On Debian
brew install shellcheck # MacOS
pacman -S shellcheck # Arch Linux
sudo yum -y install epel-release && sudo yum -y install ShellCheck # EPEL based distros
# For more options, visit: https://github.com/koalaman/shellcheck?tab=readme-ov-file#installing

# Install solc 0.8.25, if not installed already
[[ $(solc --version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,3\}[0-9][^.]\).*/\1/p') != '0.8.25' ]] && svm install 0.8.25 && svm use 0.8.25

Build

$ cargo build -p rosetta-client

Lint

$ cargo +nightly fmt --all -- --check
$ cargo clippy --locked --workspace --examples --tests --all-features -- \
  -Dwarnings \
  -Dclippy::unwrap_used \
  -Dclippy::expect_used \
  -Dclippy::nursery \
  -Dclippy::pedantic \
  -Aclippy::module_name_repetitions
$ dprint check
$ cargo deny check

Run unit tests

$ cargo test --workspace --all-features \
  --exclude rosetta-testing-arbitrum \
  --exclude rosetta-server-astar \
  --exclude rosetta-server-ethereum \
  --exclude rosetta-server-polkadot \
  --exclude rosetta-client

Run integration tests

# Pull docker images
./scripts/pull_nodes.sh

# Run tests
$ cargo test \
  -p rosetta-server-astar \
  -p rosetta-server-ethereum \
  -p rosetta-server-polkadot \
  -p rosetta-client

Run arbitrum integration tests

# Setup arbitrum local testnet
git clone -b release --depth=1 --no-tags --recurse-submodules https://github.com/ManojJiSharma/nitro-testnode.git
cd nitro-testnode
./test-node.bash --detach
cd ..

# Run tests
cargo test --locked -p rosetta-testing-arbitrum

Contributing

You can contribute to this repo in a number of ways, including:

Dependencies

~11MB
~222K SLoC