Skip to content

Commit

Permalink
Add scripts for 2nd node (#196)
Browse files Browse the repository at this point in the history
Add scripts for second node. Also replace default anvil key with a new
generated key pair for node 100.
  • Loading branch information
mkysel authored Oct 8, 2024
1 parent 42f7d7d commit 0c977d6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
7 changes: 6 additions & 1 deletion dev/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ services:
POSTGRES_PASSWORD: xmtp
ports:
- 8765:5432

db2:
image: postgres:16
environment:
POSTGRES_PASSWORD: xmtp
ports:
- 8766:5432
chain:
platform: linux/amd64
build:
Expand Down
11 changes: 7 additions & 4 deletions dev/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export XMTPD_CONTRACTS_MESSAGES_ADDRESS
XMTPD_CONTRACTS_IDENTITY_UPDATES_ADDRESS="$(jq -r '.deployedTo' build/IdentityUpdates.json)" # Built by contracts/deploy-local
export XMTPD_CONTRACTS_IDENTITY_UPDATES_ADDRESS

# Top Level Options
export XMTPD_SIGNER_PRIVATE_KEY="0x72bf470f711d8252658e3b0832b3e0d92a3ceb2c015b4bebf858ff4646002cfb" # From contracts/.env
export XMTPD_PAYER_PRIVATE_KEY=$PRIVATE_KEY
export XMTPD_MLS_VALIDATION_GRPC_ADDRESS="localhost:60051"
# Top Level Options Default Node
# {"private-key": "0x5742e57f960fbe62d0823b678df466b9e7d6c0c52888eacf3c31c132c645fd34", "public-key": "0x0202fd5e60ea5b9324431ec567a6e2655c4dc7160bba2ee5f8cc07ffc86a28342b"}
export XMTPD_SIGNER_PRIVATE_KEY="0x5742e57f960fbe62d0823b678df466b9e7d6c0c52888eacf3c31c132c645fd34" # From contracts/.env
export XMTPD_PAYER_PRIVATE_KEY=$XMTPD_SIGNER_PRIVATE_KEY
export XMTPD_MLS_VALIDATION_GRPC_ADDRESS="localhost:60051"

export XMTPD_SIGNER_PUBLIC_KEY="0x0202fd5e60ea5b9324431ec567a6e2655c4dc7160bba2ee5f8cc07ffc86a28342b"
2 changes: 1 addition & 1 deletion dev/register-local-node
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dev/cli register-node \
--http-address=http://localhost:5050 \
--owner-address=0xf0490b45884803924Ca84C2051ef435991D7350D \
--admin-private-key=$PRIVATE_KEY \
--signing-key-pub=0x02a4d829952dc9e73d6d4687823e95b3f56fc69736b38158655bbf9fee6d825c81
--signing-key-pub=$XMTPD_SIGNER_PUBLIC_KEY
11 changes: 11 additions & 0 deletions dev/register-local-node-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -eu

. dev/local.env

dev/cli register-node \
--http-address=http://localhost:5051 \
--owner-address=0xf0490b45884803924Ca84C2051ef435991D7350D \
--admin-private-key=$PRIVATE_KEY \
--signing-key-pub=0x03da7f733d870237f6dfd0074aea27edaf7b840d68e88641fb2a687de16bbe6a2b
13 changes: 13 additions & 0 deletions dev/run-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -eu

. dev/local.env

# second node keys
# {"private-key": "0x3c3040ee266ccd22f14c555b71093ea586e46226f1ed8d37cf9fb239d2b4ad79", "public-key": "0x03da7f733d870237f6dfd0074aea27edaf7b840d68e88641fb2a687de16bbe6a2b"}
export XMTPD_SIGNER_PRIVATE_KEY="0x3c3040ee266ccd22f14c555b71093ea586e46226f1ed8d37cf9fb239d2b4ad79"
export XMTPD_PAYER_PRIVATE_KEY=$XMTPD_SIGNER_PRIVATE_KEY
export XMTPD_DB_WRITER_CONNECTION_STRING="postgres://postgres:xmtp@localhost:8766/postgres?sslmode=disable"

go run -ldflags="-X main.Commit=$(git rev-parse HEAD)" cmd/replication/main.go -p 5051 "$@"
3 changes: 2 additions & 1 deletion dev/up
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ if ! which abigen &>/dev/null; then go install github.com/ethereum/go-ethereum/c
dev/generate
dev/docker/up
dev/contracts/deploy-local
dev/register-local-node
dev/register-local-node
dev/register-local-node-2

0 comments on commit 0c977d6

Please sign in to comment.