Bot and helper scripts for unlocking reserved funds triggered by reaching mint limit.
This bot automatically releases deposits for reserves with id 'depositc' by calling circuitBreaker.releaseDeposit for each one individually (not batched, to keep it free).
In production: Docker secrets are mounted at /run/secrets/account_json For local development: Mount account.json as a volume or pass via secrets
Before running locally, you need to set up your account credentials:
-
Export your account from Polkadot.js extension:
- Open your Polkadot.js extension
- Click on the three dots next to your account
- Select "Export Account"
- Enter your password and download the JSON file
-
Create your local account.json:
# Copy the example file cp account.json.example account.json # Replace the contents with your exported account JSON # (or just rename your exported file to account.json)
-
Note:
account.jsonis gitignored and will never be committed to the repository for security reasons.
You can customize the bot behavior using command-line arguments:
- RPC endpoint (default:
ws://localhost:9999) - Account JSON path (default:
./account.json) - Account password (default:
123456)
Build the image:
docker build -t unlock-deposits-bot .Run the bot (mounting your local account.json):
# Mount your local account.json into the container
docker run -v $(pwd)/account.json:/home/node/bot/account.json \
unlock-deposits-bot \
node release-deposits.js ws://host.docker.internal:9999 ./account.json 123456
# With remote RPC endpoint
docker run -v $(pwd)/account.json:/home/node/bot/account.json \
unlock-deposits-bot \
node release-deposits.js wss://hydration.ibp.network ./account.json 123456Note:
- The
-vflag mounts your localaccount.jsoninto the container - When running a local node, use
ws://host.docker.internal:9999instead ofws://localhost:9999to connect from inside Docker to your host machine - The Docker image does NOT contain account.json for security reasons
Install dependencies:
npm ci --ignore-scriptsRun the script:
# Using defaults
node release-deposits.js
# With custom arguments
node release-deposits.js wss://hydration.ibp.network ./account.json yourpasswordargv[2]: RPC address (default:ws://localhost:9999)argv[3]: Account JSON path (default:./account.json)argv[4]: Account password (default:123456)
# Build and run (runs every 10 minutes automatically)
docker build -t unlock-deposits-bot .
docker run -d --name unlock-deposits-bot \
-v $(pwd)/account.json:/home/node/bot/account.json \
--restart unless-stopped \
unlock-deposits-bot \
./bot-loop.sh ws://host.docker.internal:9999 ./account.json 123456That's it! The bot will now run every 10 minutes forever.
To view logs:
docker logs -f unlock-deposits-botTo stop:
docker stop unlock-deposits-bot
docker rm unlock-deposits-botTo customize RPC endpoint:
docker run -d --name unlock-deposits-bot \
-v $(pwd)/account.json:/home/node/bot/account.json \
--restart unless-stopped \
unlock-deposits-bot \
./bot-loop.sh wss://hydration.ibp.network ./account.json yourpasswordFor production deployments, use Docker Swarm with secrets (see SWARMPIT_DEPLOYMENT.md).
This ensures credentials are encrypted and never stored in the codebase or Docker images.
You can customize the bot behavior using environment variables:
RPC_ENDPOINT: The WebSocket endpoint (default:ws://host.docker.internal:9999)ACCOUNT_JSON: Path to account JSON file (default:./account.json)ACCOUNT_PASSWORD: Password for the account (default:123456)
- Connects to the specified RPC endpoint
- Queries all
Tokens::Reservesentries - Filters for reserves with id
'depositc' - For each matching entry, submits an individual
circuitBreaker.releaseDepositextrinsic - Waits for each transaction to finalize before submitting the next one
- Each call is free (no utility batch fees)