This guide explains how to add support for a new blockchain network to the BDAG Comet project. Adding a new network requires modifications to the Hardhat configuration and the creation of network-specific deployment files.
The BDAG Comet project supports multiple blockchain networks through a structured deployment system. Each network requires:
- Hardhat Configuration Updates - Network definition and RPC endpoints
- Relations Import - Network-specific contract relationship mappings
- Deployment Structure - Network-specific deployment configurations and scripts
You can find a nice Pull Request that adds support for the BlockDAG-Awakening network here.
Add your new network to the networkConfigs array:
const networkConfigs: NetworkConfig[] = [
// ... existing networks
{
network: 'your-new-network',
chainId: 12345, // Replace with actual chain ID
url: `https://rpc.ankr.com/your-network/${ANKR_KEY}`, // Or custom RPC URL
},
];Add your network to the etherscan.apiKey section:
etherscan: {
customChains: [
// ... existing custom chains
{
network: 'your-new-network',
chainId: 12345,
urls: {
apiURL: 'https://api.yournetwork.com/api',
browserURL: 'https://yournetwork.com/'
}
}
]
}Import your network's relations configuration at the top of the file:
// Add this import with other relation imports
import networkInfraestructureRelationConfigMap from './deployments/your-network/_infraestructure/relations';
import networkAssetRelationConfigMap from './deployments/your-network/your_asset/relations';Add your network to the deploymentManager.networks section:
deploymentManager: {
relationConfigMap,
networks: {
// ... existing networks
'your-new-network': {
'_infraestructure': networkInfraestructureRelationConfigMap,
'your-asset': networkAssetRelationConfigMap
}
}
}Create the following directory structure under deployments/ following the local deployment pattern:
deployments/
└── your-new-network/
├── _infrastructure/
│ ├── aliases.json
│ ├── configuration.json
│ ├── deploy.ts
│ ├── relations.ts
│ └── roots.json
├── your-asset/
│ ├── aliases.json
│ ├── configuration.json
│ ├── deploy.ts
│ ├── relations.ts
│ └── roots.json
Create the infrastructure configuration file for base contracts. See governance-system.md for details.
Copy the infrastructure relations from deployments/local/_infrastructure/relations.ts.
Copy the infrastructure deploy script from deployments/local/_infrastructure/deploy.ts and modify it if needed.
For creating the asset-specific files (configuration.json, relations.ts, deploy.ts, roots.json), see new-market-support.md for detailed instructions.