linera-io / linera-protocol

Main repository for the Linera protocol
Apache License 2.0
439 stars 126 forks source link
blockchain rust wasm

License Build Status for Rust Build Status for Documentation Build Status for DynamoDB

Linera is a decentralized blockchain infrastructure designed for highly scalable, low-latency Web3 applications.

Visit our developer page and read our whitepaper to learn more about the Linera protocol.

Repository Structure

The main crates and directories of this repository can be summarized as follows: (listed from low to high levels in the dependency graph)

Quickstart with the Linera service CLI

The following commands set up a local test network and run some transfers between the microchains owned by a single wallet.

# Make sure to compile the Linera binaries and add them in the $PATH.
# cargo build -p linera-service --bins
export PATH="$PWD/target/debug:$PATH"

# Import the optional helper function `linera_spawn_and_read_wallet_variables`.
source /dev/stdin <<<"$(linera net helper 2>/dev/null)"

# Run a local test network with the default parameters and a number of microchains
# owned by the default wallet. (The helper function `linera_spawn_and_read_wallet_variables`
# is used to set the two environment variables LINERA_{WALLET,STORAGE}.)
linera_spawn_and_read_wallet_variables \
linera net up

# Print the set of validators.
linera query-validators

# Query the chain balance of some of the chains.
CHAIN1="e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65"
CHAIN2="256e1dbc00482ddd619c293cc0df94d366afe7980022bb22d99e33036fd465dd"
linera query-balance "$CHAIN1"
linera query-balance "$CHAIN2"

# Transfer 10 units then 5 back
linera transfer 10 --from "$CHAIN1" --to "$CHAIN2"
linera transfer 5 --from "$CHAIN2" --to "$CHAIN1"

# Query balances again
linera query-balance "$CHAIN1"
linera query-balance "$CHAIN2"

More complex examples may be found in our developer manual as well as the example applications in this repository.