Skip to content

andresilva91/linera-protocol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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.
./linera-server generate --validators ../../configuration/local/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
    ./linera-proxy server_"$I".json &

    for J in $(seq 0 3)
    do
        ./linera-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:linera.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 ../..

About

Main repository for the Linera protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.4%
  • Other 1.6%