diff --git a/.gitignore b/.gitignore index 47280dd..01952fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +stress_test/*.toml parity ethstore core diff --git a/secretstore_generate b/secretstore_generate.sh similarity index 96% rename from secretstore_generate rename to secretstore_generate.sh index 79d6a83..60fda1a 100755 --- a/secretstore_generate +++ b/secretstore_generate.sh @@ -1,2 +1,3 @@ +#!/bin/bash # return: "0x07d6c0e4cecbe7a3ab3a8f5bd6439bb78ecd41f3e7487d34981668c50c62976e6f57eda20c9bd7026b4defa31141520a3480561b3c5bec5275d9d7f4f1e9d50a" curl -v -X POST http://localhost:8082/shadow/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00/1 \ No newline at end of file diff --git a/secretstore_generate_and_store b/secretstore_generate_and_store.sh similarity index 98% rename from secretstore_generate_and_store rename to secretstore_generate_and_store.sh index 458c661..4b8d028 100755 --- a/secretstore_generate_and_store +++ b/secretstore_generate_and_store.sh @@ -1,2 +1,3 @@ +#!/bin/bash # return: "0x04bfc447952f4d1818a49f6b30bbf42ef26d6a25844ea2d11cb93a8a7ac385de6c162edbd1c2b785061456b35075e620bd3991a7df5967a594c87bd199caf90810a463e02da8b3415d471495ad37fa069d287a830e72f27b565fc3f28b5888c1e16c4435ef801bc6ffd680767b82a3102268f53796b9fa61117138bd5c72bb5e0556d6d9e17ce850d499e344ae68c1b04cbde3077e9d2a4ba9cceb057d2d609133c479aa891adf38c3511424c2cbc86764" curl -v -X POST http://localhost:8082/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00/1 \ No newline at end of file diff --git a/secretstore_query b/secretstore_query.sh similarity index 98% rename from secretstore_query rename to secretstore_query.sh index ebe11da..aa88c19 100755 --- a/secretstore_query +++ b/secretstore_query.sh @@ -1,2 +1,3 @@ +#!/bin/bash # returns "0x04990dbe0a4bd6ade23a588ca94c8ba1961a512129b62c23b2a5984ee58e6a925115f7681168909f45a33d7ffe8b8994416b6a707a8838c6c5bfc2d332cfa0fdeb0d1bb0c098d4e7ea690d76abbfc28483665bf00aff8932f6b557efc232ed229709a9cd583bc25543ec2414c719524fa9e73b813c4258e9eb5e8fb95480175d4be89869c094590bf680783dd85da20856da3980f0d2245c4f6b2faa2c28645c355bb082f8759ecaa16b536ff483768d26" curl -v http://localhost:8082/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00 \ No newline at end of file diff --git a/secretstore_query_shadow b/secretstore_query_shadow.sh similarity index 98% rename from secretstore_query_shadow rename to secretstore_query_shadow.sh index eeb5ee4..926b468 100755 --- a/secretstore_query_shadow +++ b/secretstore_query_shadow.sh @@ -1,2 +1,3 @@ +#!/bin/bash # returns {"decrypted_secret":"0x88adde1841690af21700e6ff37b8786733cede2ed2faf703f9d5d1a625fd45eb7e5e6efc3800d23482cbf8f1eead192b3123326aa5434c56bae2f99f3f7ca5bf","common_point":"0x2e350d872aef36f0baaf53c0b8b227240814e200e649493948e715487e09ac25957d269f97cd110e836ac48443f217c6a1ce443eecb51df8b1218c0558bd65a2","decrypt_shadows":["0x045f2f68a55d9823c5d618eda6e6687e1d16cb255ec9b4e8e91cee7910e0662e7fb696aa58cf141c44e1d26f7888cd2f3cdc817aa42ce719c2fae6ca5ae58655d161d97b791dd4734ffdd83920980107bf9f07cf49e69680068f490084e11ecd6f344d12bdfe1620ce2e36e5a77086970c9a20192e29fe8b64024ee2cd8eb48bd78595e5da81096f7f2e4165f85719b97e","0x04df05a7ae021b111777318f94ba677ed1e2b4857a3209acae25ca6a628dfe9f5f28aec46e528fd9ac8d35eb1e506851f699cb3715738106e226a4a4ab820af9310e059904a24e5851f7e28e163c35a0803ba13e4d3de9f7bea3aef94c63540193c89402080cde36aab7117b7918a11cb184bf40a08ab59a12d25a15ae581731fff1dba5889ab3b7f24e7b54d74538e342"]} curl -v http://localhost:8082/shadow/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00 \ No newline at end of file diff --git a/secretstore_sign b/secretstore_sign.sh similarity index 98% rename from secretstore_sign rename to secretstore_sign.sh index d70b167..165be62 100755 --- a/secretstore_sign +++ b/secretstore_sign.sh @@ -1,2 +1,3 @@ +#!/bin/bash # returns "0x0410fe210ffdd38611b252e24c61b610d6ea8ec70f9f7186184441871839562cc18c94174af0c804973ce88a6f07ec7604b4b91821a6ca68ca348d16cd647fba494f8132ff36ad4654abd5cba6fb1fd98cacc12aaf3a0fe70010be91f5ab7b69db8f80e528be3baba70341721d6058ad66665363033f0cee963476da746e843d4006170ab549fa82f14eec7b420d542c3415a61fc3075f39e1529bc4e6f54f1170496393485f6ef271ad8b587c8fae8a18" curl -v http://localhost:8082/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00/0000000000000000000000000000000000000000000000000000000000000001 \ No newline at end of file diff --git a/secretstore_store b/secretstore_store.sh similarity index 98% rename from secretstore_store rename to secretstore_store.sh index 7fb20d7..32a8142 100755 --- a/secretstore_store +++ b/secretstore_store.sh @@ -1,3 +1,4 @@ +#!/bin/bash # secret: 58b8569f394a959a29adcab099e258db099b9f6ebe6497adbfb8564b13bde8eb67524341dc28579f3eec589f30a90052963489ef2473c0539aaa3a529db1cda6 # encrypted with public: 07d6c0e4cecbe7a3ab3a8f5bd6439bb78ecd41f3e7487d34981668c50c62976e6f57eda20c9bd7026b4defa31141520a3480561b3c5bec5275d9d7f4f1e9d50a curl -v -X POST http://localhost:8082/shadow/0000000000000000000000000000000000000000000000000000000000000000/de12681e0b8f7a428f12a6694a5f7e1324deef3d627744d95d51b862afc13799251831b3611ae436c452b54cdf5c4e78b361a396ae183e8b4c34519e895e623c00/368244efaf441c2dabf7a723355a97b3b86f27bdb2827ae6f34ddece5132efd37af4ba808957b7113b4296bc4ae9ec7be38f9de6bae00504e775883a50d4658a/b7ad0603946987f1a154ae7f074e45da224eaa83704aac16a2d43a675d219654cf087b5d7aacce0790a65abbc1a495b26e71a5c6e9a4a71b543bf0048935bc13 \ No newline at end of file diff --git a/start b/start.sh similarity index 95% rename from start rename to start.sh index 8f72855..a9c9bbb 100755 --- a/start +++ b/start.sh @@ -1,3 +1,4 @@ +#!/bin/bash RUST_LOG=secretstore=trace,secretstore_net=trace ./parity --config dev_ss1.toml& RUST_LOG=secretstore=trace,secretstore_net=trace ./parity --config dev_ss2.toml& RUST_LOG=secretstore=trace,secretstore_net=trace ./parity --config dev_ss3.toml& diff --git a/stop b/stop.sh similarity index 58% rename from stop rename to stop.sh index 699b0b2..0dac4cc 100755 --- a/stop +++ b/stop.sh @@ -1 +1,2 @@ +#!/bin/bash killall -9 parity \ No newline at end of file diff --git a/stress_test/config_generate.sh b/stress_test/config_generate.sh new file mode 100755 index 0000000..286f72f --- /dev/null +++ b/stress_test/config_generate.sh @@ -0,0 +1,72 @@ +#!/bin/bash +function join_by { local IFS="$1"; shift; echo "$*"; } + +NUM_NODES=360 +THRESHOLD=240 +NETWORK_PORT_BASE=30000 +SSTORE_INTERNAL_PORT_BASE=40000 +SSTORE_HTTP_PORT_BASE=50000 + +for i in `seq 1 $NUM_NODES` +do + openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key 2>/dev/null + network_port[i]=$(($NETWORK_PORT_BASE+$i)) + sstore_internal_port[i]=$(($SSTORE_INTERNAL_PORT_BASE+$i)) + sstore_http_port[i]=$(($SSTORE_HTTP_PORT_BASE+$i)) + secret[i]=`cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//'` + public[i]=`cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//'` + enode[i]="\"enode://${public[i]}@127.0.0.1:${network_port[i]}\"" + ssnode[i]="\"${public[i]}@127.0.0.1:${sstore_internal_port[i]}\"" +done +rm key + +for i in `seq 1 $NUM_NODES` +do + self_enode=${enode[i]} + bootnodes=("${enode[@]/$self_enode}") + bootnodes=$(join_by , ${bootnodes[@]}) + self_ssnode=${ssnode[i]} + ssnodes=("${ssnode[@]/$self_ssnode}") + ssnodes=$(join_by , ${ssnodes[@]}) + config_contents="[parity] +chain = \"dev\" +base_path = \"db.dev_ss${i}\" + +[ui] +disable = false + +[rpc] +disable = false + +[ipc] +disable = true + +[websockets] +disable = false + +[dapps] +disable = false + +[network] +port = ${network_port[i]} +node_key = \"${secret[i]}\" +bootnodes = [$bootnodes] + +[ipfs] +enable = false + +[snapshots] +disable_periodic = true + +[secretstore] +disable = false +self_secret = \"${secret[i]}\" +nodes = [$ssnodes] +interface = \"local\" +port = ${sstore_internal_port[i]} +http_interface = \"local\" +http_port = ${sstore_http_port[i]} +path = \"db.dev_ss${i}/secretstore\" +" + echo "$config_contents" >"dev_ss${i}.toml" +done