/linera-protocol

Main repository for the Linera protocol

Primary LanguageRustApache License 2.0Apache-2.0

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

Linera

This repository is dedicated to developing the Linera protocol. For an overview of how the Linera protocol functions refer to the whitepaper.

Repository Structure

The Linera protocol repository is broken down into the following crates and subdirectories: (from low-level to high-level in the dependency graph)

  1. linera-base Base definitions, including cryptography.

  2. linera-views A library mapping complex data structures onto a key-value store. The corresponding procedural macros are implemented in linera-view-derive.

  3. linera-execution Persistent data and the corresponding logics for runtime and execution of smart contracts / applications.

  4. linera-chain Persistent data and the corresponding logics for chains of blocks, certificates, and cross-chain messaging.

  5. linera-storage Defines the storage abstractions for the protocol on top of linera-chain.

  6. linera-core The core Linera protocol, including client and server logic, node synchronization, etc.

  7. linera-rpc Defines the data-type for RPC messages (currently all client<->proxy<->chain<->chain interactions), and track the corresponding data schemas.

  8. linera-service Executable for clients (aka CLI wallets), proxy (aka validator frontend) and servers.

  9. linera-sdk The library to develop Linera applications written in Rust for the Wasm virtual machine.

  10. examples Examples of Linera applications written in Rust.

Quickstart with the Linera service CLI

# 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"