Skip to main content
European CommissionEBSI European Blockchain

1. Register a new template

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:manageTemplates policy in the Trusted Policies Registry (TPR).
  • The smart contract must include an initialize function 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:

  1. Load the keys:

    using user ES256K did1 <private-key> <did>
  2. Run the add template command:

    proxyledger ptr addTemplate <contractName> <version> <beaconAddress> <repoURI> <auditURI> <contractHash> <initSelector> <storageLayoutHash> <isActive>
    • contractName: Name of the contract
    • version: Version of the contract
    • beaconAddress: Address of the upgradeable beacon
    • repoURI: URI to the source code repository
    • auditURI: URI to the audit report
    • contractHash: Keccak256 hash of the contract bytecode
    • initSelector: Selector of the initializer function
    • storageLayoutHash: Keccak256 hash of the storage layout
    • isActive: 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.