Skip to content

Latest commit

 

History

History
298 lines (221 loc) · 6.9 KB

README.md

File metadata and controls

298 lines (221 loc) · 6.9 KB

Asteroid Local Setup

Links

Accounts

Cosmos Hub Address Neutron Address Mnemonic
cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2 banner spread envelope side kite person disagree path silver will brother under couch edit food venture squirrel civil budget number acquire point work mass
cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf veteran try aware erosion drink dance decade comic dawn museum release episode original list ability owner size tuition surface ceiling depth seminar capable only
cosmos14xcrdjwwxtf9zr7dvaa97wy056se6r5e8q68mw neutron14xcrdjwwxtf9zr7dvaa97wy056se6r5erln9pf obscure canal because tomorrow tribe sibling describe satoshi kiwi upgrade bless empty math trend erosion oblige donate label birth chronic hazard ensure wreck shine

Add mnemonic Cosmos Hub

echo "banner spread envelope side kite person disagree path silver will brother under couch edit food venture squirrel civil budget number acquire point work mass" | gaiad keys add test --recover

check balances

gaiad query bank balances "$(gaiad keys show test -a)" --node tcp://0.0.0.0:16657

Add mnemonic Neutron

echo "banner spread envelope side kite person disagree path silver will brother under couch edit food venture squirrel civil budget number acquire point work mass" | neutrond keys add test --recover

check balances

neutrond query bank balances "$(neutrond keys show test -a)" --node tcp://0.0.0.0:26657

Prerequisites

General

Frontend (if you want to run frontend)

Relayer (if you want to run relayer)

Setup Cosmos Hub

  1. Clone repo

    git clone --depth 1 --branch v15.1.0 https://github.com/cosmos/gaia
  2. Install gaiad

    cd gaia && make install

Setup DB & API and init Cosmos Hub

  1. Clone repo

    git clone https://github.com/astroport-fi/asteroid-local
  2. Init Cosmos Hub

    ./network/init-and-start-gaia.sh

    once initialized run

    ./network/start-gaia.sh
  3. Create a docker network

    docker network create external-example
  4. Run services with Docker

    docker compose up

Setup Asteroid

Clone repo

git clone https://github.com/astroport-fi/asteroid-protocol

Setup Indexer

  1. cd indexer

  2. Create .env file

    cp .env.template .env
  3. Install Atlas migration tool CLI

    curl -sSf https://atlasgo.sh | sh
    
  4. Run migrations

    atlas migrate apply --env local
  5. Open DB Explorer and create all views from https://github.com/astroport-fi/asteroid-protocol/blob/main/indexer/schema.sql#L373

  6. Open DB Explorer and create status row for local Cosmos hub

    INSERT INTO "status" ("id", "chain_id", "last_processed_height", "base_token", "base_token_usd", "date_updated", "last_known_height") VALUES
    (1,	'gaialocal-1',	1,	'ATOM',	9.419,	NOW(), 1);
  7. Run indexer

    make run
    

Load Hasura API configuration

  1. Install Hasura CLI first

  2. Apply Hasura Metadata

    hasura metadata apply

Setup Frontend

cd app
npm install
npm run dev

Add Local Cosmos Hub to Keplr or Leap

Use window.leap in Leap case

await window.keplr.experimentalSuggestChain({
    chainId: "gaialocal-1",
    chainName: "Local Cosmos Hub",
    rpc: "http://localhost:16657",
    rest: "http://localhost:1316",
    bip44: {
        coinType: 118,
    },
    bech32Config: {
        bech32PrefixAccAddr: "cosmos",
        bech32PrefixAccPub: "cosmos" + "pub",
        bech32PrefixValAddr: "cosmos" + "valoper",
        bech32PrefixValPub: "cosmos" + "valoperpub",
        bech32PrefixConsAddr: "cosmos" + "valcons",
        bech32PrefixConsPub: "cosmos" + "valconspub",
    },
    currencies: [ 
        {
            coinDenom: 'ATOM',
            coinMinimalDenom: 'uatom',
            coinDecimals: 6
        },
    ],
    feeCurrencies: [
        {
            coinDenom: 'ATOM',
            coinMinimalDenom: 'uatom',
            coinDecimals: 6,
            gasPriceStep: { low: 0.1, average: 0.2, high: 0.3 }
        }
    ],
    stakeCurrency: {
        coinDenom: 'ATOM',
        coinMinimalDenom: 'uatom',
        coinDecimals: 6
    },
    features: ['ibc-transfer']
});

For Neutron

await window.keplr.experimentalSuggestChain({
    chainId: "test-1",
    chainName: "Local Neutron",
    rpc: "http://localhost:26657",
    rest: "http://localhost:1317",
    bip44: {
        coinType: 118,
    },
    bech32Config: {
        bech32PrefixAccAddr: "neutron",
        bech32PrefixAccPub: "neutron" + "pub",
        bech32PrefixValAddr: "neutron" + "valoper",
        bech32PrefixValPub: "neutron" + "valoperpub",
        bech32PrefixConsAddr: "neutron" + "valcons",
        bech32PrefixConsPub: "neutron" + "valconspub",
    },
    currencies: [
        {
            coinDenom: 'NTRN',
            coinMinimalDenom: 'untrn',
            coinDecimals: 6
        },
    ],
    feeCurrencies: [
        {
            coinDenom: 'NTRN',
            coinMinimalDenom: 'untrn',
            coinDecimals: 6,
            gasPriceStep: { low: 0.1, average: 0.2, high: 0.3 }
        }
    ],
    stakeCurrency: {
        coinDenom: 'NTRN',
        coinMinimalDenom: 'untrn',
        coinDecimals: 6
    },
    features: ['ibc-transfer', 'cosmwasm']
});

Appendix

Setup Neutron

  1. Clone repo

    git clone --depth 1 --branch v2.0.0 https://github.com/neutron-org/neutron
  2. Install neutrond

    cd neutron && make install
  3. Init Neutron

    ./network/init-and-start-neutron.sh

    once initialized run

    ./network/start-neutron.sh

Setup Relayer

  1. Install Hermes

    cargo install ibc-relayer-cli --bin hermes --version 1.6.0 --locked
    
  2. Run relayer

    ./network/hermes/start.sh

Additional Resources