BLSKeyIndex.sol

Overview

BLSKeyIndex.sol defines the BLSKeyIndex smart contract, which manages the indexing and acceptance process of BLS (Boneh–Lynn–Shacham) public keys associated with wallets in a blockchain system. This contract facilitates communication with the root contract BlockKeeperContractRoot to verify and confirm BLS key acceptance statuses, maintains internal readiness state, and controls its lifecycle through destruction methods.

The contract enforces strict access control via the Modifiers contract, ensuring only authorized entities (notably the root contract or the wallet) can invoke sensitive functions. It also manages contract balance to ensure sufficient funds for operations.


Contract: BLSKeyIndex

State Variables

Variable

Type

Description

version

string

Constant string indicating the contract version ("1.0.0").

_root

address

Static address of the root contract that deploys this contract.

_bls

bytes

Static bytes representing the BLS public key associated with this contract.

_wallet

address

Address of the wallet associated with this BLS key.

_ready

bool

Internal flag indicating whether the BLS key is ready (accepted).


Constructor

constructor(address wallet) senderIs(_root) accept

Private Function: ensureBalance

function ensureBalance() private pure

Public Functions

isBLSKeyAccept

function isBLSKeyAccept(
    address wallet,
    uint16 signerIndex,
    uint256 pubkey,
    uint128 rep_coef,
    uint128 stake,
    optional(uint128) virtualStake,
    mapping(uint8 => string) ProxyList,
    string myIp,
    optional(string) nodeVersion
) public senderIs(_root) accept

isBLSKeyAcceptContinue

function isBLSKeyAcceptContinue(
    address wallet,
    uint16 signerIndex,
    uint256 pubkey,
    uint64 seqNoStartOld,
    uint128 stake,
    optional(uint128) virtualStake,
    mapping(uint8 => string) ProxyList,
    uint128 sumReputationCoef,
    optional(string) nodeVersion
) public senderIs(_root) accept

destroyRoot

function destroyRoot() public senderIs(_root) accept

destroy

function destroy() public senderIs(_wallet) accept

View Functions

getReadyStatus

function getReadyStatus() external view returns(bool ready)

getVersion

function getVersion() external pure returns(string, string)

Implementation Details and Algorithms


Interactions with Other Contracts


Diagram: Contract Structure and Function Relationships

classDiagram
class BLSKeyIndex {
-string version = "1.0.0"
-address _root
-bytes _bls
-address _wallet
-bool _ready
+constructor(wallet)
-ensureBalance()
+isBLSKeyAccept()
+isBLSKeyAcceptContinue()
+destroyRoot()
+destroy()
+getReadyStatus() bool
+getVersion() (string, string)
}
BLSKeyIndex ..|> Modifiers
BLSKeyIndex --> BlockKeeperContractRoot : calls isBLSAccepted/isBLSAcceptedContinue
BLSKeyIndex --> gosh.mintshellq : calls for minting

This diagram summarizes the contract's internal properties, key functions, inheritance from Modifiers, and external contract interactions.