Skip to content

Commit

Permalink
feat: doccker environment for chopsticks and compose to spawn 4 chops…
Browse files Browse the repository at this point in the history
…ticks instances in parallel looking at different RPCs
  • Loading branch information
Vovke committed Oct 9, 2024
1 parent feac239 commit 729e3d2
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 4 deletions.
14 changes: 14 additions & 0 deletions chopsticks/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dockerfile
FROM node:16-alpine

# Set the working directory
WORKDIR /app

# Install Chopsticks
RUN npm install -g @acala-network/chopsticks

# Expose ports for both instances
EXPOSE 8000 8500 9000 9500

# Default command (this will be overridden by docker-compose)
CMD ["chopsticks", "-c", "/app/config.yml", "-p", "9000"]
46 changes: 46 additions & 0 deletions chopsticks/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.8'

services:
chopsticks-polkadot:
build:
context: .
dockerfile: Dockerfile
container_name: chopsticks-polkadot
ports:
- "8000:8000"
volumes:
- ./pd.yml:/app/config.yml
command: ["chopsticks", "-c", "/app/config.yml", "-p", "8000", "--addr", "0.0.0.0"]

chopsticks-polkadot-2:
build:
context: .
dockerfile: Dockerfile
container_name: chopsticks-polkadot-2
ports:
- "8500:8500"
volumes:
- ./pd-2.yml:/app/config.yml
command: [ "chopsticks", "-c", "/app/config.yml", "-p", "8500", "--addr", "0.0.0.0" ]

chopsticks-statemint:
build:
context: .
dockerfile: Dockerfile
container_name: chopsticks-statemint
ports:
- "9000:9000"
volumes:
- ./pd-ah.yml:/app/config.yml
command: ["chopsticks", "-c", "/app/config.yml", "-p", "9000", "--addr", "0.0.0.0"]

chopsticks-statemint-2:
build:
context: .
dockerfile: Dockerfile
container_name: chopsticks-statemint-2
ports:
- "9500:9500"
volumes:
- ./pd-ah-2.yml:/app/config.yml
command: [ "chopsticks", "-c", "/app/config.yml", "-p", "9500", "--addr", "0.0.0.0" ]
11 changes: 11 additions & 0 deletions chopsticks/pd-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
endpoint: wss://1rpc.io/dot

import-storage:
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
15 changes: 15 additions & 0 deletions chopsticks/pd-ah-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
endpoint: wss://statemint-rpc.dwellir.com

import-storage:
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
Assets:
Account:
- [[1984, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], { balance: 1000000000 }]
- [[1337, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], { balance: 1000000000 }]
2 changes: 1 addition & 1 deletion chopsticks/pd-ah.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
endpoint: wss://statemint.api.onfinality.io/public-ws
endpoint: wss://polkadot-asset-hub-rpc.polkadot.io

import-storage:
System:
Expand Down
16 changes: 13 additions & 3 deletions configs/chopsticks.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
account-lifetime = 86400000 # 1 day.
depth = 3600000 # 1 hour.
debug = true
in-memory-db = true

[[chain]]
name = "polkadot"
native-token = "DOT"
decimals = 10
endpoints = [
"ws://localhost:8000",
"ws://localhost:8500",
]

[[chain]]
name = "statemint"
decimals = 6
endpoints = [
"ws://localhost:8000"
"ws://localhost:9000",
"ws://localhost:9500",
]

[[chain.asset]]
name = "USDC"
id = 1337

[[chain.asset]]
name = "USDT"
name = "USDt"
id = 1984

0 comments on commit 729e3d2

Please sign in to comment.