Spin up a lightweight Mina network within the single container.
50K+
These Docker images provide a simple and efficient way to deploy and run lightweight Mina blockchain networks for testing purposes. It is an implementation of the Dockerization of Mina local networks RFC.
Each Docker image is packaged with the genesis ledger configuration with more than 1000 prefunded accounts. Each account has a balance of 1550 MINA.
8080 that is served by the NGINX reverse proxy with proper cross-origin resource sharing (CORS) management and passes requests to an available Mina Daemon GraphQL endpoint.http://127.0.0.1:8080/graphql to communicate with the Mina GraphQL endpoint.By default, containers run the Mina Archive Node along with the PostgreSQL RDBMS that stores the blockchain data.
To prevent the Mina Archive Node and RDBMS from running in the container, set the RUN_ARCHIVE_NODE environment variable to false.
docker run ... --env RUN_ARCHIVE_NODE="false" ...
Connection to the container's PostgreSQL can be used for other needs, including the Archive-Node-API.
The default PostgreSQL connection string is:
postgresql://postgres:[email protected]:5432/archive
If no Mina Archive Node will run inside the container, then Archive-Node-API won't be available.
The Mina accounts manager helper tool, provided with the Docker images, automates how users retrieve account information.
An example use case this application is parallel automated tests execution against the lightweight Mina network.
To keep the accounts pool available for other tasks, be sure to release used accounts after you've done with your work.
Before the Mina network can be used in your job or jobs steps, it must reach the synchronized state after the corresponding service container startup. You can use the wait-for-mina-network GitHub Action to automate this process.
docker run --rm --pull=always -it \
--env NETWORK_TYPE="single-node" \
--env PROOF_LEVEL="none" \
--env LOG_LEVEL="Info" \
--env RUN_ARCHIVE_NODE="true" \
--env SLOT_TIME="20000" \
-p 3085:3085 \
-p 5432:5432 \
-p 8080:8080 \
-p 8181:8181 \
-p 8282:8282 \
o1labs/mina-local-network:compatible-latest-lightnet
By default, logs produced by different processes will be redirected into the files located by the following path pattern inside the container:
/root/logs/*.log
You can always use Docker Volumes to map the corresponding logs storage path inside the container to the host machine.
docker run ... --mount "type=bind,source=/tmp,dst=/root/logs" ...
It is especially useful if you want to keep the logs after the container is stopped and deleted. For example when used in CI/CD pipelines.
...
jobs:
my-job:
...
services:
mina-local-network:
image: o1labs/mina-local-network:compatible-latest-lightnet
env:
NETWORK_TYPE: 'single-node'
PROOF_LEVEL: 'none'
LOG_LEVEL: 'Info'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
- 8282:8282
volumes:
- /tmp:/root/logs
...
steps:
- name: Wait for Mina Network readiness
uses: o1-labs/wait-for-mina-network-action@v1
with:
mina-graphql-port: 8080
...
- name: Upload Mina logs
uses: actions/upload-artifact@v3
with:
if-no-files-found: ignore
name: mina-logs
path: /tmp/*.log
retention-days: 5
+-------------------+ +-------------------+
| | | |
| Mina | | NGINX |
| multi-purpose | | Reverse Proxy |
| Daemon | | |
| | | |
+-------------------+ +-------------------+
+-------------------+ +-------------------+
| | | |
| PostgreSQL | | Mina Accounts |
| RDBMS (optional) | | Manager |
| | | |
+-------------------+ +-------------------+
+-------------------+ +-------------------+
| | | |
| Archive-Node-API | | Mina Archive |
| (optional) | | Node (optional) |
| | | |
+-------------------+ +-------------------+
Where:
docker run --rm --pull=always -it \
--env NETWORK_TYPE="multi-node" \
--env PROOF_LEVEL="none" \
--env LOG_LEVEL="Info" \
--env RUN_ARCHIVE_NODE="true" \
--env SLOT_TIME="20000" \
-p 4001:4001 \
-p 4006:4006 \
-p 5001:5001 \
-p 5432:5432 \
-p 6001:6001 \
-p 8080:8080 \
-p 8181:8181 \
-p 8282:8282 \
o1labs/mina-local-network:compatible-latest-lightnet
By default, logs produced by different processes will be redirected into the files located by the following path patterns inside the container:
/root/logs/*.log
/root/.mina-network/mina-local-network-2-1-1/**/logs/*.log
+-------------------+ +-------------------+
| | | |
| NGINX | | Mina |
| Reverse Proxy | | Seed node 1 |
| | | |
+-------------------+ +-------------------+
+-------------------+ +-------------------+ +-------------------+
| | | | | |
| Mina | | Mina | | Mina |
| Block producer | | Block producer | | Block producer |
| Whale 1 | | Whale 2 | | Fish 1 |
| | | | | |
+-------------------+ +-------------------+ +-------------------+
+-------------------+ +--------------------+ +-------------------+
| | | | | |
| Mina | | Mina | | Mina |
| Non BP | | Snark coordinator | | Snark worker |
| Node 1 | | | | |
| | | | | |
+-------------------+ +--------------------+ +-------------------+
+-------------------+ +-------------------+
| | | |
| PostgreSQL | | Mina Accounts |
| RDBMS (optional) | | Manager |
| | | |
+-------------------+ +-------------------+
+-------------------+ +-------------------+
| | | |
| Archive-Node-API | | Mina Archive |
| (optional) | | Node (optional) |
| | | |
+-------------------+ +-------------------+
Where:
Several image tags are available for download like:
compatible-latest-lightnetwhere:
compatible prefix corresponds to the Mina GitHub repository branchlightnet suffix corresponds to the Dune profile that was used during the application build procedure for current image tagThe Mina accounts manager that runs inside the container provides the following API:
-----------------------------
.:: Mina Accounts-Manager ::.
-----------------------------
Application initialized and is running at: http://127.0.0.1:8181
Available endpoints:
HTTP GET:
http://127.0.0.1:8181/acquire-account
Supported Query params:
isRegularAccount=<boolean>, default: true
Useful if you need to get non-zkApp account.
unlockAccount=<boolean>, default: false
Useful if you need to get unlocked account.
Returns JSON account key-pair:
{ pk:"", sk:"" }
HTTP PUT:
http://127.0.0.1:8181/release-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
HTTP GET:
http://127.0.0.1:8181/list-acquired-accounts
Returns JSON list of acquired accounts key-pairs:
[ { pk:"", sk:"" }, ... ]
HTTP PUT:
http://127.0.0.1:8383/lock-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
HTTP PUT:
http://127.0.0.1:8181/unlock-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
Operating with:
Mina Genesis ledger: /root/.mina-network/mina-local-network-2-1-1/daemon.json
Mina GraphQL endpoint: http://127.0.0.1:8080/graphql
Content type
Image
Digest
sha256:682404129…
Size
845.5 MB
Last updated
3 months ago
docker pull o1labs/mina-local-network:mesa-rc2-lightnet