Role: Support Office & Development Team
This step is performed by the Support Office and the Development Team of EBSI.
This guide explains how to register a new contract template in the Trusted Contracts Registry (TCR) so that entities can later deploy proxies of it.
Prerequisites
- Both the development team and support office need direct access to the blockchain.
- Support office needs the
TCR:manageTemplatespolicy in the Trusted Policies Registry (TPR). - The smart contract must include an
initializefunction that can accept multiple parameters, with at least the owner address parameter to transfer ownership to the specified address.
Steps
1. Receive source code and audit
Support office receives:
- Source code of the new smart contract
- Audit report of the contract
2. Deploy implementation and beacon
The development team:
- Deploys the contract to the network
- Deploys an upgradeable beacon contract and sets the previous contract as its implementation
Reference
See the SampleUpgradeableBeacon repository for an example and the code to deploy it.
Note the beacon address for the next step.
3. Register the template
Support office registers the template using the CLI:
Load the keys:
using user ES256K did1 <private-key> <did>Run the add template command:
proxyledger ptr addTemplate <contractName> <version> <beaconAddress> <repoURI> <auditURI> <contractHash> <initSelector> <storageLayoutHash> <isActive>contractName: Name of the contractversion: Version of the contractbeaconAddress: Address of the upgradeable beaconrepoURI: URI to the source code repositoryauditURI: URI to the audit reportcontractHash: Keccak256 hash of the contract bytecodeinitSelector: Selector of the initializer functionstorageLayoutHash: Keccak256 hash of the storage layoutisActive: Whether the template is active (true/false)
4. Authorise the entity to deploy
Support office authorises the entity to deploy new contracts:
proxyledger tpr insertUserAttributes <address> ["TCR:deployProxy"]
where address is the ethereum address of the entity (derived from the secp256k1 key registered in the DID document).
tip
The template is now registered and the entity is authorised to deploy proxies.