Skip to content

Commit

Permalink
Add zeroc as a command-line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
osuketh committed Jun 8, 2019
1 parent c20f919 commit 79dd229
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 58 deletions.
57 changes: 28 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ parking_lot = '0.7.1'
slog = '^2'
tokio = '0.1'
trie-root = '0.11.0'

bellman-verifier = { path = "core/bellman-verifier"}
demo = { package = "zero-chain-cli", path = "demo/cli" }
zcrypto = { package = "zero-chain-crypto", path = "core/crypto" }
zpairing = { package = "zero-chain-pairing", path = "core/pairing" }
zprimitives = { package = "zero-chain-primitives", path = "core/primitives" }
Expand Down Expand Up @@ -107,15 +105,11 @@ version = '1.0.0'
name = 'zero-chain'
path = 'src/main.rs'

[[bin]]
name = 'zero-chain-cli'
path = 'demo/cli/src/main.rs'

[workspace]
members = [
"core/bellman-verifier",
"core/crypto",
"demo/cli",
"zeroc",
"core/jubjub",
"core/pairing",
"core/primitives",
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ You can send the transaction from firefox browser.
<img src="https://user-images.githubusercontent.com/20852667/54687970-228b2a00-4b60-11e9-8c26-fdfbbb3a17d8.png" width="1100px">
</div>

## zeroc: Zerochain command line tool

- Setup
```
cargo install --path zeroc
```

- Setup for zk-SNARKs
```
zeroc setup
```

- Generate key pairs
```
zeroc init
```

- Send extrinsic to substrate node
```
zeroc send-tx
```

- Get balance
```
zeroc get-balance
```

### Documentations
- [Announcing Zerochain: Applying zk-SNARKs to Substrate](https://medium.com/layerx/announcing-zerochain-5b08e158355d)

Expand Down
11 changes: 2 additions & 9 deletions runtime/src/conf_transfer.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
//! A simple module for dealing with confidential transfer of fungible assets.
use support::{decl_module, decl_storage, decl_event, StorageMap, dispatch::Result, ensure};
use rstd::prelude::*;
use bellman_verifier::{
verify_proof,
};
use bellman_verifier::verify_proof;
use pairing::{
bls12_381::{
Bls12,
Fr,
},
Field,
};
use jubjub::{
redjubjub::{
PublicKey,
},
};

use jubjub::redjubjub::PublicKey;
use zprimitives::{
PkdAddress,
Ciphertext,
Expand Down
20 changes: 10 additions & 10 deletions demo/cli/Cargo.toml → zeroc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[package]
name = "zero-chain-cli"
name = "zeroc"
version = "0.1.0"
authors = ["osuke <[email protected]>"]
edition = "2018"

[dependencies]
rand = "0.4"
proofs = { package = "zero-chain-proofs", path = "../../core/proofs" }
proofs = { package = "zero-chain-proofs", path = "../core/proofs" }
clap = "~2.32"
primitives = { package = "substrate-primitives", git = "https://github.com/osuketh/substrate", branch = "patch-zerochain" }
runtime-primitives = { package = "sr-primitives", git = "https://github.com/osuketh/substrate", branch = "patch-zerochain" }
zpairing = { package = "zero-chain-pairing", path = "../../core/pairing" }
zpairing = { package = "zero-chain-pairing", path = "../core/pairing" }
pairing = { git = "https://github.com/LayerXcom/librustzcash", branch = "zero-chain" }
bellman = { git = "https://github.com/LayerXcom/librustzcash", branch = "zero-chain" }
scrypto = { package = "sapling-crypto", git = "https://github.com/LayerXcom/librustzcash", branch = "zero-chain" }
bellman-verifier = { path = "../../core/bellman-verifier"}
zcrypto = { package = "zero-chain-crypto", path = "../../core/crypto"}
zprimitives = { package = "zero-chain-primitives", path = "../../core/primitives" }
zjubjub = { package = "jubjub", path = "../../core/jubjub"}
bellman-verifier = { path = "../core/bellman-verifier"}
zcrypto = { package = "zero-chain-crypto", path = "../core/crypto"}
zprimitives = { package = "zero-chain-primitives", path = "../core/primitives" }
zjubjub = { package = "jubjub", path = "../core/jubjub"}
lazy_static = "1.3.0"
byteorder = "1"
keys = { path = "../../core/keys" }
wasm-utils = {package = "zerochain-wasm-utils", path = "../wasm-utils"}
keys = { path = "../core/keys" }
wasm-utils = {package = "zerochain-wasm-utils", path = "../demo/wasm-utils"}
hex = "0.3.2"
polkadot-rs = { git = "https://github.com/LayerXcom/polkadot.rs" }
parity-codec = "3.2"
zero-chain-runtime = { path = "../../runtime" }
zero-chain-runtime = { path = "../runtime" }

[dependencies.blake2-rfc]
git = "https://github.com/gtank/blake2-rfc"
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions demo/cli/src/main.rs → zeroc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ fn main() {
}

fn cli() -> Result<(), String> {
const VERIFICATION_KEY_PATH: &str = "demo/cli/verification.params";
const PROVING_KEY_PATH: &str = "demo/cli/proving.params";
const VERIFICATION_KEY_PATH: &str = "cli/verification.params";
const PROVING_KEY_PATH: &str = "cli/proving.params";
const DEFAULT_AMOUNT: &str = "10";
const DEFAULT_BALANCE: &str = "100";
const DEFAULT_FEE: &str = "1";
Expand All @@ -65,7 +65,7 @@ fn cli() -> Result<(), String> {
const DEFAULT_ENCRYPTED_BALANCE: &str = "6f4962da776a391c3b03f3e14e8156d2545f39a3ebbed675ea28859252cb006fac776c796563fcd44cc49cfaea8bb796952c266e47779d94574c10ad01754b11";
const URL: &str = "";

let matches = App::new("zero-chain-cli")
let matches = App::new("zeroc")
.setting(AppSettings::SubcommandRequiredElseHelp)
.version("0.1.0")
.author("Osuke Sudo")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 79dd229

Please sign in to comment.