solana-with-rpc-optimizations/README.md

133 lines
3.8 KiB
Markdown
Raw Normal View History

[![Silk crate](https://img.shields.io/crates/v/silk.svg)](https://crates.io/crates/silk)
[![Silk documentation](https://docs.rs/silk/badge.svg)](https://docs.rs/silk)
2018-02-16 10:49:21 -08:00
[![Build Status](https://travis-ci.org/loomprotocol/silk.svg?branch=master)](https://travis-ci.org/loomprotocol/silk)
[![codecov](https://codecov.io/gh/loomprotocol/silk/branch/master/graph/badge.svg)](https://codecov.io/gh/loomprotocol/silk)
2018-02-14 14:25:49 -08:00
Disclaimer
===
2018-02-15 12:59:33 -08:00
All claims, content, designs, algorithms, estimates, roadmaps, specifications, and performance measurements described in this project are done with the author's best effort. It is up to the reader to check and validate their accuracy and truthfulness. Furthermore nothing in this project constitutes a solicitation for investment.
Silk, a silky smooth implementation of the Loom specification
===
2018-03-06 16:21:45 -08:00
Loom™ is a new architecture for a high performance blockchain. Its white paper boasts a theoretical
2018-02-16 11:51:57 -08:00
throughput of 710k transactions per second on a 1 gbps network. The specification is implemented
2018-03-06 16:21:45 -08:00
in two git repositories. Research is performed in the loom repository. That work drives the
2018-02-16 11:51:57 -08:00
Loom specification forward. This repository, on the other hand, aims to implement the specification
as-is. We care a great deal about quality, clarity and short learning curve. We avoid the use
of `unsafe` Rust and write tests for *everything*. Optimizations are only added when
2018-02-21 09:05:55 -08:00
corresponding benchmarks are also added that demonstrate real performance boosts. We expect the
2018-02-16 11:51:57 -08:00
feature set here will always be a ways behind the loom repo, but that this is an implementation
you can take to the bank, literally.
2018-03-05 15:05:16 -08:00
Running the demo
===
2018-02-19 08:19:26 -08:00
First, install Rust's package manager Cargo.
2018-03-05 15:05:16 -08:00
```bash
$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
```
Install the silk executables:
```bash
$ cargo install silk
2018-02-19 08:19:26 -08:00
```
2018-03-19 09:23:43 -07:00
The testnode server is initialized with a ledger from stdin and
generates new ledger entries on stdout. To create the input ledger, we'll need
to create *the mint* and use it to generate a *genesis ledger*. It's done in
two steps because the mint.json file contains a private key that will be
used later in this demo.
2018-03-05 15:05:16 -08:00
```bash
$ echo 500 | silk-mint > mint.json
$ cat mint.json | silk-genesis > genesis.log
```
2018-03-05 15:05:16 -08:00
Now you can start the server:
```bash
$ cat genesis.log | silk-testnode > transactions0.log
2018-03-05 15:05:16 -08:00
```
2018-03-06 16:21:45 -08:00
Then, in a separate shell, let's execute some transactions. Note we pass in
2018-03-19 09:23:43 -07:00
the JSON configuration file here, not the genesis ledger.
2018-03-05 15:05:16 -08:00
```bash
$ cat mint.json | silk-client-demo
2018-03-05 15:05:16 -08:00
```
2018-03-19 09:23:43 -07:00
Now kill the server with Ctrl-C, and take a look at the ledger. You should
2018-03-05 15:05:16 -08:00
see something similar to:
```json
2018-03-05 15:18:46 -08:00
{"num_hashes":27,"id":[0, "..."],"event":"Tick"}
2018-03-19 09:23:43 -07:00
{"num_hashes":3,"id":[67, "..."],"event":{"Transaction":{"tokens":42}}}
2018-03-05 15:18:46 -08:00
{"num_hashes":27,"id":[0, "..."],"event":"Tick"}
2018-03-05 15:05:16 -08:00
```
2018-03-19 09:23:43 -07:00
Now restart the server from where we left off. Pass it both the genesis ledger, and
the transaction ledger.
2018-03-05 15:05:16 -08:00
```bash
$ cat genesis.log transactions0.log | silk-testnode > transactions1.log
2018-03-05 15:05:16 -08:00
```
2018-03-06 16:21:45 -08:00
Lastly, run the client demo again, and verify that all funds were spent in the
previous round, and so no additional transactions are added.
2018-03-05 15:05:16 -08:00
```bash
$ cat mint.json | silk-client-demo
```
2018-03-06 16:21:45 -08:00
Stop the server again, and verify there are only Tick entries, and no Transaction entries.
Developing
===
Building
---
Install rustc, cargo and rustfmt:
```bash
$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
$ rustup component add rustfmt-preview
```
Download the source code:
```bash
2018-02-16 10:49:21 -08:00
$ git clone https://github.com/loomprotocol/silk.git
$ cd silk
```
Testing
---
Run the test suite:
```bash
cargo test
```
Benchmarking
---
First install the nightly build of rustc. `cargo bench` requires unstable features:
```bash
$ rustup install nightly
```
Run the benchmarks:
```bash
$ cargo +nightly bench --features="asm,unstable"
```