BlockKeeperLib.sol

Overview

BlockKeeperLib.sol is a Solidity library designed to facilitate the creation and address calculation of various smart contract wallets and related entities within a blockchain system. It provides a collection of functions to compose and build state initialization cells (TvmCell) for different contracts, and to calculate their deterministic blockchain addresses based on the compiled contract code, initialization parameters, and cryptographic hashes.

The contracts involved include block keeper wallets, block manager wallets, epoch-related contracts, proxy lists, BLS key indexes, license contracts, and signer indexes. The library abstracts the encoding of state initialization and code salting logic, enabling standardized and reproducible contract deployment addresses.


Classes and Functions

This library contains only one Solidity library named BlockKeeperLib, which consists exclusively of public functions for calculating addresses, composing state initialization, and building contract code cells for various contract types.


Constant Variables


Wallet Address Calculation and State Initialization

These functions generate state initialization cells and corresponding addresses for block keeper and block manager node wallets.

calculateBlockKeeperWalletAddress

function calculateBlockKeeperWalletAddress(TvmCell code, address root, uint256 pubkey) public returns(address)

composeBlockKeeperWalletStateInit

function composeBlockKeeperWalletStateInit(TvmCell code, address root, uint256 pubkey) public returns(TvmCell)

buildBlockKeeperWalletCode

function buildBlockKeeperWalletCode(TvmCell originalCode, address root) public returns (TvmCell)

Block Manager Wallet Address and Initialization

Functions similar to block keeper wallets but for AckiNackiBlockManagerNodeWallet contracts:

These follow the same contract address calculation and code salting pattern as the Block Keeper Wallet functions.


Block Keeper Pre-Epoch Contracts

These functions manage the pre-epoch contracts which are part of the block keeper system's epoch management.

Parameters:

Implementation Details:


Block Keeper Epoch Contracts

Functions related to epoch contracts that manage block keeper epochs:

Parameters:


Block Keeper Cooler Epoch Contracts

These functions handle cooler epoch contracts, which depend on epoch contracts and pre-epoch contracts.

Unique Aspects:


Block Keeper Epoch Proxy List Contracts

Functions to handle the proxy list contracts related to block keeper epochs:

Implementation Details:


BLS Key Index Contracts

Functions to calculate addresses and state init for BLS key index contracts:

Parameters:

Details:


License Contracts

Functions for license contracts:

Parameters:

Details:


License Block Manager Contracts

Similar to license contracts but for block manager license contracts:


Signer Index Contracts

Functions for signer index contracts:

Parameters:

Details:


Implementation Details and Algorithms


Interaction with Other System Components


Visual Diagram

classDiagram
class BlockKeeperLib {
+string versionLib
+calculateBlockKeeperWalletAddress()
+composeBlockKeeperWalletStateInit()
+buildBlockKeeperWalletCode()
+calculateBlockManagerWalletAddress()
+composeBlockManagerWalletStateInit()
+buildBlockManagerWalletCode()
+calculateBlockKeeperPreEpochAddress()
+composeBlockKeeperPreEpochStateInit()
+buildBlockKeeperPreEpochCode()
+calculateBlockKeeperEpochAddress()
+composeBlockKeeperEpochStateInit()
+buildBlockKeeperEpochCode()
+calculateBlockKeeperCoolerEpochAddress()
+composeBlockKeeperCoolerEpochStateInit()
+buildBlockKeeperCoolerEpochCode()
+calculateBlockKeeperEpochProxyListAddress()
+composeBlockKeeperEpochProxyListStateInit()
+buildBlockKeeperEpochProxyListCode()
+calculateBLSKeyAddress()
+composeBLSKeyStateInit()
+buildBLSKeyCode()
+calculateLicenseAddress()
+composeLicenseStateInit()
+buildLicenseCode()
+calculateLicenseBMAddress()
+composeLicenseBMStateInit()
+buildLicenseBMCode()
+calculateSignerIndexAddress()
+composeSignerIndexStateInit()
+buildSignerIndexCode()
}

References to Related Topics