Skip to main content

Types

Reference for the object types @provablehq/veil-core returns from chain reads and record scans. For the account and client types (LocalAccount, RpcAccount, PublicClient, WalletClient), see Wallet Client and Public Client; for the transport types, see Transports.

Wire format

Block, transaction, and record types mirror the Provable REST API's JSON responses field for field. Field names stay snake_caseblock_hash, previous_state_root, finalize_root — rather than being converted to camelCase, so a value copied from a raw HTTP response or from the Aleo explorer matches the property name on the parsed object exactly. Types that originate from the wallet-facing API instead (OwnedRecord, TransactionStatusResponse) use camelCase, matching the Provable wallet standard rather than the node's REST format.

Numeric widths

The rule across @provablehq/veil-core: number represents a u64 or smaller on-chain integer, bigint represents a u128 or larger one. Two kinds of exception exist:

  • Some return types are widened for parity with viem: getBalance and getBlockNumber return bigint even though the underlying values are a u64 and a u32 respectively, matching viem's getBalance/getBlockNumber return types. Convert with Number() before passing a block height into an action that takes one (Number(await client.getBlockNumber())).
  • Some u128 fields arrive as strings on the wire: Metadata.cumulative_weight and Metadata.cumulative_proof_target are u128 values, but JSON numbers cannot losslessly represent a u128, so the node sends them as decimal strings. Wrap with BigInt(...) to use them as numbers.

Transaction status

walletClient.transactionStatus and the block-level ConfirmedTransaction.status field both report a transaction's state as one of four strings:

StatusMeaning
'accepted'Confirmed in a block; the transaction succeeded.
'rejected'Confirmed in a block, but the transaction failed on-chain (e.g. an assertion failed).
'pending'Present in the mempool, not yet confirmed.
'not_found'Absent from both the confirmed and unconfirmed pools — never submitted, dropped, or expired.

Veil never borrows the EVM finality vocabulary for this state; on Aleo, "finalize" names a distinct concept (the on-chain execution of a transaction's mapping writes), not confirmation, and the status strings above are the complete set a caller needs to branch on. See Transaction Lifecycle for polling a transaction through these states.

Block types

import type { Block, Header, Metadata, Ratification, Solutions, Solution, PartialSolution, Finalize, ConfirmedTransaction } from '@provablehq/veil-core'

Block is what client.getBlock({ height }) and client.getBlockNumber() consumers see: the raw shape from the node's GET /{network}/block/{heightOrHash} endpoint.

Block

FieldTypeDescription
block_hashstringHash of this block.
previous_hashstringHash of the preceding block.
headerHeaderMerkle roots and metadata for the block.
authorityRecord<string, unknown>Beacon or quorum authority for the block. Opaque — shape varies by consensus variant.
transactionsConfirmedTransaction[] (optional)Transactions confirmed in this block.
ratificationsRatification[]Protocol-level credit movements (block and puzzle rewards).
solutionsSolutionsPuzzle solutions section.
aborted_solution_idsstring[]Solution ids aborted during this block.
aborted_transaction_idsstring[]Transaction ids aborted during this block.

Header

FieldTypeDescription
previous_state_rootstringState root before this block.
transactions_rootstringMerkle root over the block's transactions.
finalize_rootstringMerkle root over finalize operations.
ratifications_rootstringMerkle root over ratifications.
solutions_rootstringMerkle root over puzzle solutions.
subdag_rootstringMerkle root over the consensus subdag.
metadataMetadataNetwork id, height, round, targets, and timestamps.

Metadata

FieldTypeDescription
networknumberu16 — network id.
roundnumberu64 — consensus round.
heightnumberu32 — block height.
coinbase_targetnumberu64 — coinbase puzzle target.
proof_targetnumberu64 — prover solution target.
last_coinbase_targetnumberu64 — coinbase_target of the most recent coinbase-producing block.
last_coinbase_timestampnumberi64 — unix seconds of the most recent coinbase-producing block.
timestampnumberi64 — unix seconds this block was produced.
cumulative_weightstringu128 — cumulative consensus weight, delivered as a decimal string; wrap with BigInt(...).
cumulative_proof_targetstringu128 — cumulative proof target, delivered as a decimal string for the same reason.

Ratification, PartialSolution, Solution, Solutions

TypeFieldTypeDescription
RatificationtypestringRatification kind, e.g. 'block_reward', 'puzzle_reward'.
Ratificationamountnumberu64 — microcredits moved by this ratification.
PartialSolutionsolution_idstringSolution identifier.
PartialSolutionepoch_hashstringEpoch hash the solution was computed against.
PartialSolutionaddressstringProver's address.
PartialSolutioncounternumberu64 — puzzle nonce.
Solutionpartial_solutionPartialSolutionThe prover-supplied part of the solution.
Solutiontargetnumberu64 — solution target.
Solutionsversionnumberu16 — solutions format version.
SolutionssolutionsSolution[] (optional)Absent when the block has no puzzle solutions.

Finalize

FieldTypeDescription
typestringOperation kind, e.g. 'update_key_value', 'insert_key_value'.
mapping_idstringMapping the operation touched.
key_idstringId of the affected key.
value_idstringId of the resulting value.

ConfirmedTransaction

FieldTypeDescription
statusstring'accepted' or 'rejected'. See Transaction status.
typestring'execute', 'deploy', or 'fee'.
indexnumberu32 — position within the block.
transactionRecord<string, unknown>The raw transaction; parse it as a Transaction (below) for a typed view. Left widened here to avoid a circular import.
finalizeFinalize[]Mapping changes the transaction caused.

Transaction types

import type { Transaction, Transition, Input, Output, Execution, FeeExecution, Deployment, VerifyingKey, Owner } from '@provablehq/veil-core'

Transaction is what client.getTransaction({ id }) returns — the shape from the node's GET /{network}/transaction/{id} endpoint. execution is present on execute transactions, deployment on deploy transactions, matching type.

Transaction

FieldTypeDescription
typestring'execute', 'deploy', or 'fee'.
idstringOn-chain transaction id (at1...).
executionExecution (optional)Present on execute transactions.
deploymentDeployment (optional)Present on deploy transactions.
feeFeeExecutionThe credits.aleo fee transition paid for this transaction.
ownerOwner (optional)Deployer signature; present on deploy transactions.

Execution / FeeExecution

TypeFieldTypeDescription
ExecutiontransitionsTransition[]Program-function calls made by this execution.
Executionglobal_state_rootstringState root the proof was built against.
ExecutionproofstringThe execution proof.
FeeExecutiontransitionTransitionThe single credits.aleo fee transition.
FeeExecutionglobal_state_rootstringState root the fee proof was built against.
FeeExecutionproofstringThe fee proof.

Transition

FieldTypeDescription
idstringTransition id (au1...).
programstringProgram id called.
functionstringFunction/transition name called.
inputsInput[] (optional)Transition inputs.
outputsOutput[] (optional)Transition outputs.
tpkstringTransition public key.
tcmstringTransition commitment.
scmstring (optional)Signer commitment. Present on the wire; not carried by every SDK's transition type.

Input / Output

TypeFieldTypeDescription
InputtypestringVisibility kind: 'public', 'private', 'record', or 'external_record'.
InputidstringInput id.
Inputtagstring (optional)Record tag; present on record inputs.
Inputvaluestring (optional)Plaintext or ciphertext, depending on visibility; absent on record inputs.
Inputdynamic_idstring (optional)Dynamic id; present when the input's record type is resolved via dynamic dispatch.
OutputtypestringVisibility kind: 'public', 'private', 'record', or 'future'.
OutputidstringOutput id.
Outputchecksumstring (optional)Output checksum.
Outputvaluestring (optional)Plaintext or ciphertext value, depending on visibility.
Outputdynamic_idstring (optional)Dynamic id; present when the output's record type is resolved via dynamic dispatch.

Deployment / VerifyingKey / Owner

TypeFieldTypeDescription
Deploymenteditionnumberu16 — deployment edition.
DeploymentprogramstringAleo program source.
Deploymentverifying_keysVerifyingKey[]One entry per program function.
VerifyingKey(tuple)[string, [string, string]][function_name, [vk_hash, certificate]].
OwneraddressstringDeployer's address.
OwnersignaturestringDeployer's signature over the deployment.

Record types

import type { OwnedRecord, OwnedRecordEncrypted, RecordView, RecordStatusFilter, RequestRecordsParameters } from '@provablehq/veil-core'

OwnedRecord and OwnedRecordEncrypted are camelCase, following the wallet-facing API rather than the node's REST wire format — a decrypted record never goes over the node's REST endpoints. See Working with Records for the scanning flow that produces these.

OwnedRecordEncrypted

FieldTypeDescription
programNamestringProgram the record belongs to.
tagstringRecord tag.
blockHeightnumber (optional)Height the record was created at.
blockTimestampnumber (optional)Unix seconds the record was created at.
commitmentstring (optional)Record commitment.
functionNamestring (optional)Function that produced the record.
outputIndexnumber (optional)Position among the producing transition's outputs.
ownerstring (optional)Owner address.
recordCiphertextstring (optional)Encrypted record ciphertext.
recordNamestring (optional)Record type name.
senderstring (optional)Sender address.
spentboolean (optional)Whether the record has been spent.
transactionIdstring (optional)Producing transaction id.
transitionIdstring (optional)Producing transition id.
transactionIndexnumber (optional)Transaction's position within its block.
transitionIndexnumber (optional)Transition's position within its transaction.
uidstring (optional)Opaque per-connection handle from a privacy-preserving wallet. Pass back as an InputRequest's uid to spend exactly this record. Absent from wallets that predate the privacy feature.
recordViewRecordView (optional)Granted plaintext fields when the wallet withholds full plaintext under a recordAccess grant.

OwnedRecord extends OwnedRecordEncrypted with:

FieldTypeDescription
recordPlaintextstringDecrypted record plaintext.

RecordView

FieldTypeDescription
fieldsRecord<string, string>Granted field key to Aleo-encoded value string. Keys may be a record-body field name, a dotted struct path ('data.amount'), or a $-prefixed metadata token ('$commitment').

RecordStatusFilter is 'all' | 'spent' | 'unspent'.

RequestRecordsParameters — parameters for requestRecords, scoping the scan to one program's records.

FieldTypeDescription
programstringProgram whose records to scan.
includePlaintextboolean (optional)Whether to include plaintext on each record. Defaults to true.
statusFilterRecordStatusFilter (optional)Filter by spent status. Defaults to 'all'.

Record Scanning Service (RSS) types

import type { RecordFilter, ResponseFilter, OwnedRecordsRequest } from '@provablehq/veil-core'

These shape requests to a hosted Record Scanning Service scanner.

TypeFieldTypeDescription
RecordFiltercommitmentsstring[] (optional)Restrict the scan to these commitments.
RecordFilterstart / endnumber (optional)Lower/upper bound of the block-height range to scan.
RecordFilterprogramsstring[] (optional)Restrict the scan to these programs.
RecordFilterrecordsstring[] (optional)Restrict the scan to these record type names.
RecordFilterfunctionsstring[] (optional)Restrict the scan to records produced by these functions.
RecordFilterresultsPerPagenumber (optional)Number of records per page of results.
RecordFilterpagenumber (optional)Page of results to return.
RecordFilterresponseResponseFilter (optional)Field-selection mask applied to each returned record.
ResponseFilter(any field)boolean (optional)Set a field true to include it on each returned record, e.g. commitment, owner, blockHeight.
OwnedRecordsRequestuuidstringScan session identifier issued by the service.
OwnedRecordsRequestunspentboolean (optional)When true, return only unspent records.
OwnedRecordsRequestfilterRecordFilter (optional)Narrows the scan as described above.