GithubHelp home page GithubHelp logo

fl0rek / celestia-node-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eigerco/lumina

0.0 1.0 0.0 1.85 MB

Celestia light node implementation in Rust WASM

License: Apache License 2.0

Shell 1.50% Rust 97.60% HTML 0.33% JavaScript 0.56%

celestia-node-rs's Introduction

Lumina

Rust implementation of Celestia's data availability node able to run natively and in browser-based environments.

Run Lumina now at lumina.rs and directly verify Celestia.

Supported features:

  • Backward and forward synchronization of block headers within syncing window
  • Header exchange (header-ex) client and server
  • Listening for, verifying and redistributing extended headers on gossip protocol (header-sub)
  • Listening for, verifying and redistributing fraud proofs on gossip protocol (fraud-sub)
  • Backward and forward Data Availability Sampling
  • Native and browser persistent storage
  • Streaming events happening on the node
  • Native and wasm library, embed the node anywhere
  • Integration tests with Go implementation

Note

Lumina implements shwap protocol to perform DASing, which is not yet enabled on all networks in the Go implementation. This means that even though Lumina will be sampling all blocks, the network is unlikely to provide the requested data yet. Shwap is going to become the main DASing protocol in the upcoming celestia-node versions.

Installing the node

Installing with cargo

Install the node. Note that currently to serve lumina to run it from the browser, you need to compile lumina-cli manually.

cargo install lumina-cli --locked

Run the node

lumina node --network mocha

Building from source

Install common dependencies

# install dependencies
sudo apt-get install -y build-essential curl git protobuf-compiler

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# open a new terminal or run
source "$HOME/.cargo/env"

# clone the repository
git clone https://github.com/eigerco/lumina
cd lumina

# install lumina
cargo install --path cli

Building wasm-node

To build lumina-cli with support for serving wasm-node to browsers, currently you need to compile wasm node manually. Follow these additional steps:

# install wasm-pack
cargo install wasm-pack

# compile lumina to wasm
wasm-pack build --target web node-wasm

# install lumina-cli
cargo install --path cli --features browser-node

Running the node

Running the node natively

# run lumina node
lumina node --network mocha

# check out help for more configuration options
lumina node --help

Building and serving node-wasm

# serve lumina node on default localhost:9876
lumina browser

# check out help from more configuration options
lumina browser --help

WebTransport and Secure Contexts

For security reasons, browsers only allow WebTransport to be used in Secure Context. When running Lumina in a browser make sure to access it either locally or over HTTPS.

Running Go Celestia node for integration

Follow this guide to authorize yourself in github's container registry.

Starting a Celestia network with single validator and bridge

docker compose -f ci/docker-compose.yml up --build --force-recreate -d
# and to stop it
docker compose -f ci/docker-compose.yml down

Note: You can run more bridge nodes by uncommenting/copying the bridge service definition in ci/docker-compose.yml.

To get a JWT token for a topped up account (coins will be transferred in block 2):

export CELESTIA_NODE_AUTH_TOKEN=$(docker compose -f ci/docker-compose.yml exec bridge-0 celestia bridge auth admin --p2p.network private)

Accessing json RPC api with Go celestia cli:

docker compose -f ci/docker-compose.yml exec bridge-0 \
    celestia blob submit 0x0c204d39600fddd3 '"Hello world"' --token "$CELESTIA_NODE_AUTH_TOKEN"

Extracting blocks for test cases:

docker compose -f ci/docker-compose.yml exec bridge-0 \
    celestia header get-by-height 27 --token "$CELESTIA_NODE_AUTH_TOKEN" | jq .result

Running integration tests with Celestia node

Make sure you have the Celestia network running inside docker compose from the section above.

Generate authentication tokens

./tools/gen_auth_tokens.sh

Run tests

cargo test

Upgrading dependencies

Some of our users use celestia-types with risc0 zkVM, which applies some acceleration on dependencies related to cryptography. Such dependency is sha2.

Because of that we created ./tools/upgrade-deps.sh script which upgrades all dependencies in Cargo.toml except the ones that are patched by risc0.

How to upgrade:

./tools/upgrade-deps.sh -i  # `-i` upgrades incompatible versions too
cargo update

Frontend

Check out the front end at eigerco/lumina-front

About Eiger

We are engineers. We contribute to various ecosystems by building low level implementations and core components. We built Lumina because we believe in the modular thesis. We wanted to make the Celestia light node available and easy to run for as many users so that everyone can perform sampling to ensure data availability.

Contact us at [email protected]

celestia-node-rs's People

Contributors

oblique avatar zvolin avatar fl0rek avatar dependabot[bot] avatar darentuzi avatar denis2glez avatar preston-evans98 avatar distractedm1nd avatar sergey-melnychuk avatar bowenyou avatar s1nus avatar codeesura avatar evalir 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.