Chain class final
An assembled node behind the uniform propose, justify, submit flow.
- Implemented types
- Available extensions
Properties
- chainId → int
-
The chain id this chain runs.
no setter
-
eventStream
→ Stream<
ChainEvent> -
Available on Chain, provided by the ChainObservability extension
Every event as it happens, on the microtask after the call that caused it. Listening redirects events from the buffer to this broadcast stream until the chain is freed, which closes it.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
The chain height.
no setter
- isReleased → bool
-
Whether the native handle has already been released.
no setterinherited
- pendingCount → int
-
Available on Chain, provided by the ChainRecords extension
Transactions waiting for the next proposal.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addTx(
Uint8List tx) → Uint8List -
Available on Chain, provided by the ChainRecords extension
Queues a signed, encoded transaction for the next proposal after checking it against the chain and the state the earlier queued transactions leave. Returns the txid; throws with the reason otherwise. -
archivedBlock(
int height) → Uint8List -
Available on Chain, provided by the ChainPersistence extension
The archived encoded block atheight. -
archivedCertificate(
int height) → Uint8List -
Available on Chain, provided by the ChainPersistence extension
The commit certificate of the archived block atheight. -
archiveRange(
) → ArchiveRange? -
Available on Chain, provided by the ChainPersistence extension
The archived height range, or null while the archive is empty. -
blueprint(
) → Uint8List - The encoded mixture this chain runs.
-
certify(
Uint8List block) → Uint8List - BFT: this validator's precommit as a commit certificate.
-
childProof(
int childChainId) → Uint8List -
Available on Chain, provided by the ChainRegistry extension
A proof that a child's record is committed by this parent's current subchain root. -
childRecord(
int childChainId) → ChildRecord -
Available on Chain, provided by the ChainRegistry extension
The current record of a child. Throws when this chain has no dynamic policy or the child was never registered. -
childTip(
int childChainId) → Uint8List -
Available on Chain, provided by the ChainSubchains extension
The last anchored header of a child. -
enableArchive(
) → void -
Available on Chain, provided by the ChainPersistence extension
Starts keeping every block this chain commits from now on, with its commit certificate, inside the handle and its snapshots. Throws when the engine is not BFT. -
events(
) → List< ChainEvent> -
Available on Chain, provided by the ChainObservability extension
Events buffered since the last call. Empty while eventStream is live. -
free(
) → void - Releases the native chain.
-
metrics(
) → String -
Available on Chain, provided by the ChainObservability extension
A Prometheus format metrics snapshot: chain height, blocks finalized and rejected, transactions applied. -
metricValues(
) → Map< String, double> -
Available on Chain, provided by the ChainObservability extension
metrics as values keyed by sample name. -
mine(
Uint8List block) → Uint8List - Proof of work: the solved block.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
produceBlock(
int timestamp, {Uint8List justify(Uint8List block)?}) → Uint8List -
Available on Chain, provided by the ChainBlocks extension
Proposes, justifies and applies the next block, returning it.justifydefaults to certify, which is right for a BFT chain whose only validator is this node; pass seal for leader sealed engines. Proof of work submits the mined block itself, so call propose, mine and submit directly there. Throws when the block is refused. -
propose(
int timestamp) → Uint8List - Proposes the next block. Throws when this node may not propose now.
-
proposeAnchored(
int timestamp, List< Uint8List> anchors) → Uint8List -
Available on Chain, provided by the ChainSubchains extension
Proposes the next block anchoring encoded anchors in ascending child id order. Throws on an invalid anchor. -
proposeSubchain(
int timestamp, {List< Uint8List> anchors = const [], List<Uint8List> ops = const []}) → Uint8List -
Available on Chain, provided by the ChainRegistry extension
Proposes the next block carrying encodedanchorsin ascending child id order and signed registryops, applied operations first. Throws with the reason when an anchor or an operation is invalid. -
proveAccount(
Uint8List address) → Uint8List -
Available on Chain, provided by the ChainSubchains extension
A state inclusion proof for an address on this account model chain. -
proveRecord(
Uint8List key) → Uint8List -
Available on Chain, provided by the ChainRecords extension
A state inclusion proof for the record atkey; verify it with AviaryProofs.verifyStateProof and read it with AviaryRecords.recordFromProof. -
pruneArchive(
int height) → int -
Available on Chain, provided by the ChainPersistence extension
Drops archived blocks belowheightand returns how many. -
record(
Uint8List key) → RecordEntry? -
Available on Chain, provided by the ChainRecords extension
The committed record atkey, or null when none exists. -
recordNonce(
Uint8List address) → int -
Available on Chain, provided by the ChainRecords extension
The next nonceaddressmust use, counting queued writes. -
registryCounts(
) → RegistryCounts? -
Available on Chain, provided by the ChainRegistry extension
The registry's sizes and authority epoch, or null when this chain has no dynamic policy. -
scheduleValidators(
List< ValidatorEntry> validators) → void - BFT: schedules a coordinated validator set change that the next proposal announces. Throws when not BFT or malformed.
-
seal(
Uint8List block) → Uint8List - The leader justification for engines that seal; empty otherwise.
-
snapshot(
) → Uint8List -
Available on Chain, provided by the ChainPersistence extension
Everything this chain needs to resume after a restart: the ledger, the receipts of the tip block, the engine's consensus state and, when enabled, the block archive. It holds no secret key and is bound to the genesis hash. Transactions queued for the next proposal are not saved. -
stateRoot(
) → Uint8List - The committed 32 byte state root.
-
subchainHop(
int childChainId) → Uint8List -
Available on Chain, provided by the ChainSubchains extension
A proof hop from this parent's current registry into a child. -
subchainHopV2(
int childChainId) → Uint8List -
Available on Chain, provided by the ChainRegistry extension
A proof hop from this parent's current registry into a child, tagged with its kind in the first byte: 1 for a version 1 policy, 2 for a dynamic policy. -
submit(
Uint8List block, [Uint8List? justification]) → bool -
Verifies
justificationand appliesblockatomically. -
tip(
) → Uint8List -
Available on Chain, provided by the ChainPersistence extension
The current tip header, the genesis header before any block. -
toString(
) → String -
A string representation of this object.
inherited
-
validators(
) → List< ValidatorEntry> - BFT: the validator set in force for the next block.
-
write(
Uint8List secret, Uint8List key, RecordOp op, Uint8List value) → Uint8List -
Available on Chain, provided by the ChainRecords extension
Signs and queues a record write from a 64 byte Ed25519secret; the nonce is taken from the chain, so several writes can be queued at once. -
writeFromStore(
KeyStore store, Uint8List from, Uint8List key, RecordOp op, Uint8List value) → Uint8List -
Available on Chain, provided by the ChainRecords extension
Signs a record write with the key store account atfrom(the secret stays in the engine) and queues it; the nonce comes from the chain.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited