This repository is dedicated to developing the Linera protocol. For an overview of how the Linera protocol functions refer to the whitepaper.
The Linera protocol repository is broken down into the following crates and subdirectories: (from low-level to high-level in the dependency graph)
-
linera-base
Base definitions, including cryptography. -
linera-views
A library mapping complex data structures onto a key-value store. The corresponding procedural macros are implemented inlinera-view-derive
. -
linera-execution
Persistent data and the corresponding logics for runtime and execution of smart contracts / applications. -
linera-chain
Persistent data and the corresponding logics for chains of blocks, certificates, and cross-chain messaging. -
linera-storage
Defines the storage abstractions for the protocol on top oflinera-chain
. -
linera-core
The core Linera protocol, including client and server logic, node synchronization, etc. -
linera-rpc
Defines the data-type for RPC messages (currently all client<->proxy<->chain<->chain interactions), and track the corresponding data schemas. -
linera-service
Executable for clients (aka CLI wallets), proxy (aka validator frontend) and servers. -
linera-sdk
The library to develop Linera applications written in Rust for the Wasm virtual machine. -
examples
Examples of Linera applications written in Rust.
# 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 0 extra user wallets.
# This will set environment variables LINERA_{WALLET,STORAGE}_0 referenced by -w0 below.
linera_spawn_and_read_wallet_variables linera net up --extra-wallets 0
# Print the set of validators.
linera -w0 query-validators
# Query some of the chains created at genesis
CHAIN1="e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65"
CHAIN2="256e1dbc00482ddd619c293cc0df94d366afe7980022bb22d99e33036fd465dd"
linera -w0 query-balance "$CHAIN1"
linera -w0 query-balance "$CHAIN2"
# Transfer 10 units then 5 back
linera -w0 transfer 10 --from "$CHAIN1" --to "$CHAIN2"
linera -w0 transfer 5 --from "$CHAIN2" --to "$CHAIN1"
# Query balances again
linera -w0 query-balance "$CHAIN1"
linera -w0 query-balance "$CHAIN2"