Skip to content

adonagy/tezedge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TezEdge Docs Status Changelog release-badge docker-badge MIT licensed


The purpose of this project is to implement a secure, trustworthy and open-source Tezos node in Rust.

In addition to implementing a new node, the project seeks to maintain and improve the Tezos ecosystem wherever possible.

Table of Contents

Build status


CI / branch master develop
GitHub Actions Build Status master Build Status develop
Drone Drone Status master Drone Status develop

Quick demo


This demo launches two items:

  • The TezEdge node (p2p application), which connects to the Tezos Mainnet network.
  • The TezEdge explorer (web application), which connects to the TezEdge node and can be accessed from a browser to see what is going on inside the TezEdge node

Prerequisites

If you want to run this demo, you need to first install the following:

  • Git (client)
  • Docker

Run demo

  1. Download the TezEdge source code
    # Open shell and type this code into the command line and then press Enter:
    git clone https://github.com/tezedge/tezedge
    cd tezedge
    
  2. Run docker (compose)
    # Open shell and type this code into the command line and then press Enter:
    docker-compose pull
    docker-compose up
    
    alt text
  3. Open your web browser by entering this address into your browser's URL bar: http://localhost:8080 alt text

Docker for Windows

The images use the hostname localhost to access running services. When using docker for windows, please check:

docker-machine ip

and make sure that port forwarding is set up correctly for docker or use docker-machine resolved ip instead of http://localhost:8080

TCP ports (<host_port>:<docker_port>):
    - "80:80"
    - "4927:4927"
    - "18732:18732"
    - "19732:9732"

Documentation


Detailed project's documentation can be found here Documentation

How to build


Supported OS distributions

We are linking Rust code with a pre-compiled Tezos shared library. For your convenience, we have created pre-compiled binary files for most of the more popular Linux distributions:

OS Versions
Ubuntu 16.04, 18.04, 18.10, 19.04, 19.10, 20.04, 20.10
Debian 9, 10
OpenSUSE 15.1, 15.2
CentOS 8
MacOS experimental - newer or equal to 10.13 should work

If you are missing support for your favorite Linux distribution, please submit a request with the tezos-opam-builder project.

Prerequisites installation

If you want to build from source code, you need to install this before:

  1. Install Git (client)
  2. Install Rust command (We recommend installing Rust through rustup.)
    # Run the following in your terminal, then follow the onscreen instructions.
    curl https://sh.rustup.rs -sSf | sh
    
  3. Install Rust toolchain (Rust nightly is required to build this project.)
    rustup toolchain install nightly-2020-12-31
    rustup default nightly-2020-12-31
    
  4. Install required OS libs
    • OpenSSL
    sudo apt install openssl libssl-dev
    
    • Sodiumoxide package:
    sudo apt install pkg-config libsodium-dev
    
    • RocksDB package:
    sudo apt install clang libclang-dev llvm llvm-dev linux-kernel-headers libev-dev
    
    brew install pkg-config gmp libev libsodium hidapi
    
    • Sandbox/wallet requirements:
    sudo apt install libhidapi-dev
    

Build from source code

  1. Download TezEdge source code

    # Open shell, type this code into the command line and then press Enter:
    git clone https://github.com/tezedge/tezedge
    cd tezedge
    
  2. Build

    SODIUM_USE_PKG_CONFIG=1 cargo build --release
    

    or

    export SODIUM_USE_PKG_CONFIG=1
    cargo build --release
    

    The node can built through the cargo build or cargo build --release, be aware, release build can take much longer to compile.

  3. Test

    SODIUM_USE_PKG_CONFIG=1 cargo test --release
    

    or

    export SODIUM_USE_PKG_CONFIG=1
    cargo test --release
    

How to run


Running node with cargo run

To run the node manually, you need to first build it from the source code. The path to the Tezos lib must be provided as an environment variable LD_LIBRARY_PATH. It is required by the protocol-runner. When put together, the node can be run, for example, like this:

cargo build --release
LD_LIBRARY_PATH=./tezos/sys/lib_tezos/artifacts cargo run --release --bin light-node -- --config-file ./light_node/etc/tezedge/tezedge.config --protocol-runner=./target/release/protocol-runner --network=mainnet

All parameters can also be provided as command line arguments in the same format as in the config file, in which case they have a higher priority than the ones in the config file. For example, we can use the default config and change the log file path:

cargo build --release
LD_LIBRARY_PATH=./tezos/sys/lib_tezos/artifacts cargo run --release --bin light-node -- --config-file ./light_node/etc/tezedge/tezedge.config --log-file /tmp/logs/tezdge.log --protocol-runner=./target/release/protocol-runner --network=mainnet

Full description of all arguments is in the light_node README file.

Running node with run.sh script

For Linux systems, we have prepared a convenience script to run the node. It will automatically set all the necessary environmnent variables and then build and run the TezEdge node. All arguments can be provided to the run.sh script in the same manner as described in the previous section.

To run the node in release mode, execute the following:

KEEP_DATA - this flag controls, if all the target directories should be cleaned on the startup, 1 means do not clean

KEEP_DATA=1 ./run.sh release --network=mainnet

The following command will execute the node in debug node:

KEEP_DATA=1 ./run.sh node --network=mainnet

To run the node in debug mode with an address sanitizer, execute the following:

KEEP_DATA=1 ./run.sh node-saddr --network=mainnet

You can use the docker version to build and run node from the actual source code.

  • you can experiment and change source code without installing all requirements, just docker.
  • you can build/run node on Windows/OSX
  • this is just for development, because docker is based on full Linux (pre-build docker images are Distroless)

If you do not need to build from souce code, just use our pre-build docker images

./run.sh docker --network=mainnet

Listening for updates. Node emits statistics on the websocket server, which can be changed by --websocket-address argument, for example:

KEEP_DATA=1  ./run.sh node --network=mainnet --websocket-address 0.0.0.0:12345

Full description of all arguments is in the light_node README file.

Running node from binaries

Note: This cmd runs from the main git sources directory

LD_LIBRARY_PATH=./tezos/sys/lib_tezos/artifacts ./target/release/light-node \
    --network "mainnet" \
    --identity-file "/tmp/data-dir-mainnet/identity.json" \
    --identity-expected-pow 26.0 \
    --tezos-data-dir "/tmp/data-dir-mainnet/context_data" \
    --bootstrap-db-path "/tmp/data-dir-mainnet/tezedge_data" \
    --peer-thresh-low 30 --peer-thresh-high 45 \
    --protocol-runner "./target/release/protocol-runner" \
    --init-sapling-spend-params-file "./tezos/sys/lib_tezos/artifacts/sapling-spend.params" \
    --init-sapling-output-params-file "./tezos/sys/lib_tezos/artifacts/sapling-output.params" \
    --p2p-port 9732 --rpc-port 18732 \
    --tokio-threads 0 \
    --ocaml-log-enabled false \
    --tezos-context-storage=irmin \
    --log terminal \
    --log file \
    --log-level info \
    --log-format simple

Running node from docker images

We provide automatically built images that can be downloaded from our Docker hub. For instance, this can be useful when you want to run the TezEdge node in your test CI pipelines.

Images (distroless)

  • tezedge/tezedge:vX.Y.Z - last versioned stable released version
  • tezedge/tezedge:latest-release - last stable released version
  • tezedge/tezedge:latest - actual stable development version
  • tezedge/tezedge:sandbox-vX.Y.Z - last versioned stable released version for sandbox launcher
  • tezedge/tezedge:sandbox-latest-release - last stable released version for sandbox launcher
  • tezedge/tezedge:sandbox-latest - last stable released version for sandbox launcher

More about building TezEdge docker images see here.

Run image

docker run -i -p 9732:9732 -p 18732:18732 -p 4927:4927 -t tezedge/tezedge:v1.6.10 --network=mainnet --p2p-port 9732 --rpc-port 18732

A full description of all arguments can be found in the light_node README file.

Shutdown running node gracefully

Just press Ctrl-c, works for e.g. cargo run or run.sh script.

Or you can send a signal to a running process, the dedicated signal is SIGINT, e.g.:

kill -s SIGINT <PID-of-running-process-with-light-node>

How to use


Example of how to call the RPC

Open shell, type this code into the command line and then press Enter:

curl localhost:18732/chains/main/blocks/head

For a more detailed description of the RPCs, see the shell and the protocol endpoints.

Prearranged docker-compose files

Mainnet - light-node + tezedge explorer

Last released version:

docker-compose -f docker-compose.yml pull
docker-compose -f docker-compose.yml up

(optional) Environment configuration:

# (default: irmin) - choose context implementation, possible values: [irmin, tezedge, both]
TEZOS_CONTEXT_STORAGE=<possible-value>

# explorer accesses node/debugger on 'localhost' by default, you can change it like,
NODE_HOSTNAME_OR_IP=<hostname-or-ip>

e.g.:
TEZOS_CONTEXT_STORAGE=irmin NODE_HOSTNAME_OR_IP=123.123.123.123 docker-compose -f docker-compose.yml up

Mainnet - light-node + tezedge explorer + tezedge debugger

Last released version with TezEdge Debugger with integrated eBPF

This requires Linux kernel at least 5.11

docker-compose -f docker-compose.debug.yml pull
docker-compose -f docker-compose.debug.yml up

(optional) Environment configuration:

# (default: irmin) - choose context implementation, possible values: [irmin, tezedge, both]
TEZOS_CONTEXT_STORAGE=<possible-value>

# explorer accesses node/debugger on 'localhost' by default, you can change it like,
NODE_HOSTNAME_OR_IP=<hostname-or-ip>

e.g.:
TEZOS_CONTEXT_STORAGE=irmin NODE_HOSTNAME_OR_IP=123.123.123.123 docker-compose -f docker-compose.debug.yml up

Mainnet - light-node with irmin context + light-node with memory context + tezedge-explorer

This runs two explorers:

docker-compose -f docker-compose.storage.irmin.yml pull
docker-compose -f docker-compose.storage.irmin.yml up

docker-compose -f docker-compose.storage.memory.yml pull
docker-compose -f docker-compose.storage.memory.yml up

(optional) Environment configuration:

# explorer accesses node on 'localhost' by default, you can change it like,
NODE_HOSTNAME_OR_IP=<hostname-or-ip>

About

Tezos node/shell in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.0%
  • Python 1.2%
  • Other 0.8%