Giter Site home page Giter Site logo

networks's Introduction

Run Celestia Devnet

Pre-Requisites

Installed Celestia App and Celestia Node

If you haven't installed either of app/node, please navigate to each of them

Fork/Clone networks repo

git clone https://github.com/<your_github>/networks.git

Running a Celestia App

Legend:

- Facilitator (F) - orchestrates genesis setup

- Others (O) - other participants

Phase 0: Environment ideas/hints

The following instructions assume that you are using Digital Ocean as a cloud provider. Though it should be straightforward to use another provider or even deploy on a local bare-metal server instead. Tested setups:

  1. One Digital Ocean Droplet on Ubuntu(1 CPU and 1Gb should be enough) and your local Linux-based(Ubuntu prefferably) OS
  2. Two Digital Ocean Droplets on Ubuntu(1 CPU and 1 Gb should be enough)
  3. Remember to update your firewall settings. You can check and execute .networks/scripts/firewall_ubuntu.sh script

Please don't try to build celestia app on macOS Big Sur and higher due to this issue #134

Phase 1: Creating accounts and initializing celestia app chain

(O) steps:

  1. Creates an account using a script in networks repository
cd networks/scripts
node_name="MightyValidator"
./1_create_key.sh $node_name
  1. After execution of the script, (O) passes account's address to (F)

(F) Steps:

  1. Initializes the celestia app chain using a script in networks repository
cd networks/scripts
./creator.sh
  1. Adds (O)'s account address using command
celestia-appd add-genesis-account $O_acc_addr 800000000000celes

Note: Currently, we've found an issue that genesis.json is using stake instead of celes token #158 Please, either manually change stake to celes in genesis.json or execute this script:

sudo apt-get install moreutils #contains sponge that we need
cd networks/scripts
./fix_genesis.json
  1. Send the genesis.json to (O). Location of genesis.json file can be find by these default path:
cd ~/.celestia-app/config/genesis.json

Phase 2: GenTx

(O) steps:

  1. Copies genesis.json from (F) to local .celestia-app/config/ directory:
cp <path_to_downloaded_genesis.json>/genesis.json  ~/.celestia-app/config/
  1. Executes gentx command in CLI:
celestia-appd gentx $node_name 5000000000celes --keyring-backend=test --chain-id devnet-2
  1. Passes gentx-<hash>.json file to (F). Location of the file can be find in this default path:
cd .celestia-app/config/gentx/ && ls

(F) Steps:

  1. Copies gentx-<hash>.json from (O) to local .celestia-app/config/gentx directory
  2. Executes command in CLI:
celestia-appd collect-gentxs
  1. Send the updated version of genesis.json to (O)

Phase 3: Launch

(O) steps:

  1. Copies updated genesis.json from (F) to local .celestia-app/config/ directory:
cp <path_to_downloaded_genesis.json>/genesis.json  ~/.celestia-app/config/

Everybody:

celestia-appd start

Verifying Celestia App Network

To check that all validators are communicating with each other correctly, please look for a same block height for each of a running validator (let’s say block height = 100)

To confirm that everything is ok, you have to check that commit hashes for same block height are the same for all validators.

Phase X: Be a Validator in the running devnet-2 network:

  1. Creates an account using a script in networks repository
cd networks/scripts
node_name="chani"
./1_create_key.sh $node_name
  1. Asks any running validator to add funds to the account's address (ideally this should be changed with the upcoming faucet) in Discord Developer Channel
  2. Executes command in CLI:
celestia-appd init <moniker_name> --chain-id devnet-2

Example:

celestia-appd init fremen --chain-id devnet-2
  1. Copies genesis.json from networks/devnet-2 repo to local .celestia-app/config/ directory:
cp networks/devnet-2/genesis.json  ~/.celestia-app/config/
  1. Starts syncing the chain using command in CLI:
celestia-appd start --p2p.seeds [email protected]:26656

Syncing finishes around 1-2 hours

  1. Executes command in CLI:
celestia-appd tx staking create-validator \
 --amount=1000000000celes \
 --pubkey=$(celestia-appd tendermint show-validator) \
 --moniker=space \
 --chain-id=devnet-2 \
 --commission-rate=0.1 \
 --commission-max-rate=0.2 \
 --commission-max-change-rate=0.01 \
 --min-self-delegation=1000000000 \
 --from=$node_name \
 --keyring-backend=test

Running a Celestia Node

Pre-Requisites

You need to have the trusted hash in order to initialize the full celestia node In order to know the hash, you need to query the celestia-app:

curl -s http://localhost:26657/block?height=1 | grep -A1 block_id | grep hash

Full Node Configuration

  1. Initialize the full node
celestia full init --core.remote <ip:port of celestia-app> --headers.trusted-hash <hash_from_celestia_app>

Example:

celestia full init --core.remote tcp://127.0.0.1:26657 --headers.trusted-hash 3BDFBD7E2D97215CFA600DD8B39AAEECC015E43FEE7B8A4D8A8B630E8B4D4006
  1. Edit configurations

If you have multiple celestia full nodes, then you need to add them as mutual peers in the config.toml file and allow the peer exchange. This is needed in order for celestia full nodes communication between each other.

nano ~/.celestia-full/config.toml
...
[P2P]
  ...
  MutualPeers = ["/ip4/<ip>/tcp/2121/p2p/<pubKey>"] #add multiaddresses of other celestia full nodes
  PeerExchange = true #change this line to true. Be default it's false
  ...
...
  1. Start the full node
celestia full start

Now, the celestia full node will start syncing headers and storing blocks from celestia app.

Note: At startup, we can see the multiaddress from celestia full node. This is needed for future light client connections and communication between celestia full nodes

Example:

/ip4/46.101.245.50/tcp/2122/p2p/12D3KooWKNBZvF93L92aTYs6jRyozicGmuu3cF9gotMtUCeHAPYN

Light Client Configuration

To start the light client, we need to know 2 variables:

  • Trusted peer’s multi address to connect to (a celestia full node is the case here)
  • Trusted block hash from celestia-app
  1. Initialize the light client
celestia full init --headers.trusted-peer <full_node_multiaddress> --headers.trusted-hash <hash_from_celestia_app>

Example:

celestia light init --headers.trusted-peer /ip4/46.101.245.50/tcp/2122/p2p12D3KooWKNBZvF93L92aTYs6jRyozicGmuu3cF9gotMtUCeHAPYN --headers.genesis-hash F10679041E3D55363405C1D3080B91004BCAE471F35F1FBABC345B8237AEFDA2 
  1. Start the light client
celestia light start

Now, the celestia light client will start syncing headers and do data availability sampling(DAS) from the full node.

Data Availability Sampling(DAS)

Pre-Requisites:

This is a list of runnining components you need in order to successfully continue this chapter:

  • celestia app validator
  • celestia full node
  • celestia light client

Legend:

You will need 2 terminals in order to see how DASing works:

- First terminal(FT) run light client with logs info

- Second terminal(ST) submit payForMessage tx

Steps:

  1. In (ST) Submit a payForMessage transaction with celestia-appd
celestia-appd tx payment payForMessage <hex_namespace> <hex_message> --from <node_name> --keyring-backend <keyring-name> --chain-id <chain_name> -y

Example:

celestia-appd tx payment payForMessage 0102030405060708 68656c6c6f43656c6573746961444153 --from eva00 --keyring-backend test --chain-id devnet-2 -y
  1. In (FT) you should see in logs how DAS is working

Example:

INFO	das	das/daser.go:96	sampling successful	{"height": 81547, "hash": "DE0B0EB63193FC34225BD55CCD3841C701BE841F29523C428CE3685F72246D94", "square width": 2, "finished (s)": 0.000117466}

networks's People

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.