Skip to content

Instantly share code, notes, and snippets.

@rootulp
Last active May 4, 2023 21:44
Show Gist options
  • Select an option

  • Save rootulp/3e966bba69ef3d748cd9cb0c1c2f21eb to your computer and use it in GitHub Desktop.

Select an option

Save rootulp/3e966bba69ef3d748cd9cb0c1c2f21eb to your computer and use it in GitHub Desktop.
This document provides instructions on how to connect a local celestia-app instance to local celestia-node bridge node

Local celestia-node

This document provides instructions on how to connect a local celestia-app instance to local celestia-node bridge node.

celestia-app

  1. Delete previous binary

    rm $(which celestia-appd)
  2. Delete previous local devnets

    rm -rf ~/.celestia-app
  3. Build & run a celestia-app node

    ./scripts/build-run-single-node.sh
  4. You'll see a line in terminal output like

    Home directory: /var/folders/y0/dd92_x8x4tlf397xstgwfz_c0000gn/T/celestia_app_XXXXXXXXXXXXX.6VVjiaTm
    

    You can export it for easy use later:

    export CELESTIA_APP_HOME="/var/folders/y0/dd92_x8x4tlf397xstgwfz_c0000gn/T/celestia_app_XXXXXXXXXXXXX.6VVjiaTm"

celestia-node

WARNING: make go-install or make install inside the celestia-node repo doesn't always replace the celestia binary installed on your local machine. Before proceeding, verify that the version of celestia-node installed is the one you intend on testing.

  1. Delete previous binary

    rm $(which celestia)
  2. Delete previous local devnets

    rm -rf ~/.celestia-bridge-private
  3. Install a new celestia-node binary

    make go-install
    celestia version # verify the commit hash matches what you expect
  4. Initialize a bridge node

    celestia bridge init --p2p.network private
  5. In the celestia-appd terminal output, search for this log line and copy the hash after the =

    received complete proposal block hash=90B6E859046F98EB95D3FD0F846AC4FA5D47A675A59BE680F71741295453E316
    
  6. Paste the hash from the previous step to ~/.celestia-bridge-private/config.toml

    [Header]
    TrustedHash = "90B6E859046F98EB95D3FD0F846AC4FA5D47A675A59BE680F71741295453E316"
  7. Start bridge node.

    celestia bridge start --p2p.network private --core.ip 127.0.0.1 --gateway
  8. After you run the above command, copy the celestia node address that was printed to your console. It should look something like

    NAME: my_celes_key
    ADDRESS: celestia1mhewflflym3vyqml9kpvj4u2e39k5f2k3plfth
    

    You can export it for easy use later:

    export CELESTIA_NODE_ADDRESS=celestia1mhewflflym3vyqml9kpvj4u2e39k5f2k3plfth

Submit a PFB

via celestia-app

Inside the celestia-app directory

  1. Export validator address

    export CELESTIA_APP_ADDRESS=$(./build/celestia-appd keys show validator --keyring-backend test --address --home $CELESTIA_APP_HOME)
  2. Submit a test random blob

    ./build/celestia-appd tx blob TestRandBlob 100 --from $CELESTIA_APP_ADDRESS --fees 21000utia --yes --home $CELESTIA_APP_HOME

via celestia-node

  1. Send tokens from validator address to celestia-node address

    ./build/celestia-appd tx bank send --chain-id private --keyring-backend test --home $CELESTIA_APP_HOME --yes \
        $CELESTIA_APP_ADDRESS \
        $CELESTIA_NODE_ADDRESS \
        100000utia --fees 21000utia

    Wait until your celestia-app terminal logs a line that contains num_valid_txs=1 to ensure your transaction was included in a block

  2. Submit a PFB

     curl -X POST -d '{"namespace_id": "0c204d39600fddd3", "data": "f1f20ca8007e910a3bf8b2e61da0f26bca07ef78717a6ea54165f5", "gas_limit": 80000, "fee": 80000}' http://localhost:26659/submit_pfb

Query celestia-node endpoints

curl -X GET 'http://localhost:26659/namespaced_shares/0000000000000004/height/156'
curl -X GET 'http://localhost:26659/namespaced_data/0000000000000004/height/156'
@rootulp

rootulp commented Feb 13, 2023

Copy link
Copy Markdown
Author

Consider automating the manual copy + pasting of genesis hash with something like:

GENESIS_HASH=$(celestia-appd query block 1 | jq .block_id.hash | xargs)
CHAINID=dryrun2
export CELESTIA_CUSTOM=${CHAINID}:${GENESIS_HASH}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment