Skip to main content

Step 2: Access Chromia's Economy Chain

To access Chromia's Economy Chain, you have two primary options:

  • Public access: Use publicly available system nodes for a quick and simple connection without hosting your own infrastructure.
  • Private node: Set up and run your own replica node for greater control, security, and reliability.

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.

If you choose this option, you can skip the remaining steps in this section and proceed directly to Step 3.

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.

  1. 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.

pmc keygen --save=".provider_keypair"
  1. Download genesis config:

Create a directory called system_chains in your working directory:

mkdir system_chains

Download the genesis configuration file for the management chain.

curl -s https://system.chromaway.com:7740/config/7E5BE539EF62E48DDA7035867E67734A70833A69D2F162C457282C319AA58AE4?height=0 > system_chains/dc.xml
  1. Start PostgreSQL:

Visit this page to set up a PostgreSQL database.

  1. Configure the node:

Create two folders in your working directory: logs and node_config.

mkdir logs && mkdir node_config

These folders will be mounted to the node. Inside the node_config folder, add a node.properties file with the following structure.

touch node_config/node.properties

Generate messaging.privkey and messaging.pubkey using the command.

pmc keygen -n -s node_identity

Fill out the node.properties 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
api.enable_tls=false

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
database.blockBuilderWriteConcurrency=100
database.readConcurrency=100

infrastructure=net.postchain.d1.D1InfrastructureFactory

metrics.prometheus.port=9190

configuration.provider.node=managed

container.postgres_max_locks_per_transaction=1024
  1. 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.28.2 \
run-server --node-config /config/node.properties

You can find the latest version of chromia-server here.

  1. Register node:

Register your node as a replica.

pmc node register-replica --pubkey <value of messaging.pubkey in the properties file>

Make sure that your .chromia/config includes the following line:

api.url = https://system.chromaway.com:7740

  • Windows: C:\Users\<YourUsername>\.chromia\config
  • macOS and Linux: /Users/<YourUsername>/.chromia/config or /home/<YourUsername>/.chromia/config
  1. 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.28.2 \
admin blockchain initialize -t 172.17.0.1:50055 -cid 0 -bc ./system_chains/dc.xml
  1. 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.25.4 \
admin blockchain start -t 172.17.0.1:50055 -cid 0