Upload a Contract Manifest to the Registry with the Command Line
You can use the command line to validate and publish deployment metadata from a selected Hardhat project to contract registry services.
The upload-contract-manifest Hardhat task publishes the project’s upgradeable or immutable contract manifests to configured registry services.
Run the task from the packaged contract project’s root directory after a successful deployment. The task reads deployment manifest files from the project. The following files are the standard locations:
- OpenZeppelin manifest:
.openzeppelin/unknown-<chain-id>.json - ERC-7201 manifest:
.obp-da/.erc7201/deployedContracts-<chain-id>.json - Immutable/Solidity manifest:
.obp-da/.solc/deployedContracts-<chain-id>.json
OZ_MANIFEST_PATH variable to its project-local path.
- Configure registry endpoints. Set the registry endpoint variables for the manifest types that you plan to upload. Use your shell’s secure environment-variable mechanism or the project’s configured Hardhat variable mechanism; do not commit credentials or private endpoints to source control. For example, a one-time shell invocation can provide the values to the task, as shown in the following example.
For an Oracle Blockchain Platform environment, also provide the target chain information and the RPC proxy authorization token required by your project configuration.ERC7201_MANIFEST_UPLOAD_REGISTRY_ENDPOINT="https://registry.example/erc7201" \ SOLC_UPLOAD_REGISTRY_ENDPOINT="https://registry.example/solc" \ npx hardhat upload-contract-manifest --mode all
The endpoint values are explicit configuration. Do not assume that a registry URL can be derived from an Oracle Blockchain Platform host name.BESU_CHAIN_ID="<chain-id>" \ BESU_RPX_PROXY_AUTH_TOKEN="<rpc-proxy-token>" \ ERC7201_MANIFEST_UPLOAD_REGISTRY_ENDPOINT="https://registry.example/erc7201" \ SOLC_UPLOAD_REGISTRY_ENDPOINT="https://registry.example/solc" \ npx hardhat upload-contract-manifest --mode all - Select what to upload by choosing one of the following modes.
The# Upload both applicable manifest types. npx hardhat upload-contract-manifest --mode all # Upload the OpenZeppelin and ERC-7201 manifest content. npx hardhat upload-contract-manifest --mode erc7201 # Upload immutable/Solidity contract manifest content only. npx hardhat upload-contract-manifest --mode immutableallanderc7201modes require theERC7201_MANIFEST_UPLOAD_REGISTRY_ENDPOINTvariable. Theallandimmutablemodes require theSOLC_UPLOAD_REGISTRY_ENDPOINTvariable. For packaged imported projects or digital assets contracts generated by Blockchain App Builder, ERC-7201 mode is sufficient. - Use the
--dry-runoption to validate the selected manifest files and upload configuration without publishing.npx hardhat upload-contract-manifest --mode all --dry-run - After a successful dry run, run the same command without the
--dry-runoption to publish. If your project supports it, set theUPLOAD_CONTRACT_MANIFEST_TIMEOUT_MSvariable to increase the upload timeout and setUPLOAD_CONTRACT_MANIFEST_VERBOSE=truefor additional diagnostic output. Do not include secrets in verbose logs or shared terminal output.
Troubleshooting
| Condition | Resolution |
|---|---|
| Task not found | Confirm that the manifest-upload plug-in is installed, imported by the hardhat.config.ts file, and configured with the upload task.
|
| Required manifest is missing | Deploy to the selected environment first, confirm the chain ID, and check the expected manifest location. For a nonstandard OpenZeppelin manifest, set the OZ_MANIFEST_PATH variable to the correct project-local file.
|
| Registry endpoint is missing or invalid | Provide an http or https endpoint for the mode that you selected. The erc7201 and immutable modes use different endpoint variables.
|
| Oracle Blockchain Platform upload is unauthorized | Verify that the selected Oracle Blockchain Platform environment, and BESU_CHAIN_ID and BESU_RPX_PROXY_AUTH_TOKEN variables are all for the same target environment.
|