forked from integritee-network/worker
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic client CLI (integritee-network#94)
+moved from hardcoded client example to generic CLI +added M5 demo bash script similar to old M5 demo +stf functions CLI are defined in stf crate for easy customization by third parties
- Loading branch information
Showing
31 changed files
with
1,308 additions
and
709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,83 @@ | ||
[package] | ||
name = "substratee_client" | ||
name = "substratee-client" | ||
version = "4.0.0" | ||
authors = ["Supercomputing Systems AG <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
substrate-api-client = { tag = "api-M1.5", git = "https://github.com/scs/substrate-api-client.git"} | ||
log = "0.4" | ||
env_logger = "0.7.1" | ||
serde = "1.0" | ||
serde_json = "1.0" | ||
serde_derive = "1.0" | ||
env_logger = "0.7" | ||
hex = "0.4" | ||
json = "0.12.0" | ||
substrate-bip39 = "0.3.1" | ||
tiny-bip39 = "0.6.2" | ||
serde_json = "1.0" | ||
clap = "2.33" | ||
clap-nested = "0.3.1" | ||
primitive-types = { version = "0.6.1", default-features = false, features = ["codec"] } | ||
base58 = "0.1" | ||
chrono = "*" | ||
base58 = "0.1" | ||
|
||
clap = { version = "2.33", features = [ "yaml" ] } | ||
blake2-rfc = { version = "0.2.18", default-features = false} | ||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } | ||
primitive-types = { version = "0.6", default-features = false, features = ["codec"] } | ||
|
||
sgx_types = { rev = "v1.1.0",git = "https://github.com/apache/teaclave-sgx-sdk.git" } | ||
sgx_crypto_helper = { rev = "v1.1.0",git = "https://github.com/apache/teaclave-sgx-sdk.git", default-features = false } | ||
[dependencies.serde] | ||
features = ["derive"] | ||
optional = true | ||
version = "1.0" | ||
|
||
[dependencies.my_node_runtime] | ||
git = "https://github.com/scs/substraTEE-node" | ||
rev = "7328b37166fdffcc74cf11763084d67029945df9" | ||
package = "substratee-node-runtime" | ||
[dependencies.codec] | ||
default-features = false | ||
package = "parity-scale-codec" | ||
features = ["derive"] | ||
version = "1.0.0" | ||
|
||
[dependencies.substrate-api-client] | ||
git = "https://github.com/scs/substrate-api-client" | ||
tag = "api-M1.5" | ||
[dependencies.primitives] | ||
git = 'https://github.com/paritytech/substrate' | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "substrate-primitives" | ||
|
||
[dependencies.substratee-node-calls] | ||
path = "../substratee-node-calls" | ||
[dependencies.sr-primitives] | ||
git = "https://github.com/paritytech/substrate" | ||
package = "sr-primitives" | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
|
||
[dependencies.substratee_worker_api] | ||
path = "../worker/worker-api" | ||
[dependencies.keystore] | ||
git = 'https://github.com/paritytech/substrate' | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "substrate-keystore" | ||
|
||
[dependencies.balances] | ||
git = 'https://github.com/paritytech/substrate' | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "pallet-balances" | ||
default-features=false | ||
|
||
[dependencies.system] | ||
git = "https://github.com/paritytech/substrate" | ||
git = 'https://github.com/paritytech/substrate' | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "palette-system" | ||
default-features=false | ||
|
||
[dependencies.primitives] | ||
git = "https://github.com/paritytech/substrate" | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "substrate-primitives" | ||
features = ["full_crypto"] | ||
[dependencies.substratee-node-runtime] | ||
git = "https://github.com/scs/substraTEE-node" | ||
rev = "e09d5c51287d240df904b5dc98c4a9f59ac7c002" | ||
package = "substratee-node-runtime" | ||
|
||
[dependencies.node-primitives] | ||
git = "https://github.com/paritytech/substrate" | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
[dependencies.substratee-stf] | ||
path = "../stf" | ||
|
||
[dependencies.substratee-worker-api] | ||
path = "../worker/worker-api" | ||
|
||
[dependencies.keyring] | ||
git = "https://github.com/paritytech/substrate" | ||
git = 'https://github.com/paritytech/substrate' | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "substrate-keyring" | ||
|
||
[dependencies.runtime_primitives] | ||
[dependencies.app-crypto] | ||
git = "https://github.com/paritytech/substrate" | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "sr-primitives" | ||
#default-features = false | ||
package = "substrate-application-crypto" | ||
|
||
[dependencies.indices] | ||
git = "https://github.com/paritytech/substrate" | ||
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5" | ||
package = "pallet-indices" | ||
|
||
[dependencies.substratee-stf] | ||
path = "../stf" | ||
default-features = false | ||
#[patch.crates-io] | ||
#ed25519-dalek = { git = "https://github.com/scs/ed25519-dalek.git", branch = "no_std_sgx"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SubstraTEE CLI client | ||
Interact with the SubstraTEE chain and workers from the command line | ||
|
||
Includes | ||
* keystore (incompatible with polkadot js app json) | ||
* basic balance transfer | ||
* SubstraTEE-specific calls | ||
|
||
## examples | ||
``` | ||
> substratee-client new-account | ||
> substratee-client 127.0.0.1 transfer 5GpuFm6t1AU9xpTAnQnHXakTGA9rSHz8xNkEvx7RVQz2BVpd 5FkGDttiYa9ZoDAuNxzwEdLzkgt6ngWykSBhobGvoFUcUo8B 12345 | ||
> substratee-client 127.0.0.1:9979 list-workers | ||
number of workers registered: 1 | ||
Enclave 1 | ||
AccountId: 5DvVAZAWnFS6ufCteSbuh46miVUCQH5oZ231SXHQGswCdGx9 | ||
MRENCLAVE: HvKRosdfbbLayao3rAq4xmN2fnxBVX79DfDdeJ9YcTo5 | ||
RA timestamp: 2020-02-22 06:32:37 UTC | ||
URL: 127.0.0.1:2000 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# setup: | ||
# run all on localhost: | ||
# run substratee-node --dev --ws-port 9979 -lruntime=debug | ||
# run substratee-worker -p 9979 run | ||
# | ||
# then run this script | ||
|
||
CLIENT="../target/release/substratee-client -p 9979 " | ||
|
||
echo "query on-chain enclave registry:" | ||
$CLIENT list-workers | ||
echo "" | ||
|
||
# does this work when multiple workers are in the registry? | ||
read MRENCLAVE <<< $($CLIENT list-workers | awk '/ MRENCLAVE:[[:space:]]/ { print $2 }') | ||
|
||
# only for initial setup (actually should be done in genesis) | ||
# pre-fund //AliceIncognito, our ROOT key | ||
echo "issue funds on first (sender) account:" | ||
$CLIENT trusted set-balance //AliceIncognito 123456789 --mrenclave $MRENCLAVE | ||
echo -n "get balance: " | ||
$CLIENT trusted balance //AliceIncognito --mrenclave $MRENCLAVE | ||
|
||
## create a new on-chain account and fund it form faucet | ||
#account1=$($CLIENT new-account) | ||
#echo "*** created new on-chain account: $account1" | ||
#echo "*** funding that account from faucet" | ||
#$CLIENT faucet $account1 | ||
|
||
# create incognito account for default shard (= MRENCLAVE) | ||
account1p=$($CLIENT trusted new-account --mrenclave $MRENCLAVE) | ||
echo "created new incognito account: $account1p" | ||
|
||
#send 10M funds from AliceIncognito to new account | ||
$CLIENT trusted transfer //AliceIncognito $account1p 23456789 --mrenclave $MRENCLAVE | ||
|
||
echo -n "receiver balance: " | ||
$CLIENT trusted balance $account1p --mrenclave $MRENCLAVE | ||
|
||
echo -n "sender balance: " | ||
$CLIENT trusted balance //AliceIncognito --mrenclave $MRENCLAVE |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.