BlockKeeperCoolerContract.abi.json
Overview
This file defines the Application Binary Interface (ABI) version 2.4 for the BlockKeeperCoolerContract, a smart contract designed to manage staking-related operations, licensing, and node reputation within a blockchain network. The contract exposes functions for initialization (constructor), state updates (touch), punitive actions (slash), and retrieval of contract-specific details (getDetails and getVersion). It maintains persistent state fields related to public keys, ownership, licensing, staking, and sequence numbers.
Structure and Key Components
ABI Metadata
ABI version: 2
Version: 2.4
Header: Contains the following standard fields for every message:
pubkey: The public key of the message sender.time: The timestamp of the message.expire: Expiration time for the message validity.
Persistent Fields
These fields represent the contract's internal state and some are initialized during construction (init: true):
Field Name | Type | Initialized | Description |
|---|---|---|---|
|
| Yes | Public key associated with the contract. |
|
| No | Last timestamp recorded in the contract. |
|
| No | Indicates if constructor actions are done. |
|
| Yes | Public key of the contract owner. |
|
| No | Root address linked to the contract. |
|
| Yes | Starting sequence number in the contract lifecycle. |
|
| No | Ending sequence number of a particular contract state. |
|
| No | Owner address of the contract instance. |
|
| No | Stake amount held by the contract owner. |
|
| No | Index identifier for the signer. |
|
| No | List of license tuples with |
Functions
constructor
Purpose: Initializes the contract with the staking parameters, ownership, licensing details, and continuation parameters for contract upgrades or state continuation.
Inputs:
Parameter | Type | Description |
|---|---|---|
|
| Waiting period step for staking or other timing logic. |
|
| Address of the contract owner. |
|
| Root address associated with the contract. |
|
| Index of the signer within a signer list. |
|
| Array of licenses, each with |
|
| Initial stake amount. |
|
| Flag indicating if continuation parameters apply. |
|
| Stake amount to continue from previous state. |
|
| Duration for the epoch continuation. |
|
| Wait step for continuation. |
|
| BLS public key for continuing the contract. |
|
| Signer index for continued state. |
|
| Licenses array for continuation. |
|
| Optional virtual stake for continued state. |
|
| Sum of rewards to continue from previous state. |
|
| IP address of the node. |
|
| Unix timestamp marking contract start. |
|
| Sum of reputation coefficients for continuation. |
|
| Optional node version string. |
|
| Optional slash type for penalization. |
Outputs: None
Usage Example:
constructor(
waitStep,
owner,
root,
signerIndex,
licenses,
stake,
isContinue,
stakeContinue,
epochDurationContinue,
waitStepContinue,
bls_pubkeyContinue,
signerIndexContinue,
licensesContinue,
virtualStakeContinue,
reward_sum_continue,
myIp,
unixtimeStart,
sumReputationCoefContinue,
nodeVersionContinue,
slash_type
);
slash
Purpose: Applies a penalty or slashing action to the contract, typically used in blockchain networks as a punitive measure for misbehavior.
Inputs:
Parameter | Type | Description |
|---|---|---|
|
| Type of slash to apply. |
|
| Indicates if the slash is epoch-based. |
Outputs: None
Usage Example:
slash(slash_type, isFromEpoch);
touch
Purpose: Updates or refreshes the contract state, potentially used to renew timestamps or trigger periodic state updates.
Inputs: None
Outputs: None
Usage Example:
touch();
getDetails
Purpose: Retrieves key details about the current state of the contract.
Inputs: None
Outputs:
Output Name | Type | Description |
|---|---|---|
|
| Public key associated with the contract. |
|
| Root address linked to the contract. |
|
| Sequence number at the start of the contract's lifecycle. |
|
| Sequence number at the finish point. |
|
| Address of the current owner. |
|
| Index of the signer. |
|
| Balance of the NACKL token or relevant staking balance. |
Usage Example:
(pubkey, root, seqNoStart, seqNoFinish, owner, signerIndex, NACKLBalance) = getDetails();
getVersion
Purpose: Returns version information for the contract or the deployed code base.
Inputs: None
Outputs:
Output Name | Type | Description |
|---|---|---|
|
| Primary version string. |
|
| Secondary version string or build metadata. |
Usage Example:
(value0, value1) = getVersion();
Implementation Details and Algorithms
The contract uses tuples to manage licenses, each containing a
num(likely a license identifier or count) and astake(amount associated with the license).Continuation parameters in the constructor allow for migration or upgrade paths, preserving previous staking and licensing states.
The
slashfunction supports different slash types and can be triggered from epoch-based events or other contexts, which suggests integration with a time-based or event-based validator punishment mechanism.Sequence numbers (
_seqNoStartand_seqNoFinish) probably track the lifecycle or versioning of the contract state.The contract maintains both public keys and owner addresses, distinguishing between cryptographic identity and ownership.
Interactions with Other System Components
Owner and Root Addresses: The contract interacts with addresses representing the owner and root, possibly linking to identity management or hierarchical control contracts.
Licenses and Stakes: License tuples and stake amounts indicate integration with staking or licensing subsystems, likely used for node validation or service authorization.
Slashing Mechanism: The
slashfunction implies interaction with network consensus or reputation modules that enforce penalties.Versioning and Continuation: The contract supports continuation states and versioning, implying it collaborates with upgrade or migration tools in the system.
IP Address Field (
myIp): Used to register or confirm node network information, connecting to network-level components.
Diagram: Contract Structure and Function Relationships
flowchart TD
constructor -->|initializes| _pubkey
constructor --> _owner_pubkey
constructor --> _licenses
constructor --> _stake
constructor --> _seqNoStart
constructor --> other_fields
slash -->|penalizes| _stake
slash -->|updates| _constructorFlag
touch -->|updates| _timestamp
getDetails -->|reads| _pubkey
getDetails --> _root
getDetails --> _seqNoStart
getDetails --> _seqNoFinish
getDetails --> _owner
getDetails --> _signerIndex
getDetails --> NACKLBalance
getVersion -->|returns| version_strings
subgraph Persistent Fields
_pubkey
_timestamp
_constructorFlag
_owner_pubkey
_root
_seqNoStart
_seqNoFinish
_owner
_stake
_signerIndex
_licenses
end
This flowchart illustrates the initialization of persistent fields via the constructor, the state updates triggered by slash and touch, and data retrieval by getDetails and getVersion. It highlights the flow of contract state changes and data queries.
For further reference on data types and smart contract design patterns, see Smart Contract Data Types and Contract Upgrade Patterns. For understanding slashing mechanisms in blockchain networks, refer to Slashing and Punishment Mechanisms.