Step 2: Access Chromia's economy chain
To access Chromia's economy chain, you have two primary options depending on your requirements and technical capabilities. These options cater to different levels of control, reliability, and infrastructure needs, allowing you to choose the best fit for your integration goals.
Use public system nodes
For a quick and easy connection, you can use any of the publicly available system nodes. These nodes provide reliable access to the economy chain without the need to host your own infrastructure. To connect, you can find the economy chain BRID and a list of public nodes on the Chromia explorer.
Set up your own replica node
For greater control and security, setting up a private replica node is the recommended approach. Hosting your own node provides better reliability and flexibility, with a detailed guide available to help you through hardware requirements, configuration steps, and troubleshooting tips.
- Add provider:
To register a node in the network, you must possess an identity of any tier and provide your public key to your Chromaway contact. Please reach out to us so we can manually add you as a verified provider and link your node to the system.
- Download genesis config:
Create a directory called system_chains
in your working directory and download the genesis configuration file for the
management chain.
curl -s https://system.chromaway.com:7740/config/7E5BE539EF62E48DDA7035867E67734A70833A69D2F162C457282C319AA58AE4?height=0 > system_chains/dc.xml
- Start PostgreSQL:
Visit this page to set up a PostgreSQL database.
- Configure the node:
Create two folders in your working directory: logs and node_config. These folders will be mounted to the node. Inside the node_config folder, add a node.properties file with the following structure. Generate messaging.privkey and messaging.pubkey using the command.
pmc keygen -n -s node_identity
Fill out the file with the following fields:
- messaging.privkey
- messaging.pubkey
- database.password
A detailed description of all available node properties can be found on this page.
# Postchain configuration
messaging.privkey= <node privkey -- different from the provider privkey from step 1>
messaging.pubkey= <node pubkey -- different from the provider pubkey from step 1>
messaging.port=9870
genesis.pubkey=037434C8D4F2B7B7DE44E80486A814676DC3D898FD4488E10E1940B1C4C5837200
genesis.host=system.chromaway.com
genesis.port=9870
api.port=7740
database.driverclass=org.postgresql.Driver
database.username=postchain
database.password=<password from step 3>
database.url=jdbc:postgresql://172.17.0.1:5432/postchain
database.schema=postchain0
infrastructure=net.postchain.d1.D1InfrastructureFactory
api.enable_tls=false
metrics.prometheus.port=9190
configuration.provider.node=managed
container.postgres_max_locks_per_transaction=1024
database.blockBuilderWriteConcurrency=100
database.readConcurrency=100
- Start the node:
Use Docker to start the node.
docker run --name postchain \
--volume /var/run/docker.sock:/var/run/docker.sock \
--mount type=bind,source="$(pwd)/node_config",target=/config,readonly \
--mount type=bind,source="$(pwd)/logs",target=/opt/chromaway/postchain/logs \
-e POSTCHAIN_DEBUG=true \
-p 9874:9870/tcp \
-p 9884:9881/tcp \
-p 7744:7740/tcp \
-p 7754:7750/tcp \
-p 50055:50051/tcp \
registry.gitlab.com/chromaway/postchain-chromia/chromaway/chromia-server:3.22.5 \
run-server --node-config /config/node.properties
You can find the latest version of chromia-server
here.
- Register node:
Register your node as a replica.
pmc node register-replica --pubkey <value of messaging.pubkey in the properties file>
- Start the management chain:
Start the management chain to sync with the target network.
docker run --rm \
--mount type=bind,source="$(pwd)"/system_chains/,target=/opt/chromaway/postchain/system_chains,readonly \
registry.gitlab.com/chromaway/postchain-chromia/chromaway/chromia-server:3.22.5 \
admin blockchain initialize -t 172.17.0.1:50055 -cid 0 -bc ./system_chains/dc.xml
- Add replication of other chains:
Adding replication for additional chains is a critical step, but it can only be performed after your node has fully synchronized with the system chains in the previous step. This ensures the node is correctly integrated with the network.
To confirm synchronization, compare the block heights of the following chains using a block explorer or a local curl command:
- Management chain: 15C0CA99BEE60A3B23829968771C50E491BD00D2E3AE448580CD48A8D71E7BBA
- System anchoring chain: B497391373BB74944193205EB37C84B0520D474F491E2EF4743F16F670DB289B
curl http://localhost:7754/_debug
To replicate a specific chain, use the following command:
pmc blockchain replica add -brid <Target chain brid> --pubkey <value of messaging.pubkey in the properties file>
To find the BRID of the required chain, visit the Chromia explorer.
To stop or start the node gracefully:
docker run --rm \
registry.gitlab.com/chromaway/postchain-chromia/chromaway/chromia-server:3.19.6 \
admin blockchain start -t 172.17.0.1:50055 -cid 0