Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
demo: add demo app (#354)
Browse files Browse the repository at this point in the history
Separate nodes for each account, sending an receiving money.
  • Loading branch information
oleganza authored Aug 27, 2019
1 parent 84a3b2d commit c2efbc4
Show file tree
Hide file tree
Showing 32 changed files with 1,869 additions and 7 deletions.
24 changes: 19 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ matrix:
script:
- go test -v ./slidechain/... -timeout 60m
- language: rust
rust: nightly-2019-07-31
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
Expand All @@ -35,7 +35,7 @@ matrix:
- cargo test
- RUSTFLAGS="-C opt-level=0" cargo bench "DONOTMATCHANYBENCHMARK"
- language: rust
rust: nightly-2019-07-31
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
Expand All @@ -50,7 +50,7 @@ matrix:
- cargo test
- RUSTFLAGS="-C opt-level=0" cargo bench "DONOTMATCHANYBENCHMARK"
- language: rust
rust: nightly-2019-07-31
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
Expand All @@ -65,7 +65,7 @@ matrix:
- cargo test
- RUSTFLAGS="-C opt-level=0" cargo bench "DONOTMATCHANYBENCHMARK"
- language: rust
rust: nightly-2019-07-31
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
Expand All @@ -80,7 +80,7 @@ matrix:
- cargo test
- RUSTFLAGS="-C opt-level=0" cargo bench "DONOTMATCHANYBENCHMARK"
- language: rust
rust: nightly-2019-07-31
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
Expand All @@ -94,3 +94,17 @@ matrix:
- cargo fmt --all -- --check
- cargo test
- RUSTFLAGS="-C opt-level=0" cargo bench "DONOTMATCHANYBENCHMARK"
- language: rust
rust: nightly-2019-08-19
# per https://levans.fr/rust_travis_cache.html
cache:
directories:
- /home/travis/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry
before_script:
- cd demo
- rustup component add rustfmt-preview
script:
- cargo fmt --all -- --check
- cargo check
1 change: 0 additions & 1 deletion accounts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2018"
failure = "0.1"
byteorder = "1"
merlin = "1.0.1"
postgres = "0.15"
rand = "0.6"
subtle = "2"
curve25519-dalek = { version = "1.0.1", features = ["serde"] }
Expand Down
1 change: 1 addition & 0 deletions demo/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=demodb.sqlite
4 changes: 4 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target
**/*.rs.bk
Cargo.lock
demodb.sqlite
44 changes: 44 additions & 0 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "zkvm-demo"
version = "0.1.0"
authors = ["Oleg Andreev <oleganza@gmail.com>"]
edition = "2018"

[dependencies]
rand = "0.6"
rocket = "0.4.2"
diesel = { version = "1.0.0", features = ["postgres"] }
dotenv = "0.9.0"
merlin = "1.0.1"
curve25519-dalek = { version = "1.0.1", features = ["serde"] }
serde = { version = "1.0", features=["derive"] }
rand_chacha = "0.1"
hex = "^0.3"

[dependencies.bulletproofs]
git = "https://github.com/dalek-cryptography/bulletproofs"
branch = "develop"
features = ["yoloproofs"]

[dependencies.keytree]
path = "../keytree"

[dependencies.musig]
path = "../musig"

[dependencies.zkvm]
path = "../zkvm"

[dependencies.accounts]
path = "../accounts"

[dependencies.rocket_contrib]
version = "0.4.2"
default-features = false
features = ["handlebars_templates", "tera_templates", "serve", "diesel_sqlite_pool"]

[dependencies.serde_json]
git = "https://github.com/oleganza/json"
#path = "../../../rust/serde-json"
branch = "binary-support"
features = ["binary_hex"]
22 changes: 22 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ZkVM demo

## Schema

### Nodes

```
- id
- blockchain_state
- xprv
- account sequence number
- confirmed_utxos
- pending_utxos
```

### Blocks

```
- block height
- block_json
```

2 changes: 2 additions & 0 deletions demo/Rocket.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[global.databases]
demodb = { url = "demodb.sqlite" }
5 changes: 5 additions & 0 deletions demo/diesel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli

[print_schema]
file = "src/schema.rs"
Empty file added demo/migrations/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions demo/migrations/2019-08-07-115941_create_tables/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE blocks;
DROP TABLE assets;
DROP TABLE nodes;
16 changes: 16 additions & 0 deletions demo/migrations/2019-08-07-115941_create_tables/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS block_records (
height integer PRIMARY KEY NOT NULL,
block_json text NOT NULL,
state_json text NOT NULL
);

CREATE TABLE IF NOT EXISTS asset_records (
alias varchar PRIMARY KEY NOT NULL,
key_json text NOT NULL
);

CREATE TABLE IF NOT EXISTS node_records (
alias varchar PRIMARY KEY NOT NULL,
state_json text NOT NULL
);

1 change: 1 addition & 0 deletions demo/rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2019-08-19
Loading

0 comments on commit c2efbc4

Please sign in to comment.