Skip to content

Commit

Permalink
Celestia docker compose: several nodes (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig authored Aug 21, 2023
1 parent fd2ff39 commit 708c17b
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 48 deletions.
15 changes: 15 additions & 0 deletions docker/DEMO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


```bash
# Sent to node 2, should fail
target/debug/sov-cli submit-transaction examples/test-data/keys/token_deployer_private_key.json Bank examples/test-data/requests/create_token.json 0 http://127.0.0.1:12346
target/debug/sov-cli publish-batch http://127.0.0.1:12346

# Registering second sequencer
target/debug/sov-cli submit-transaction examples/test-data/keys/token_deployer_private_key.json SequencerRegistry examples/test-data/requests/register_sequencer.json 0 http://127.0.0.1:12345
target/debug/sov-cli publish-batch http://127.0.0.1:12345

# Try on second sequencer again
target/debug/sov-cli submit-transaction examples/test-data/keys/token_deployer_private_key.json Bank examples/test-data/requests/transfer.json 1 http://127.0.0.1:12346
target/debug/sov-cli publish-batch http://127.0.0.1:12346
```
142 changes: 142 additions & 0 deletions docker/docker-compose.celestia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
version: '3'

services:
validator:
container_name: sov-celestia-validator
image: ghcr.io/celestiaorg/celestia-app:v0.13.2
healthcheck:
test: [ "CMD", "curl", "-f", "http://127.0.0.1:26657/block?height=1" ]
interval: 30s
timeout: 10s
retries: 5
environment:
- VALIDATOR_NAME=validator
- KEY_NAME_1=validator
- KEY_NAME_2=node1
- KEY_NAME_3=node2
- CHAIN_ID=test
# - CHAIN_ID=sov-testnet
- CELES_AMOUNT=12300000000000000000000000utia
- STAKING_AMOUNT=1000000000utia
- DEBIAN_FRONTEND=noninteractive
ports:
- "9090:9090"
- "36656:26656"
- "36657:26657"
- "36658:26658"
entrypoint:
- /bin/sh
- -c
- |
apk update -qq && apk add -qq curl && \
/bin/celestia-appd init $$VALIDATOR_NAME --chain-id $$CHAIN_ID && \
if [ ! -f "/root/keyring-test/$$KEY_NAME_1.info" ]; then \
echo "CREATING NEW KEYS" && \
/bin/celestia-appd keys add $$KEY_NAME_1 --keyring-backend test && \
/bin/celestia-appd keys add $$KEY_NAME_2 --keyring-backend test && \
/bin/celestia-appd keys add $$KEY_NAME_3 --keyring-backend test && \
mkdir -p /root/keyring-test && cp /root/.celestia-app/keyring-test/* /root/keyring-test/; \
else \
echo "USING EXISTING KEYS" && \
mkdir -p /root/.celestia-app/keyring-test/ && \
cp /root/keyring-test/* /root/.celestia-app/keyring-test/; \
fi; \
echo "AVAILABLE KEYS:" && \
/bin/celestia-appd keys list --keyring-backend test && \
/bin/celestia-appd add-genesis-account $$KEY_NAME_1 $$CELES_AMOUNT --keyring-backend test && \
/bin/celestia-appd add-genesis-account $$KEY_NAME_2 $$CELES_AMOUNT --keyring-backend test && \
/bin/celestia-appd add-genesis-account $$KEY_NAME_3 $$CELES_AMOUNT --keyring-backend test && \
/bin/celestia-appd gentx $$KEY_NAME_1 $$STAKING_AMOUNT --chain-id $$CHAIN_ID --keyring-backend test --evm-address 0x966e6f22781EF6a6A82BBB4DB3df8E225DfD9488 && \
/bin/celestia-appd collect-gentxs && \
echo "NODE_ID:" && \
/bin/celestia-appd tendermint show-node-id && \
/bin/celestia-appd start --rpc.laddr tcp://0.0.0.0:26657 --proxy_app tcp://0.0.0.0:26658
volumes:
- ./keyring-test:/root/keyring-test/


# cat /root/.celestia-app/config/genesis.json && \

bridge:
image: ghcr.io/celestiaorg/celestia-node:v0.7.1
container_name: sov-celestia-bridge
environment:
- KEY_NAME=validator
- CHAIN_ID=test
- STAKING_AMOUNT=1000000000utia
- DEBIAN_FRONTEND=noninteractive
depends_on:
- validator
ports:
- "26656:26656"
- "26657:26657"
- "26658:26658"
entrypoint:
- /bin/sh
- -c
- |
apt-get -qq update -qq && apt -qq install -y curl jq && rm -rf /var/lib/apt/lists/* && \
sleep 20 && \
until curl http://validator:26657/block?height=1; do echo "Waiting for validator..."; sleep 5; done && \
mkdir -p /bridge/keys/keyring-test/ && cp -r /root/keyring-test/* /bridge/keys/keyring-test/ && \
/celestia bridge init --node.store /bridge && \
until curl http://validator:26657/block?height=1; do echo "Waiting for validator..."; sleep 5; done && \
export GENESIS=$(curl http://validator:26657/block?height=1 | jq '.result.block_id.hash' | tr -d '"') && \
export CELESTIA_CUSTOM="$$CHAIN_ID:$$GENESIS" && \
echo "Starting bridge with option=$$CELESTIA_CUSTOM and key name $$KEY_NAME. API KEY:" && \
/celestia bridge auth admin --node.store /bridge --log.level=ERROR && echo " " && \
echo "$(/celestia bridge auth admin --node.store /bridge --log.level=ERROR)" > /root/keyring-test/bridge_1_key.txt && \
/celestia bridge start --node.store /bridge --gateway --gateway.addr 0.0.0.0 --rpc.addr 0.0.0.0 --core.ip validator --keyring.accname $$KEY_NAME
volumes:
- ./keyring-test:/root/keyring-test

bridge-2:
image: ghcr.io/celestiaorg/celestia-node:v0.7.1
container_name: sov-celestia-bridge-2
environment:
- KEY_NAME=node1
- CHAIN_ID=test
- STAKING_AMOUNT=1000000000utia
- DEBIAN_FRONTEND=noninteractive
depends_on:
- validator
ports:
- "46656:26656"
- "46657:26657"
- "46658:26658"
entrypoint:
- /bin/sh
- -c
- |
apt-get -qq update -qq && apt -qq install -y curl jq && rm -rf /var/lib/apt/lists/* && \
sleep 20 && \
until curl http://validator:26657/block?height=1; do echo "Waiting for validator..."; sleep 5; done && \
mkdir -p /bridge/keys/keyring-test/ && cp -r /root/keyring-test/* /bridge/keys/keyring-test/ && \
/celestia bridge init --node.store /bridge && \
until curl http://validator:26657/block?height=1; do echo "Waiting for validator..."; sleep 5; done && \
export GENESIS=$(curl http://validator:26657/block?height=1 | jq '.result.block_id.hash' | tr -d '"') && \
export CELESTIA_CUSTOM="$$CHAIN_ID:$$GENESIS" && \
echo "Starting bridge with option=$$CELESTIA_CUSTOM and key name $$KEY_NAME. API KEY:" && \
/celestia bridge auth admin --node.store /bridge --log.level=ERROR && echo " " && \
echo "$(/celestia bridge auth admin --node.store /bridge --log.level=ERROR)" > /root/keyring-test/bridge_2_key.txt && \
/celestia bridge start --node.store /bridge --gateway --gateway.addr 0.0.0.0 --rpc.addr 0.0.0.0 --core.ip validator --keyring.accname $$KEY_NAME
volumes:
- ./keyring-test:/root/keyring-test



# TODO:
# * +Create keys only if keyring-test does not exist
# * ~Export validator API key to file. Leftovers - generate rollup_config.toml
# * +Multiple bridges
# * Bridge health-check
# * Timeoutable wait for block_height
# * Quite install script
# * Print genesis.json




# GENESIS=""; CNT=0; MAX=30; while [ "${#GENESIS}" -le 4 -a $CNT -ne $MAX ]; do GENESIS=$(curl -s http://127.0.0.1:26657/block?height=1 | jq '.result.block_id.hash' | tr -d '"'); ((CNT++)); sleep 1; done
# GENESIS=""; CNT=0; MAX=30; while [ "${#GENESIS}" -le 4 -a $CNT -ne $MAX ]; do GENESIS=$(curl -s http://127.0.0.1:26657/block?height=1 | jq '.result.block_id.hash' | tr -d '"'); ((CNT++)); sleep 1; done && \
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNDozOC4wNDYxNzcwMDcgKzAwMDAgVVRDIG09KzAuMDY5MjIxOTE3IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiTW5CSTAxLWp3MlMxd1U5bCJ9.yFz0NVVhsX379F1XQQC69JLmMT5JOFlRUey6_L4XzqUk6qPrdkmy6g.5jY9L2FkpGJ70RU7.Q8hsXaRmXDLw0crcz4lUX1U00Y4Mt52tzXC3_hz6GeXsNJc8zSfZTA9RtCWpbEl4I0-BqYdfS4yjAy39Q86EhxhsmQn7HX5mhJdfXwFTh69-3JNpmNEbWRenSFB1zWuwnfJM0rz-TbA72J0tKu6lsWW9YZNxpUL-Ii6_rTTe-_SVhFbwYqy88z_XnYybnaEFJhPos6wk7gHYz6zsXUYLk0V8TCb08oSstistoXz4KbR7EeePLlw.4xpT0Rk6Bc4LzZrDkq_Q1A
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNDozNy45NzA5NzQ5NjUgKzAwMDAgVVRDIG09KzAuMDY4MTc4MDg1IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiWGh6OTQ1UGhad29xU0JreSJ9.vzf7oKrTeEfCcw5gzPVL2D7aTLkzbZfBcB0W3haILTp5r2MBrV2-iQ.48VwpB_BvhYUFhs4.FwpwIIDrQb6capMXtJYtUNcFMX6jpGwILxweWaaIScQkRT7S3wkQnIg5lrYnh9Dnt_jbkQ3QgdqrdyA5YNMWGYQ2FQbpV1M7YVQJ9VEZXbws6R61SDQQMyfDrWUHkmdrtd-s1F9G4g5wThN3YOUOdgugMxpal5m-X2nUuRqMNzKN3leeYS_xuh5KPzOJ-ohdIISu6LfCg5Kab36ncJoYxfmurDID2B6Yy6NXAv5stQSlirzvWrk._EBC1TTZUhKwFCodNdWCkQ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wNi0wNSAwOToxMTo1My40OTQ4NDQ4MzYgKzAwMDAgVVRDIG09KzExLjAwMzk0NDI1NSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Im1RNi03eFpYYlI5REIzMVIifQ.r8PyyoLcrQqziDGTX3aysFEtR57UyfzmIAMAsuGDz53SgbjMepmqaQ.OqrZtJXHdYE3xp9n.5TMEqd_eyHFTWzcJDzDgcEajOfkN2nHSzJfhDHfGHvk7uu61sZRM1iaqO4-F2nIumILtX1L8j5q31AvtegfZnYCkgqkTi7i1Has-IvFMo6bA1Jj5MYofLWLwoW1A7TCmCN4IEFnoE743Z3xfDidqsXfyp30YTUpnWTxignxUyvcRGO_DFeAFYMOq6rTJMm2nGYDLbxpOO5DtsYNrx13kIDQHw-kU4JMPpPsqFGeb4DapqMCSM2Hu1Atw.2eYgHAYuNe3KMgDWPCItkA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNjo0NC44NzIxOTk2MzUgKzAwMDAgVVRDIG09KzAuMTAwMzM5NDYwIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiWVp2V3E1VEp1UnlCTFVraiJ9.zPIhQ_XLX81N7xjbmnjHAhuiG9Mm6szNmJ-e_sdklGlMPCia_kyi7w.mKDtRZg7cAcqKM9A.tcHEUzMh4UvyZphj1vwnQfLVX-xCzh0NtpEzVF3qF-kduy7uPrkLAYalgoWvqRF9b8l1ku7EmVuMoPEYglWRKCauiMAoBmSvljJJ1hdA3VRkcEtauk56FiFXURgAdb7Noeq56FDJHyGH2QQfUXBaB9hCBB60sDYvb3YWONyvQR8X6vGZ119qSekP05ol9p8VwZNfNujnesv6O_ER3lhDg4ZPmyvgC7Tt2Hh-M628oITCdSCjtoo_scIGCcIVSg.XySLfGathevNdEtK1nzoeg
1 change: 1 addition & 0 deletions docker/keyring-test/my_celes_key.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNjo0NC44NzA4NzQzMDIgKzAwMDAgVVRDIG09KzAuMDk5MDE0MTI2IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoic1l2UnRGQjVPS21mOHBtWiJ9.eJ1kkpI4FjAAJKcKiJAFHrBH1TKOaIHFiPQv_ScKJFHE7xU02LaZ1w.u5eKGvbYWkgINQkg.H4oRpMcC6qi3DimQOfVt2-8gpaN6ru-6SUSMqtOls8HhopQ0M-hpcdJbzK3OAJyLZ_z5WOLVsFXQLTCf6sdjbkAXdlGn2Hps660cxyDnuy3bcoAvYJAyagxrSSZVib0sfdrYYzVVl-VS9wrCe5hvka4LBzEXsFIEoxuQhRqC228W71hniKX1NgKXL87HURjUX42pzNk7SyrvTI30ngeuIQGQ3LecDsW2OKQ2uh3a799RIz1howGmtAIQGnV_xNI2-_RqX1UsM-KUwikNPZXBnLigjtPLLntj6eBTcxyvFznSx75OtxPhRMnNqm0ARYN3Zuqt7wrwVCkrRw_PpwGK331LuTzg02zVjTsM1YMgEn196MFWXM8z25qaPFoZFUFwmhUnCm8SZDjz8nAGybNTw0ZV3TwjyE8e8V4xrM4zNsdXqQgQCcDdPW460XNET2csW4a99VSBXYME2H8Cwv9g.4tmPQ3IF0FxwvRytzqH31g
1 change: 1 addition & 0 deletions docker/keyring-test/node1.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNDozNy45Njk0MDY2MzIgKzAwMDAgVVRDIG09KzAuMDY2NjA5NzUxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiVk1leDU4TEhGN3dDbVJMQyJ9.Kz4IkUEWfsCYc6C27WYHt-jCbiLad1gbPUQIihV8s5Gyl_WLFeWBug.swUUp4n6eURByky1.E3zebuaNE-1M6SNPe0ZDz_zaKpIlMIfU2OtAczY7HTrOh6G4D5cJmS6679ZnhctpmRKKgShFz_3ZxeCgrADEM_qgWw8uhnEsVCQDglw1W2s5NdF8-5E0F8I2Cp22SR9jpJ2Ef3XTt4jHZihW_cX8E3Ra4oSHov4De6v9GD-ThbgTuTSmpSHzeFHI7YKyKzzyqSXuxRyh5TeHg1vcuXjce3wjlwftg6w8E0l9HRSBiIGp6sE4Zi0uKOirkRP2E1_IREIab455zNp7ME0zn1JkzsRP-Y3Wpyyezoj5ua_mGcFKIHy6r9NYNfwjX4Bhd4vXZZB21sZQny1TllS8qAaxCj2pkGFts7aA1lIwzZNAQBdbfvWCFlFygisKkoz6DxG_shpO_oY6YpvMebKQvZsBKitcllz3nsQ7gleTjCNmyZfyP1bnnrTwPLKt8q0.IeMg-RFNJ13NHZIJSMuwxw
1 change: 1 addition & 0 deletions docker/keyring-test/node2.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wOC0xOCAxNToxNDozOC4wNDQ2ODM3MTUgKzAwMDAgVVRDIG09KzAuMDY3NzI4NTg0IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiS1JvakRIUW5YRmdfM19pQyJ9.dj-sZHrMz0a5H1mf8j_VDV1GRQXjOa_HTKlGnkuKrDB4SmS16DSxSw.ODdL_jac1zwFhV1G.fzzpZhyeDEJno_iupe5xOux8thDW_t_4VOKynsEMpgf6GZnQLFaykRtpoHyLv8wwBY4GBVYJKQa7JSm9BTihEMwjUcVhZEh0seRv9hhK6lKJJQ5VV5n4NvzXdgt_scou9hn99z34wZRlEGT0bM-vK577rhX-orr6sGZpFTB-uy2KBSIN60zDOJHBzSnMRj9Euyh_5cVzAqt-PL_OBSNlThZwypTOHqB_4tKcgYTRTVBgYc0XjeAGqmEeqQ6I4dhqyewGjKcsFxaQe7kz1UgQyK5t-b69JmY49wRKB_xYL7Ld8A5fRFRVqE_wKwZ9xwabLzqKaxobm8LZGum7VVdMoIZyJ7DnNVLVrNbwfS5Pt0Fy7d_rKEHH0pbjCz1TeY-BGP1OW1JwIYHh2iR8qr4kQTn0RYnoQSrM_sxNLZG6P8UnTK3LBZKwu0nD6ZY.ZRNFW5_65Qv8L-_dGHllmA
1 change: 1 addition & 0 deletions docker/keyring-test/validator.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wNi0wNSAwOToxMTo1My40NTIyNjg3NTIgKzAwMDAgVVRDIG09KzEwLjk2MTM2ODUwNSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6InpjZDlSZ1NvNHFWZWNoa0MifQ.qGafV2C7i9Zqa3TW_ti874R4FjevWRxqCspsRcOPyM3ZrUwOuSwX2w.6vFFL7LFJgP2LJIC.K9rAuw1qq9wU91AipIb_11LZr7RpQX2s3JJspKMC3hi5ou9aZqCdY2z9AOcSiA7Ynnc-bnoG1dBuysUILGZXas9OGiq7KUgAEEAGENeA3jF3kIQ7VCmrL-OgmsgBj17WT2f9Fr4WskX_5HoQQxxuCmHk70eGdBiZSFYAnII5XMG9skeGyn5I4cwV1NCoU3ZRN5EufuLFGsS4wSk2SgHp2nnegwG-EIDo1W5Ci-GFE2hoNW2vxGVyoc9OCPQllU1f_2WUe7MhW74TfHqqbE_xvvoIdl1vWZYEONmku46O2iu00GuWWLleJGy9XaBrvkOZ-gqB2fXWZAX7fqXwMiKiFidjI5RINeUGBaQjyi0LoGDHQsGXsIZ0xRF1G1Z-NrqwcSTZX63naRMpLq13K0NHA9DRYeFrP_Vi2qO47fNU9Vv-Cmpsr8FmET7FQEN8cq6XG07ZbtNYLlA.m4DGni1Ma4vlfuwXUvEnUw
2 changes: 1 addition & 1 deletion examples/demo-rollup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ start-existing:

start-new:
@echo "Starting new container: $(CONTAINER_NAME)"
docker run -d --name $(CONTAINER_NAME) --platform linux/amd64 -p 26657:26657 -p 26659:26659 -p $(RPC_PORT):$(RPC_PORT) $(IMAGE_NAME)
docker run -d --name $(CONTAINER_NAME) --platform linux/amd64 -p 26657:26657 -p 26659:26659 -p $(RPC_PORT):$(RPC_PORT) -p 9090:9090 $(IMAGE_NAME)

start-container:
@$(MAKE) check-container-running || { $(MAKE) check-container-exists && $(MAKE) start-existing || $(MAKE) start-new; }
Expand Down
79 changes: 32 additions & 47 deletions examples/test-data/requests/register_sequencer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,38 @@
{
"Register": {
"da_address": [
99,
101,
108,
101,
115,
116,
105,
97,
49,
104,
115,
118,
113,
56,
101,
116,
53,
117,
117,
117,
97,
51,
112,
48,
52,
118,
107,
107,
99,
118,
119,
51,
114,
115,
122,
107,
54,
100,
56,
55,
52,
119,
119,
99,
116,
100,
53
13,
5,
25,
31,
28,
30,
5,
27,
20,
6,
29,
10,
14,
29,
20,
12,
22,
13,
19,
1,
0,
11,
9,
15,
23,
13,
14,
1,
9,
27,
9,
14
]
}
}

0 comments on commit 708c17b

Please sign in to comment.