Skip to main content

Energi Core FAQ

How are Energi governance contracts created, managed and upgraded?

First version Energi smart contracts were governance related mostly and were deployed in genesis block N1 where all the implementations existed. The upgrade process, along with normal calls, goes through their associated proxy contract. Each Energi smart contract has its own ProxyContract that is responsible for moving the current implementation of the actual contract to a new version (when needed) or making actual calls through ProxyContract to the actual contract.

What does the Energi contract upgrade process look like?

When a new version of a masternode contract is created, it’s deployed on a specific address. As each Energi smart contract implements GovernedContract interface, they have specific migrate/destroy functions overridden that help the associated proxy to move internal storage address to new implementation (when necessary) and destroy old data if needed. After data movement proxy ‘impl’ state variable new “points” to new contract version address and all the calls go to new version contract.

What are block reward distribution contracts and how do they work?

There are four parts in block reward distribution upon creating a new block. The reward goes to four entities/associated contracts: backbone contract, masternode contract, staker contract, and treasury. Depending on having a superblock or not the amounts are first determined and then transferred to those contract addresses as rewards. In the case of staker, when we transfer to stakerReward contract address it simply transfers coins to coinbase address for a given block which corresponds to current staker receiving reward.

What is a checkpoint registry? How does it work?

Dynamic checkpoint registry contract is used during blockchain split for network reconciliation. To find the correct block. The nodes internally check checkpoint contract events and validate locally if the proposed checkpoint is valid for the chain or not.

What is the function of MasternodeRegistry and how masternodes govern?

MasternodeRegistry simply registers masternodes (with specific identifier token enode) that requires them to “prove” they are alive by sending zero-fee heartbeat transactions. When validated, they can participate in the governance system by voting for specific proposals.

How are new proposals created and accepted?

As validated masternodes can vote, there are specific types of contracts that implement IProposal interface which can receive votes by masternodes about their decision if the proposal should be accepted (or implemented) by the network.

How hardforkRegistry works?

It’s similar to checkpoint registry in the sense that when new hard forks are registered they are notified to users through the log system that a new hard fork version is coming and might need a software update. As in case of checkpoint registry core nodes automatically checks for new hard forks and notifies users.

What version of PoS does Core Node use for consensus mechanism?

V3 is the closest current PoS implementation for Energi Core Node. It diverges a little from general PoS algorithm specifications, for instance there is no coin age (but there is maturity period concept). Other than that, the overall algorithm implementation follows standard PoS steps.

How does a node stake or create a new block?

For staking core nodes, the mining process starts with retrieving balances for the current account and tries to mine/claim a new block if the specific hash difficulty is satisfied by the current address/balance and time parameters. As for addresses, the algorithm takes into consideration the maturity period of the balance and the amount it stakes (higher amount, higher weight/probability of creating new block).

How is the new block creation time target calculated?

As the core node has a new implementation for calculating the new block mining target time the V2 version implements the Exponential Moving Average in calculating the block target time it attempts to update previous block time target values if parent blockhash changes.

How are premining blocks prevented in PoS?

This process is prevented by the function calcPoSModifier which adds uncertainty for mining core nodes not to be able to premine blocks which would compromise network consensus.

How to calculate the number of confirmations?





What does importing the preimage database achieve?

Preimage database contains simple key-value pairs where value is the address and key represents its hash. When there is damage in the database, exporting and importing corrects corresponding hashes but in some cases the damaged database doesn't contain the key that had to be present before this operation. This is the reason why we need to import the correct preimage database from good nodes to finally have all the keys and corresponding hashes in the database.