System Contracts

System contracts are the Energy Web Chain's smart contracts that implement OpenEthereum's protocols for Aura Proof-of-Authority consensus mechanism.

Energy Web's smart contracts are open-sourced, and you can see them on github here.

Implementing Client Protocol

System contracts are the Energy Web Chain’s smart contracts that implement OpenEthereum’s permissioning protocols. These protocols determine what actions can be taken on the network.

In order to adhere to the expected protocol, the Energy Web Chain’s system contracts must implement the interfaces that are expected by the AuRa consensus engine, so that it can conform to the client’s protocols.

Let’s take OpenEthereum's Validator-Set contract as an example.

The OpenEthereum documentation specifies that “A simple validator contract has to have the following interface”

[
    {
        "constant": false,
        "inputs": [],
        "name": "finalizeChange",
        "outputs": [],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "getValidators",
        "outputs": [
            {
                "name": "_validators",
                "type": "address[]"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "name": "_parent_hash",
                "type": "bytes32"
            },
            {
                "indexed": false,
                "name": "_new_set",
                "type": "address[]"
            }
        ],
        "name": "InitiateChange",
        "type": "event"
    }
]

Now let’s look at Energy Web’s ValidatorSetRelay smart contract.

You can see that this smart contract implements all of the functions of the Validator-Set protocol interface that was specified above.

Energy Web System Contracts

Last updated