forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor scripts, update zero.block, add config sample
- Loading branch information
Showing
7 changed files
with
102 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tx.json | ||
rx.json | ||
config.json |
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,7 +1,7 @@ | ||
{ | ||
"block_store_path" : "/tmp/block_store/", | ||
"torii_port" : 50051, | ||
"pg_opt" : "host=iroha1001_postgres_1 port=5432 user=iroha password=helloworld", | ||
"redis_host" : "iroha1001_redis_1", | ||
"pg_opt" : "host=localhost port=5432 user=postgres password=mysecretpassword", | ||
"redis_host" : "localhost", | ||
"redis_port" : 6379 | ||
} |
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,7 @@ | ||
{ | ||
"block_store_path" : "/tmp/block_store/", | ||
"torii_port" : 50051, | ||
"pg_opt" : "host=localhost port=5432 user=postgres password=mysecretpassword", | ||
"redis_host" : "localhost", | ||
"redis_port" : 6379 | ||
} |
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,53 @@ | ||
#!/bin/bash | ||
|
||
# to print name of the command or query and wait enter to be pushed | ||
function print_and_read() { | ||
echo "=== $1 ===" | ||
read | ||
} | ||
|
||
# update tx counter and created ts of tx | ||
function update_tx() { | ||
created_ts=$(./current_millis) | ||
((tx_counter+=1)) | ||
|
||
< $(basename $1) \ | ||
sed -e "s/\"created_ts\".*/\"created_ts\": $created_ts,/" \ | ||
-e "s/\"tx_counter\".*/\"tx_counter\": $tx_counter,/" >tx.json | ||
} | ||
|
||
# update tx counter and created ts of query | ||
function update_query() { | ||
created_ts=$(./current_millis) | ||
((tx_counter+=1)) | ||
|
||
< $(basename $1) \ | ||
sed -e "s/\"created_ts\".*/\"created_ts\": $created_ts,/" \ | ||
-e "s/\"tx_counter\".*/\"tx_counter\": $tx_counter,/" >rx.json | ||
} | ||
|
||
# update and send tx | ||
function send() { | ||
update_tx $1 | ||
$IROHA_CLI --grpc --json_transaction tx.json | ||
} | ||
|
||
# update and recv result of the query | ||
function recv() { | ||
update_query $1 | ||
$IROHA_CLI --grpc --json_query rx.json | ||
} | ||
|
||
# print and send command | ||
function run_send() { | ||
print_and_read $1 | ||
send $2 | ||
echo | ||
} | ||
|
||
# print and run query | ||
function run_recv() { | ||
print_and_read $1 | ||
recv $2 | ||
echo | ||
} |
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,9 +1,16 @@ | ||
#!/bin/bash | ||
../build/bin/iroha-cli --grpc --json_transaction CreateDomain.json | ||
../build/bin/iroha-cli --grpc --json_transaction CreateAsset.json | ||
../build/bin/iroha-cli --grpc --json_transaction CreateAccount-alice.json | ||
../build/bin/iroha-cli --grpc --json_transaction CreateAccount-bob.json | ||
../build/bin/iroha-cli --grpc --json_transaction AddSignatory-bob.json | ||
../build/bin/iroha-cli --grpc --json_transaction AddAssetQuantity-alice.json | ||
../build/bin/iroha-cli --grpc --json_transaction AddAssetQuantity-bob.json | ||
../build/bin/iroha-cli --grpc --json_transaction TransferAsset.json | ||
|
||
source functions.sh | ||
|
||
if [[ -z "${IROHA_CLI}" ]]; | ||
then IROHA_CLI=/opt/iroha/build/bin/iroha-cli | ||
fi | ||
|
||
send CreateDomain.json | ||
send CreateAsset.json | ||
send CreateAccount-alice.json | ||
send CreateAccount-bob.json | ||
send AddSignatory-bob.json | ||
send AddAssetQuantity-alice.json | ||
send AddAssetQuantity-bob.json | ||
send TransferAsset.json |
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