Skip to content

Calldata for Staking #545

@grantkee

Description

@grantkee

Problem

Node operators generate BLS keypairs via the CLI (keytool generate validator), which produces a node-info.yaml containing the BLS public key and proof of possession. To become an active validator, operators must call ConsensusRegistry.stake() on-chain with their BLS key material encoded as ABI calldata.

Currently there is no streamlined way for operators to go from their generated node-info.yaml to the exact calldata required by the stake(bytes blsPubkey, ProofOfPossession proofOfPossession) contract function. Operators would need to manually extract the compressed BLS public key (96 bytes), uncompressed public key (192 bytes), and uncompressed proof of possession signature (96 bytes), then ABI-encode them correctly. This is error-prone and requires knowledge of the contract's encoding expectations.

Solution

Add an export-staking-args subcommand to the CLI keytool that reads node-info.yaml and outputs the staking arguments in usable formats:

  • Human-readable (default): labeled hex values for inspection
  • --json: structured JSON for scripting and automation
  • --calldata: raw ABI-encoded calldata for ConsensusRegistry.stake(), ready to submit as transaction data

The --calldata output can be used directly as the data field in a transaction to ConsensusRegistry with the appropriate stake value attached.

Operator Workflow

# 1. Generate keys
telcoin-network keytool generate validator --datadir /path/to/node --address <execution-address>

# 2. Export calldata for staking
telcoin-network keytool export-staking-args --node-info /path/to/node --calldata

# 3. Submit the calldata as a transaction to ConsensusRegistry.stake() with the required stake value

Acceptance Criteria

  • export-staking-args reads node-info.yaml (by file path or parent directory)
  • --calldata outputs the full ABI-encoded stake() calldata
  • --json outputs structured JSON with the hex-encoded key components
  • Default output shows labeled hex values with byte lengths
  • Output modes are mutually exclusive
  • Command does not require the BLS private key, passphrase, or datadir
  • Public stake_calldata() method is available for programmatic use

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions