Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from GolosChain/594-script-to-create-genesis
Add script to create genesis data #594
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 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
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,61 @@ | ||
{ | ||
"state_file": "golos.dat", | ||
"genesis_json": "genesis.json", | ||
"accounts": [ | ||
# {"name": "cyber", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
# "abi": {"path": "$CYBERWAY_CONTRACTS/cyber.bios/cyber.bios.abi", "hash":""}, | ||
# "code": {"path": "$CYBERWAY_CONTRACTS/cyber.bios/cyber.bios.wasm", "hash":""} | ||
# }, | ||
# {"name": "cyber.domain", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
# "abi": {"path": "$CYBERWAY_CONTRACTS/cyber.domain/cyber.domain.abi", "hash":""}, | ||
# "code": {"path": "$CYBERWAY_CONTRACTS/cyber.domain/cyber.domain.wasm", "hash":""} | ||
# }, | ||
{"name": "cyber.token", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$CYBERWAY_CONTRACTS/cyber.token/cyber.token.abi", "hash":""}, | ||
"code": {"path": "$CYBERWAY_CONTRACTS/cyber.token/cyber.token.wasm", "hash":""} | ||
}, | ||
# {"name": "cyber.msig", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
# "abi": {"path": "$CYBERWAY_CONTRACTS/cyber.msig/cyber.msig.abi", "hash":""}, | ||
# "code": {"path": "$CYBERWAY_CONTRACTS/cyber.msig/cyber.msig.wasm", "hash":""} | ||
# }, | ||
# {"name": "cyber.govern", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
# "abi": {"path": "$CYBERWAY_CONTRACTS/cyber.govern/cyber.govern.abi", "hash":""}, | ||
# "code": {"path": "$CYBERWAY_CONTRACTS/cyber.govern/cyber.govern.wasm", "hash":""} | ||
# }, | ||
# {"name": "cyber.stake", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
# "abi": {"path": "$CYBERWAY_CONTRACTS/cyber.stake/cyber.stake.abi", "hash":""}, | ||
# "code": {"path": "$CYBERWAY_CONTRACTS/cyber.stake/cyber.stake.wasm", "hash":""} | ||
# }, | ||
|
||
{"name": "gls.issuer", "owner_key": "INITIAL", "active_key": "INITIAL"}, | ||
{"name": "gls.ctrl", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.ctrl/golos.ctrl.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.ctrl/golos.ctrl.wasm", "hash":""} | ||
}, | ||
{"name": "gls.emit", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.emit/golos.emit.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.emit/golos.emit.wasm", "hash":""} | ||
}, | ||
{"name": "gls.vesting", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.vesting/golos.vesting.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.vesting/golos.vesting.wasm", "hash":""} | ||
}, | ||
{"name": "gls.publish", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.publication/golos.publication.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.publication/golos.publication.wasm", "hash":""} | ||
}, | ||
{"name": "gls.social", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.social/golos.social.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.social/golos.social.wasm", "hash":""} | ||
}, | ||
{"name": "gls.charge", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.charge/golos.charge.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.charge/golos.charge.wasm", "hash":""} | ||
}, | ||
{"name": "gls.referral", "owner_key": "INITIAL", "active_key": "INITIAL", | ||
"abi": {"path": "$GOLOS_CONTRACTS/golos.referral/golos.referral.abi", "hash":""}, | ||
"code": {"path": "$GOLOS_CONTRACTS/golos.referral/golos.referral.wasm", "hash":""} | ||
}, | ||
{"name": "gls.worker", "owner_key": "INITIAL", "active_key": "INITIAL"} | ||
] | ||
} |
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,25 @@ | ||
{ | ||
"initial_timestamp": "${INITIAL_TIMESTAMP}", | ||
"initial_key": "GLS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", | ||
"initial_configuration": { | ||
"max_block_net_usage": 1048576, | ||
"target_block_net_usage_pct": 1000, | ||
"max_transaction_net_usage": 524288, | ||
"base_per_transaction_net_usage": 12, | ||
"net_usage_leeway": 500, | ||
"context_free_discount_net_usage_num": 20, | ||
"context_free_discount_net_usage_den": 100, | ||
"max_block_cpu_usage": 2500000, | ||
"target_block_cpu_usage_pct": 1000, | ||
"max_transaction_cpu_usage": 1800000, | ||
"min_transaction_cpu_usage": 100, | ||
"max_transaction_lifetime": 3600, | ||
"deferred_trx_expiration_window": 600, | ||
"max_transaction_delay": 3888000, | ||
"max_inline_action_size": 4096, | ||
"max_inline_action_depth": 4, | ||
"max_authority_depth": 6 | ||
}, | ||
"initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000", | ||
"genesis_data_hash": "${GENESIS_DATA_HASH}" | ||
} |
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,38 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
|
||
: ${TAG:="latest"} | ||
: ${DEST:="genesis-data-temp"} | ||
: ${GOLOS_STATE:="golos.dat"} | ||
|
||
INITIAL_TIMESTAMP=$(date +"%FT%T.%3N" -d12) | ||
GOLOS_IMAGE=cyberway/golos.contracts:$TAG | ||
GOLOS=golos.genesis | ||
|
||
docker kill $GOLOS || true | ||
docker rm $GOLOS || true | ||
|
||
echo "Create directory $DEST" | ||
[ -d $DEST ] || mkdir $DEST | ||
|
||
echo "Info about images $GOLOS_IMAGE:" | ||
docker image ls $GOLOS_IMAGE | tail -n +2 | ||
|
||
docker run --name $GOLOS cyberway/golos.contracts:$TAG sleep 300 & | ||
sleep 1 | ||
docker ps | ||
docker cp $GOLOS_STATE $GOLOS:/golos.dat | ||
docker cp $GOLOS_STATE.map $GOLOS:/golos.dat.map | ||
|
||
docker exec $GOLOS bash -c \ | ||
'ls -l / /opt/cyberway/bin/ /opt/golos.contracts /opt/golos.contracts/genesis && | ||
sed "s|\${INITIAL_TIMESTAMP}|'$INITIAL_TIMESTAMP'|" /opt/golos.contracts/genesis/genesis.json.tmpl | tee genesis.json && \ | ||
sed "s|\$CYBERWAY_CONTRACTS|$CYBERWAY_CONTRACTS|;s|\$GOLOS_CONTRACTS|$GOLOS_CONTRACTS|; /^#/d" /opt/golos.contracts/genesis/genesis-info.json.tmpl | tee genesis-info.json && \ | ||
/opt/cyberway/bin/create-genesis -g genesis-info.json -o genesis.dat && \ | ||
sed -i "s|\${GENESIS_DATA_HASH}|$(sha256sum genesis.dat | cut -f1 -d" ")|" genesis.json && cat genesis.json' | ||
|
||
docker cp $GOLOS:genesis.dat $DEST/genesis.dat | ||
docker cp $GOLOS:genesis.json $DEST/genesis.json | ||
|
||
docker kill $GOLOS && docker rm $GOLOS |