Quick Start: Running Axon and BlockScan Locally with Docker
Run Axon and it's explorer (BlockScan) locally in Docker containers using docker-compose. Please read the docker-compose
file to learn more about the services:
- Axon node
- BlockScan as the explorer of Axon
- Postgres database
Note: This integration is not ready for production use.
Prerequisites
Before getting started, ensure that you have the following prerequisites installed on your system:
- Docker v20.10+
- Docker-compose 2.x.x+
Run the Services
git clone --depth=1 https://github.com/axonweb3/axon.git
cd axon/devtools/chain
docker-compose up -d
Watch the Logs
To monitor the logs of the running services, use the following command:
docker-compose logs -f --tail 1
This command will display the logs of the services, showing the latest log entries.
chain-axon-1 | [2023-08-25T08:45:29.751879179+00:00 INFO overlord::state::process] Overlord: achieve consensus in height 254, costs 1 round 4.499679ms time
postgres | 2023-08-25 08:43:02.542 UTC [28] LOG: checkpoint complete: wrote 134 buffers (0.8%); 0 WAL file(s) added, 0 removed, 0 recycled; write=13.325 s, sync=0.003 s, total=13.336 s; sync files=34, longest=0.003 s, average=0.001 s; distance=966 kB, estimate=966 kB
blockscan | 2023-08-25T08:45:24.008 application=indexer fetcher=empty_blocks_to_refetch [info] Start sanitizing of empty blocks. Batch size is 100
...
Access the Chain
Use Ethereum JSON-RPC API to interact with the Axon node. For instance, to get the chain ID of the Axon devnet, execute the following cURL command:
# Get the chain ID of the Axon devnet
curl --location --request POST 'http://127.0.0.1:8000' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 42,
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": []
}'
# Result: a JSON response containing the chain ID of the Axon devnet.
{"jsonrpc":"2.0","result":"0x41786f6e","id":42}
# chainId: 0x41786f6e, which is the hexadecimal of ASCII string "Axon"
Access BlockScan
To access the BlockScan explorer, open your browser and visit http://127.0.0.1:4020. This will allow you to explore the Axon blockchain using the BlockScan interface.
You Are Good to Go!
Congratulations! You have successfully set up and run Axon and BlockScan locally in Docker containers. You can now start exploring the Axon blockchain and interacting with the services.
Next Steps: Deploy and Interact with a Solidity Contract