Skip to main content

Configure client

You can use the postchain-client with a dapp backend running on the Chromia network by setting up a connection to the Directory chain. Every blockchain connects to the Directory chain, read more here. Through the Directory chain connection, the client finds all the addresses where your dapp is currently running and establishes a connection encountering the list of addresses.


If you're configuring your client for the public Chromia network, use the following Directory chain node URL as the chromiaD1Url.

const chromiaD1Url = "";

  1. Ensure you have a dapp deployed on the Chromia network. For deployment instructions, see Deploy your dapp to testnet.
  2. In your client code, remove the local key pair configuration and replace it with a secure link to your stored key pair. This ensures the security of your key pair. For more details, see Deploy your dapp to testnet.
//Key pair
const adminPubkey = Buffer.from("<PubkeyLink>", "hex");
const adminPrivkey = Buffer.from("<PrivkeyLink>", "hex");
  1. Specify the URL of a Chromia node running the Directory chain in your client code. If you're connecting to the public Chromia network, use the following URL: const chromiaD1Url = "";

If you're using a different network, replace the value of chromiaD1Url with the appropriate URL.

  1. Establish a connection to the blockchain of your dapp by providing the blockchain RID and the Chromia node URL:
//Connection input
const blockchainRID = "<BlockchainRID>"; //Target Blockchain RID
const chromiaD1Url = "<TargetUrl>"; //Target URL

//Connection setup
const chromiaClient = await pcl.creatClient({
blockchainRID: blockchainRID,
directoryNodeURLPool: chromiaD1Url,

Replace <BlockchainRID> with the actual blockchain RID for your dapp, and <TargetUrl> with the appropriate Chromia node URL.

With these steps, you have successfully configured the postchain-client to work with your dapp backend running on the Chromia network.