Code Monkey home page Code Monkey logo

cardano-rosetta's Introduction

Cardano Rosetta

CI Nightly

An implementation of Rosetta for Cardano, targeting the version defined in the OpenApi schema. Skip to run if wishing to use a pre-built image from the Docker Hub repository.

Build

Build from anywhere, optionally specifying a network name other than mainnet as a build argument, and accessing cached build layers to reduce the initialization time. You can also build with local source by replacing the GitHub link with .

mainnet
DOCKER_BUILDKIT=1 \
docker build \
  --build-arg BUILDKIT_INLINE_CACHE=1 \
  --cache-from=inputoutput/cardano-rosetta:master \
  -t inputoutput/cardano-rosetta:1.8.1 \
  https://github.com/input-output-hk/cardano-rosetta.git#1.8.1
preprod
DOCKER_BUILDKIT=1 \
docker build \
  --build-arg BUILDKIT_INLINE_CACHE=1 \
  --build-arg NETWORK=preprod \
  --cache-from=inputoutput/cardano-rosetta:master \
  -t inputoutput/cardano-rosetta:1.8.1-preprod \
  https://github.com/input-output-hk/cardano-rosetta.git#1.8.1
preview
DOCKER_BUILDKIT=1 \
docker build \
  --build-arg BUILDKIT_INLINE_CACHE=1 \
  --build-arg NETWORK=preview \
  --cache-from=inputoutput/cardano-rosetta:master \
  -t inputoutput/cardano-rosetta:1.8.1-preview \
  https://github.com/input-output-hk/cardano-rosetta.git#1.8.1

Run

Run the locally or pre-built images and mount a single volume into the standard storage location, map the server port to the host, and allocate a suitably-sized /dev/shm. See the complete Docker run reference for full control.

mainnet
docker run \
  --name cardano-rosetta \
  -p 8080:8080 \
  -v cardano-rosetta:/data \
  --shm-size=2g \
  inputoutput/cardano-rosetta:1.8.1
preprod
docker run \
  --name cardano-rosetta-preprod \
  -p 8081:8080 \
  -v cardano-rosetta-preprod:/data \
  --shm-size=2g \
  inputoutput/cardano-rosetta:1.8.1-preprod
preview
docker run \
  --name cardano-rosetta-preview \
  -p 8081:8080 \
  -v cardano-rosetta-preview:/data \
  --shm-size=2g \
  inputoutput/cardano-rosetta:1.8.1-preview

ℹ️ A trusted DB snapshot can be used to speed up the initial sync, however the internal instance of cardano-node must be synced past the snapshot point for it to be applied. This can be achieved by observing logs emitted from cardano-node indicating it's close to the network tip, before then following the instructions in the Upgrading section.

Configuration

Set ENVs for optional runtime configuration

-e MODE=offline

MODE

See Rosetta docs for information on modes

  • online - default
  • offline

DEFAULT_RELATIVE_TTL

Specify the TTL without needing to access an online method. Default: 1000

LOGGER_MIN_SEVERITY

  • trace
  • debug
  • info - default
  • warn
  • error
  • fatal

PAGE_SIZE

Default: 25

Upgrading

As per the release notes, you may be required to refresh the state managed by cardano-db-sync. This can be achieved without requiring a network re-sync using one of the two following approached:

1. Apply a Trusted cardano-db-sync Snapshot

Run the build command with the addition of an argument providing a version and network-specific link, sourced from the cardano-db-sync release notes. For example:

Build
mainnet
DOCKER_BUILDKIT=1 \
docker build \
  --build-arg BUILDKIT_INLINE_CACHE=1 \
  --build-arg SNAPSHOT_URL=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13/db-sync-snapshot-schema-13-block-7960123-x86_64.tgz \
  --cache-from=inputoutput/cardano-rosetta:master \
  -t inputoutput/cardano-rosetta:1.8.1-apply-snapshot \
  https://github.com/input-output-hk/cardano-rosetta.git#1.8.1
Run
mainnet
docker run \
  --name cardano-rosetta \
  -p 8080:8080 \
  -v cardano-rosetta:/data \
  --shm-size=2g \
  inputoutput/cardano-rosetta:1.8.1-apply-snapshot

ℹ️ Build a new image as per the standard build instructions if you need to recreate the container, otherwise the data will be dropped and restored again.

ℹ️ The snapshot will only be applied if cardano-node is synced past the snapshot point, since the benefit of using it would be eliminated given cardano-db-sync rolls back to genesis under these conditions. For best results, ensure the node is close to the network tip prior to upgrading.

2. Re-sync From Genesis

A trustless approach to rebuild the DB, by syncing from genesis at the cost of an extended sync duration:

docker stop cardano-rosetta && \
docker rm cardano-rosetta && \
docker run --rm -v cardano-rosetta:/data ubuntu rm -rf /data/postgresql /data/db-sync

... then start a container as per usual. Sync progress will be logged by the new container.

Documentation

Link Audience
Construction API Documentation Users of the Cardano Rosetta Construction API
Data API Documentation Users of the Cardano Rosetta Data API
Cardano Rosetta Docs Cardano Rosetta specific documentation
Developer Core or external developers of cardano-rosetta-server
Maintainer Solution maintainer
QA Quality Assurance Engineers

cardano-rosetta's People

Contributors

abarretoatix avatar alanverbner avatar catch-21 avatar craigem avatar dependabot[bot] avatar dermetfan avatar disassembler avatar guido-ta avatar iadmytro avatar issoupadrink avatar johnalotoski avatar jvieiro avatar lgobbi-atix avatar mmortaraatix avatar piotr-iohk avatar rhyslbw avatar t-dallas avatar toaspzoo avatar tomasbustamante avatar trueblueaddie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.