PoA RAFT stack test
Last updated
Last updated
This repository is a premature effort to glue together our individual modules which includes:
NATS-based synchronous network
DB layer and serialization
Naive transaction validation
Note that our Quantum Cryptographic stack dependency fence is deliberately missing from the repository, as it’s currently only used in private investor demos and setups during the QAN IEO. Have fun playing with QAN poa-0.0.1 daemon \o/
This demo is a proof of concept, it does not represent the final product. Thus far only linux distros have been tested. The demo is built in a synchronous way. Since rocksdb is used it does not allow the code to run multiple times from the same root folder. Two alternatives are presented at “Running multiple instances”.
rust 1.40 or newer
clang, llvm and libclang-dev: apt-get install -y libclang-dev llvm clang
(or equivalent, depending on distro)
NATS server (working binary provided in the repo)
When all dependencies are present the demo can be built by:
or:
for a smaller binary. Using the “quantum” feature flag is not possible as not all sources are presented as of yet. The flagged code pieces are present to provide the actual working glue examples.
The first running must be the NATS server as the node uses it. In case the NATS server is not running the demo itself will panic and exit. A working NATS server binary is present at (from the repos root folder). The steps of running in order are:
./nats-server-v2.1.2-linux-386/nats-server
a)cargo run
b)cargo run --release
if compiled with “--release” flag (cargo run
itself will compile the code if modifications are present since the last compiled version, or no compiled version is present.)
a)./target/debug/poa_demo
b)./target/release/poa_demo
You can also use -u
and -p
to set http basic auth for the rpc. A -n
argument is also present to define NATS server location. (default NATS uri: nats://127.0.0.1:4222
)
The demo takes data from terminal and uses them to create transactions, that the whole network receives.
The demo is also reachable by JSON-RPC on port 8000
. Working jsons are presented in a separate JSON_API.md
file as curl commands.
RocksDB prevents us from having multiple instances use the same database. One possibility to circumvent this is placing the compiled binary in multiple folders, thus each instance creating and managing its own database.
The other is using docker. The repo itself contains the Dockerfile
needed, as well as a compose.sh
.
Using the docker path has the following steps in order:
getting docker
systemctl start docker
docker network create subs
(the subs
docker network is used in our compose.sh
)
in the repo root folder running: docker build . -t poademo
running the NATS server locally, outside of docker (all nodes from docker will connect to it)
a) using the compose.sh
with an integer parameter to define instance count or using the following to create a single instance manually
b) docker run -i --net=subs --name="node" -h "node" -d --ip="172.33.0.2" poademo