Skip to content

Testing Multix with Chopsticks

Andrew Snaith edited this page Nov 27, 2023 · 2 revisions

1. Remove any pre-existing Chopsticks Database Files

Navigate to the root directory and delete the following files if they exist:

db.sqlite
db.sqlite-shm
db.sqlite-wal

2. Environment Configuration

Configure the environments for Chopsticks, Squid, and UI.

/chopsticks-config.yml

Set up chopsticks with your desired network specifics, example:

    endpoint: wss://rococo-rpc.polkadot.io
    mock-signature-host: true
    block: 8012793
    db: ./db.sqlite
    runtime-log-level: 5

    import-storage:
      System:
        Account:
          - - - 5G4Akuy6urEH5akKM3WkeU5BKW8fffnX417nzFAp6EDVbE8Q
            - providers: 1
              data:
                free: '98700000000000000000'
      ParasDisputes:
        $removePrefix: ['disputes']

./squid/.env

example:

DB_PORT=5432
GQL_PORT=4350
SQD_DEBUG=sqd:processor:mapping

#rococo
BLOCK_START=8012793
PREFIX=42
RPC_WS="ws://localhost:8000/"
ARCHIVE_NAME="rococo"
CHAIN_ID='rococo'

./packages/ui/.env

example:

VITE_CHAIN_ID="rococo"
VITE_NETWORK_NAME="rococo"
VITE_WS_PROVIDER="ws://localhost:8000/"
VITE_GRAPHQL_WS_PROVIDER="ws://localhost:4350/graphql"
VITE_GRAPHQL_HTTP_PROVIDER="http://localhost:4350/graphql"

Ensure each is set with the 'block start number' and other necessary parameters.

4. Terminal Setup

Open four new terminal windows.

Start Chopsticks

In the root directory of the project, launch Chopsticks with your configuration by executing:

npx --yes @acala-network/chopsticks@latest --config ./chopsticks-config.yml

Start Squid Indexer

Navigate to the ./squid directory and run the following command:

docker compose down; docker compose up db -d; npm run codegen; npm run typegen; npm run build; npm run db:migrate; node -r dotenv/config lib/main dotenv_config_path=.env

Start GraphQL

In ./squid, execute:

npm run start:graphql-server

Start the UI

Navigate to ./packages/ui and execute:

yarn && yarn start

Select Network

Now that everything is set up, navigate to the locally hosted version of Multix at http://localhost:3333, and select the network Local to connect to your fork