Contract Deployment
Smart contracts live at packages/blockchain/contracts/*.sol and are deployed with Hardhat. Three target networks are pre-configured:
14.7.1 Deploy commands
The deploy script writes the deployed addresses to deployments/<network>.json. Copy them into your API env (DID_REGISTRY_ADDRESS, SCHEMA_REGISTRY_ADDRESS, etc.) before restarting the API.
14.7.2 Post-deploy steps
- Verify contracts on the explorer (if the ADI explorer supports verification):
npx hardhat verify --network adi_testnet 0xAddr <constructor-args>. - Initialise registries — some registries require an
initialize(adminAddress, ...)call after deployment. Confirm inscripts/deploy.tsthat this is run automatically. 3. Update API env with all five addresses. - Run a smoke test:
curl https://adid.dev/api/v1/didsafter restart should return200.
14.7.3 Upgrade strategy
The contracts use OpenZeppelin’s ReentrancyGuard and access-control patterns; they are not UUPS-upgradeable in the current revision. Upgrades require a redeploy + data migration. Plan:
- Deploy v2 contracts.
- Migrate state via custom script (read events, replay into new registry).
- Update API env atomically.
- Sunset v1 by removing API references; chain state remains historically queryable.
VERIFY: confirm no proxy pattern is in use.