Contract Registry Microservice

Goal

The Contract-Registry microservice will allow us to:

  • Keep versioning of the smart-contracts and to easily deploy them;
  • Decode logs (events) of transactions associated to these smart-contracts and similar ones; and to
  • Read smart-contract’s states on chain using their ABIs.

Function

The Contract-Registry is an Orchestrate microservice responsible, as it name indicates, of keeping a registry of the smart-contracts instanced through Orchestrate.

The Contract-Registry will store the following information:

  • Reference, composed of:
    • Name: name as an identifier;
    • Tag: tag as the version;
  • Artifact, composed of the following elements:
    • Smart-Contract’s Application Binary Interface (ABI);
    • Smart-Contract’s ByteCode (used to deploy smart-contracts);
    • Smart-Contract’s DeployedByteCode (used to keep track of smart-contracts deployed on-chain).

There are two ways for a Smart-Contract to be listed on the Contract-Registry:

  1. Automatically: Publishing to the registry during continuous integration pipelines;
  2. Manually: Developers can interact with the Contract-Registry through the following methods:
    • RegisterContract: to upload a smart-contract specifying a name, a tag to version the contract, and its corresponding ABIs, bytecode, and DeployedBytecode;
    • GetContractABI: to retrieve ABI of a smart-contract;
    • GetContractBytecode: to retrieve Bytecode of a smart-contract;
    • GetContractDeployedBytecode: to retrieve DeployedBytecode of a smart-contract;
    • GetCatalog: to retrieve the whole catalog of smart-contracts on the registry;
    • GetTags: to retrieve the tags associated to one specific smart-contract;
    • DeregisterContract: to remove the reference to an smart-contract from the registry, but keeping the Artifact; and
    • DeleteArtifact: used to delete the Artifact (ABI + bytecode + DeployedBytecode) but not the reference on the Contract-Registry. We recommend to use this method only in exceptional cases-.

Note

The Contract-Registry is accessible through the SDK, via calls to the GRPC and will be soon accessible through REST API server.