Skip to content

Commit da11220

Browse files
authored
feat: devnet support in run-node (#226)
With the introduction of a `devnet` configuration into our cardano-configs image, we can now duplicate the Hydra demo's `prepare-devnet.sh` into our entrypoint to allow easily creating a new local network with a single block producer (this node) network. Hydra: https://github.com/cardano-scaling/hydra Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent 67c57e1 commit da11220

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

bin/run-node

+21-1
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,31 @@ CARDANO_PORT=${CARDANO_PORT:-3001}
4242
CARDANO_RTS_OPTS=${CARDANO_RTS_OPTS:--N2 -A64m -I0 -qg -qb --disable-delayed-os-memory-return}
4343
CARDANO_SOCKET_PATH=${CARDANO_SOCKET_PATH:-/opt/cardano/ipc/socket}
4444
CARDANO_TOPOLOGY=${CARDANO_TOPOLOGY:-${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/topology.json}
45-
# mithril
45+
# mithril and devnet
4646
case ${CARDANO_NETWORK} in
4747
mainnet|preprod) __path=release-${CARDANO_NETWORK} ;;
4848
preview) __path=pre-release-${CARDANO_NETWORK} ;;
4949
sanchonet) __path=testing-${CARDANO_NETWORK} ;;
50+
devnet)
51+
# For devnet, we run as a block producer
52+
CARDANO_BLOCK_PRODUCER=true
53+
CARDANO_SHELLEY_KES_KEY=${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/keys/kes.skey
54+
CARDANO_SHELLEY_VRF_KEY=${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/keys/vrf.skey
55+
CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE=${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/keys/opcert.cert
56+
RESTORE_SNAPSHOT=false
57+
__path=testing-${CARDANO_NETWORK}
58+
# clean up old data
59+
rm -rf ${CARDANO_DATABASE_PATH}/*
60+
# empty topology
61+
echo '{"Producers": []}' > ${CARDANO_TOPOLOGY}
62+
# network start times
63+
sed -i "s/\"startTime\": [0-9]*/\"startTime\" $(date +%s)/" \
64+
${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/byron-genesis.json
65+
sed -i "s/\"systemStart\": \".*\"/\"systemStart\": \"$(date -u +%FT%TZ)\"/" \
66+
${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/shelley-genesis.json
67+
# update permissions on keys
68+
find ${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/keys/ -type f -name \*.skey | xargs chmod 0400
69+
;;
5070
esac
5171
AGGREGATOR_ENDPOINT=${AGGREGATOR_ENDPOINT:-https://aggregator.${__path}.api.mithril.network/aggregator}
5272
GENESIS_VERIFICATION_KEY_PATH=${GENESIS_VERIFICATION_KEY_PATH:-${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/genesis.vkey}

0 commit comments

Comments
 (0)