Hello, Everyone!

In previous articles, we mentioned that SKALE-Chains are run in an autonomous manner governed by a series of smart contracts on the Ethereum mainnet. Today, we dive into the functionality provided by this collective of smart contracts that we have dubbed ‘The SKALE Manager’.

Upgradeable Smart Contracts

At SKALE, we recognize that software development is an iterative process requiring major releases, minor releases, patches, hotfixes, etc… As much as we’d like to say that our technology is perfect, our collective experience shipping software has taught us that ‘perfect’ is just an idea. For this reason, we built The SKALE Manager with upgradeability in mind.

We accomplish this with a simple registry contract known as the ContractManager that maps a human-readable identifier (e.g. the contract’s name) to the deployed contract’s address. We import the ContractManager into each of our contracts with external dependencies and reference those dependencies through the registry. This pattern permits us to deploy updates to contracts within the SKALE Manager and update their addresses in one place versus the existing paradigm of updating and deploying all contracts consuming its functionality.

Reading this, one might posit the infeasibility of this pattern due to the fact that the process of updating entries in the registry would cause previous data stored in the smart contracts to be lost. For this reason, we create two smart contracts for each entity in our system — one for business logic and another for data. Business logic contracts depend completely upon their data counterparts for storage, allowing them to be updated without loss of information.

We are still exploring design patterns for upgradeable / persistent data contracts but have found this endeavor to be prohibitively expensive. If you are reading this and have realized a cost effective approach to this engineering problem, we would love to hear from you!

The SKALE Manager

The SKALE Manager business logic contract is the entrypoint to all other smart contracts in the SKALE ecosystem. This contract manages SKALE-Chain creation / destruction, Node creation / destruction, withdrawals, and bounties.

Node Creation

To be added as a node to the system, a prospective node upholding network hardware requirements* must submit a standard network deposit in the form of staked SKALE tokens accompanied by node information such as a human-readable name, ip address, port, and public key. After the request has been committed to Ethereum, the prospective node will be added to the system as ‘full node’ or a ‘fractional node’.

Full nodes will have all of their resources utilized for a single SKALE-Chain while fractional nodes will participate in multiple SKALE-Chains (multitenancy). The assignment of a node to be either full or fractional is dependent upon network usage of each to ensure that demand is met.

After a node is created, it will have a validator group of 21 other nodes in the network randomly assigned to it (leveraging the hash of the current Ethereum block number with the node’s name as the source of randomness). Validators will regularly audit node downtime and latency at predetermined periods (e.g. five minutes) and submit these batched metrics to the SKALEManager contract once for every reward period (e.g. one month).

Note: Prior to MainNet launch, the SKALE Network will be using random number generation based on SKALE BLS implementation for source of randomness for validator assignment.

Node Destruction

When nodes are exiting the network, it is phased in a two-phase-commitment process where nodes declare their exit and wait a finalization period to allow for other nodes to be appointed to their current SKALE-Chains and their current validator set to terminate periodic auditing for the exiting node. After this finalization period (e.g. two months), the node will no longer be active and be allowed the withdraw from the network.

Note: Users can exit their node immediately from the network without any finalization period, but will lose their node’s initial deposit.

SKALE-Chain Creation

Currently, all SKALE-Chains are 16 nodes with SKALE-chain instances on each of the nodes varying in size:

Small SKALE-Chain instances occupy 1/128 of each node’s resources

Medium SKALE-Chain instances occupy 1/16 of each node’s resources

Large SKALE-Chain instances occupy all of each node’s resources

All resources in the network are presently of equal value and the cost for consuming these resources is based upon the size of the chain as well as the lifetime of the chain.

Note: In the future, resources will have dynamic pricing to account for current network conditions / system load.

After a user has submitted a name for the SKALE-Chain, chosen their size, and chosen the length of time for the chain’s existence (lifetime), they will pay a deposit to the SKALEManager. If the name is unique to the network and the deposit is made, the SKALEManager will appoint nodes using the hash of the block number and the hash of the SKALE-Chain name. If there are not ample* resources available in the network to support creation of the desired SKALE-Chain, the transaction will be canceled and the user will be notified.

Note: Ample resources refers to enough free resources in the network such that network participants are not able to deduce which nodes will be assigned to a SKALE-Chain. This means that SKALE ensures that it always has non-trivial amount of its resources in the network unoccupied.

Bounties

Network bounties are issued at regular intervals to nodes in the network and are calculated based upon a node’s average latency and downtime across all SKALE-Chains. At the end of each reward period, the maximum amount of SKALE tokens that a node can receive (e.g. assuming little to no downtime and little latency) is equivalent to the number of inflationary SKALE tokens for that time period divided by their fraction of total utilized network resources for that period.

Learn More

We will be open sourcing our SKALE Manager in the coming months — until then, if you’d like to learn more about our efforts, make sure to join our developer community on Discord and check out our Developer Documentation!

Also, feel free to also check out our Technical Overview and Consensus Overview for a deeper dive into how SKALE works and is able to provide 20,000 TPS.