On-Chain Standard Contract Registry

Miguel_LZPF
3 min readAug 13, 2022

Introduction

Now in Ethereum when you deploy a smart contract you have to write down or store the address of this smart contract for each network. Other option is to use ENS (Ethereum Name Service) to assign it a name that is human friendly, but is a bit complicated to understand and use it, and It does not fit in all use cases.

I have been thinking and working on an easy way to have a registry of your own smart contracts as an individual, company or entity in general. I have call it “Standard Contract Registry” or SCR and it is focused on networks with gas price 0, which, right now, are enterprise focused networks or private/pseudo-private networks. The result is a easy to use smart contract that keeps a list of contracts deployed by you, with an assigned name, version and supports upgradeable deployments that use the transparent pattern.

This comes from a personal research project that aims to provide an easy to use On-Blockchain Standard Contract Registry that can be used to manage multiple groups of smart contracts and it’s addresses. The main contract is the ContractRegistry, where the actual records are stored. This contract is supported by an optional ContractDeployer, that makes it easier the deployment and upgrade of upgradeable contracts, all On-Chain using Create2.

Is it needed for anything?

No. You probably don’t need this for anything unless you need to have a trusted registry of contracts that should be shown to others and trusted (main contract). The deployer part of the project is optional and can be done Off-chain without spending any gas.

Why would I want to use this Smart Contract system?

  1. You want to try and learn things
  2. You don’t want to worry about transaction prices and it’s easyer than deploy contracts yourself
  3. You want to have a trusted registry of contracts that should be shown to others and trusted
  4. You just want to be able to do everything possible On-Chain
  5. Web3 applications, no backend solutions etc

Technical Detail

Understanding the architecture

Contract Registry

This is the main contract. You can use this contract alone if you only need to have a trusted registry of contracts. They are stored by the sender that registers them and keeps every version registered forever. The sender that deploys this contract will be the “system” and it will be the one registering the “system contracts” (optional). The Contract Records can ve retrieved by anyone if they know the address. The contract bytecode (deployed bytecode) hash is stored in the contract record so anyone can check if the code deployed is the one supposed to be there.

Contract Deployer

This contract can be used to deploy regular contracts that will be automatically registered in the Contract Registry. It is supposed to be used as a system contract used for everyone.

Upgradeable Deployer

This contract can be used to deploy UPGRADEABLE contracts that will be automatically registered in the Contract Registry. It is a Proxy Admin (TUP) that inherits from the OpenZeppelin library contract. It is supposed to be used as a Proxy Admin so it’s one by user.

--

--