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-baseBasic type definitions, including cryptography. -
linera-viewsA module enabling the mapping of complex data structures onto a KV store. -
linera-executionPersistent data and the corresponding logics for runtime and execution of smart contracts / applications. -
linera-chainPersistent data and the corresponding logics for chains of blocks, certificates, and cross-chain messaging. -
linera-storageDefines the storage abstraction and corresponding concrete implementations (DynamoDB, RocksDB, etc.) on top oflinera-chain. -
linera-coreThe Linera core protocol. Contains client / server logic, node synchronization etc. -
linera-rpcDefines the data-type for RPC messages (currently all client<->proxy<->chain<->chain interactions), and track the corresponding data schemas. -
linera-serviceExecutable for clients (aka CLI wallets), proxy (aka validator frontend) and servers. -
linera-sdkThe library to develop Linera applications written in Rust for the WASM virtual machine. -
linera-examplesExamples of Linera applications written in Rust.
The following script can be run with cargo test.
# For debug builds:
cargo build && cd target/debug
# For release builds:
# cargo build --release && cd target/release
# Clean up data files
rm -rf *.json *.txt *.db
# Make sure to clean up child processes on exit.
trap 'kill $(jobs -p)' EXIT
# Create configuration files for 4 validators with 4 shards each.
# * Private server states are stored in `server*.json`.
# * `committee.json` is the public description of the Linera committee.
./server generate --validators ../../configuration/validator_{1,2,3,4}.toml --committee committee.json
# Create configuration files for 10 user chains.
# * Private chain states are stored in one local wallet `wallet.json`.
# * `genesis.json` will contain the initial balances of chains as well as the initial committee.
./linera --wallet wallet.json create_genesis_config 10 --genesis genesis.json --initial-funding 10 --committee committee.json
# Start servers and create initial chains in DB
for I in 1 2 3 4
do
./proxy server_"$I".json &
for J in $(seq 0 3)
do
./server run --storage rocksdb:server_"$I"_"$J".db --server server_"$I".json --shard "$J" --genesis genesis.json &
done
done
# Command line prefix for client calls
CLIENT=(./linera --storage rocksdb:client.db --wallet wallet.json --max-pending-messages 10000)
${CLIENT[@]} query_validators
# Give some time for server startup
sleep 1
# Query balance for first and last user chain, root chains 0 and 9
CHAIN1="e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65"
CHAIN2="256e1dbc00482ddd619c293cc0df94d366afe7980022bb22d99e33036fd465dd"
${CLIENT[@]} query_balance "$CHAIN1"
${CLIENT[@]} query_balance "$CHAIN2"
# Transfer 10 units then 5 back
${CLIENT[@]} transfer 10 --from "$CHAIN1" --to "$CHAIN2"
${CLIENT[@]} transfer 5 --from "$CHAIN2" --to "$CHAIN1"
# Query balances again
${CLIENT[@]} query_balance "$CHAIN1"
${CLIENT[@]} query_balance "$CHAIN2"
cd ../..