Git Product home page Git Product logo

cosmos-rosetta-gateway's Introduction

PkgGoDev codecov license LoC

Cosmos Rosetta API Gateway (crg)

Cosmos Rosetta Gateway is a Rosetta API adapter for Cosmos SDK Chains running Cosmos-SDK 0.39 "Launchpad" releases.

Support for Cosmos-SDK 0.37 and Cosmos-SDK 0.40 "Stargate" releases is coming soon.

This repository contains both a library and a standalone binary, named crg. Documentation on how to use the library is coming soon.

Using crg

The standalone executable will talk to your blockchain's API and serve as an API adapter, making it compatible with the Coinbase Rosetta blockchain API interface.

Configuring crg crg can be configured to match your chain using flags

Task Flag Description
Help --help explain these flags
Port -port 8080 the port where the service is listening
App RPC Endpoint --app-rpc localhost:1317
Tendermint RPC Endpoint --tendermint-rpc localhost:2665
Application Name --blockchain gaia example: "Bitcoin
Network ID --network mainnet-1 In cosmos, usually the chain's version, like gaia hub 3
Offline Mode --offline true this allows crg to run even when there's no chain for it to connect to
Prefix --prefix cosmos bech32 prefix for addresses on your blockchain

Quick Test:

This test assumes that you've got a running blockchain that uses Cosmos-SDK 0.39.x, and that you have Go installed on your computer.

Install and use crg

screen -S crg
git clone https://github.com/tendermint/cosmos-rosetta-gateway
cd cosmos-rosetta-gateway
make dev

Hold ctrl and press A, then D. You'll leave the screen session and crg will run in the background.

crg runs an http server on port 8080, and here are some query examples using curl:

Check Network Status

curl --location --request POST 'http://localhost:8080/network/status' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "network_identifier": {
        "blockchain": "Test",
        "network": "Test"
    }
}'

Success looks like:

{
  "current_block_identifier": {
    "index": 46564,
    "hash": "2F4A700C064C0E66792DB80387035401421A985B1E4E10419E85F24E815E9D86"
  },
  "current_block_timestamp": 1601050588601,
  "genesis_block_identifier": {
    "index": 1,
    "hash": "8FC19EA07352344DA72C1CB141C945A8FC6C9349FD5244DB6B9C891C17747E12"
  },
  "peers": null
}

Get Info on a particular block:

curl --location --request POST 'http://localhost:8080/block' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "network_identifier": {
        "blockchain": "Test",
        "network": "Test"
    },
    "block_identifier": {
        "index": 17807
    }
}'

Success looks like:

{
  "block": {
    "block_identifier": {
      "index": 17807,
      "hash": "8C78CBFA84AFC57E20E379B1135C7EE6A14CE115291C8241750505D4FFDDA261"
    },
    "parent_block_identifier": {
      "index": 17806,
      "hash": "C0D4B2ED7B3DFEC3BF9673E132E6C32AA6AB3E1D566FB09AEA4292DA5FFDC349"
    },
    "timestamp": 1600905197777,
    "transactions": null
  }
}

Additional requests are documented in the cosmos-rosetta-gateway Postman Collecton.

Postman Collection

Postman is a popular tool for working with and designing API systems. We've made a postman collection that contains a number common calls to both the data and construction APIs.

cosmos-rosetta-gateway's People

Contributors

alessio avatar faddat avatar ilgooz avatar jgimeno avatar sahith-narahari avatar

Watchers

 avatar  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.