Celestia types

Common types

class celestia.types.common_types.Base64(value)[source]

Bases: bytes

Represents a byte string that supports Base64 encoding and decoding.

This class ensures that the stored data is always in bytes and provides Base64 encoding/decoding when converting to and from strings.

classmethod ensure_type(value)[source]

Ensures the value is an instance of Base64.

Parameters:

value (str | bytes | Base64) – The value to convert.

Returns:

A valid Base64 instance.

Return type:

Base64

class celestia.types.common_types.Namespace(value)[source]

Bases: Base64

Represents a Celestia namespace.

A namespace is a unique identifier for blobs stored on the Celestia network. It is used to segregate data based on different applications or use cases.

class celestia.types.common_types.Commitment(value)[source]

Bases: Base64

Represents a Celestia blob commitment.

A commitment is a cryptographic proof that ensures data integrity and allows verification of whether a blob has been correctly included in a block.

class celestia.types.common_types.Blob(namespace, data, commitment=None, share_version=0, index=None)[source]

Represents a Celestia blob.

A blob is a chunk of data stored on Celestia. Each blob is associated with a namespace and a cryptographic commitment to ensure data integrity.

namespace

The namespace under which the blob is stored.

Type:

Namespace

data

The actual blob data.

Type:

Base64

commitment

The cryptographic commitment for the blob.

Type:

Commitment

share_version

The version of the share encoding used.

Type:

int

index

The index of the blob in the block (optional).

Type:

int | None

static deserializer(result)[source]

Deserializes a dictionary into a Blob object.

Parameters:

result – The dictionary representation of a Blob.

Returns:

A deserialized Blob object.

class celestia.types.common_types.TxConfig[source]

Bases: TypedDict

Represents a transaction configuration for submitting transactions to Celestia.

signer_address

The address of the transaction signer.

Type:

str | None

is_gas_price_set

Whether a custom gas price is set.

Type:

bool | None

key_name

The name of the key used for signing.

Type:

str | None

gas_price

The gas price for the transaction.

Type:

float | None

gas

The amount of gas to use.

Type:

int | None

fee_granter_address

Address of the fee granter (if applicable).

Type:

str | None

Blob types

class celestia.types.blob.SubmitBlobResult(height, commitments)[source]

Represents the result of submitting a blob to the Celestia network.

height

The block height at which the blob was submitted.

Type:

int

commitments

Commitments associated with the submitted blob.

Type:

tuple[Commitment, …]

class celestia.types.blob.SubscriptionBlobResult(height, blobs)[source]

Represents the result of a subscription to blobs in the Celestia network.

height

The block height of the retrieved blobs.

Type:

int

blobs

The list of blobs retrieved from the subscription.

Type:

tuple[Blob, …]

class celestia.types.blob.Proof(nodes, end, is_max_namespace_ignored=None, start=None)[source]

Represents a Merkle proof used for verifying data inclusion in Celestia.

end

The end index of the proof range.

Type:

int

nodes

The nodes forming the Merkle proof.

Type:

tuple[Base64, …]

start

The start index of the proof range (optional).

Type:

int | None

is_max_namespace_ignored

Flag indicating if max namespace check is ignored (optional).

Type:

bool | None

class celestia.types.blob.RowProofEntry(leaf_hash, aunts, total, index=None)[source]

Represents an entry in a row proof, used for verifying inclusion in a specific row of a Merkle tree.

index

The index of the leaf in the row.

Type:

int | None

total

The total number of leaves in the row.

Type:

int

leaf_hash

The hash of the leaf.

Type:

Base64

aunts

The sibling hashes used in the proof.

Type:

tuple[Base64, …]

class celestia.types.blob.RowProof(row_roots, proofs, end_row=None, start_row=None)[source]

Represents a proof for a row in a Merkle tree.

start_row

The starting row index of the proof.

Type:

int | None

end_row

The ending row index of the proof.

Type:

int | None

row_roots

The root hashes of the rows.

Type:

tuple[Base64, …]

proofs

The proof entries for the row.

Type:

tuple[RowProofEntry, …]

class celestia.types.blob.CommitmentProof(namespace_id, namespace_version, row_proof, subtree_root_proofs, subtree_roots)[source]

Represents a proof of commitment in Celestia, verifying that a namespace is correctly included.

namespace_id

The namespace identifier.

Type:

Namespace

namespace_version

The version of the namespace.

Type:

int

row_proof

The proof for the rows containing the namespace.

Type:

RowProof

subtree_root_proofs

Proofs for verifying subtree roots.

Type:

tuple[Proof, …]

subtree_roots

The roots of the subtrees.

Type:

tuple[Base64, …]

static deserializer(result)[source]

Deserializes a commitment proof from a given result.

Parameters:

result (dict) – The dictionary representation of a CommitmentProof.

Returns:

A deserialized CommitmentProof object.

Das types

class celestia.types.das.Worker(job_type: str, current: int, from_: int, to: int)[source]
class celestia.types.das.SamplingStats(head_of_sampled_chain, head_of_catchup, network_head_height, concurrency, catch_up_done, is_running, workers=None)[source]

Header types

class celestia.types.header.ConsensusVersion(block, app)[source]

Represents the version information for the consensus.

block

The block version.

Type:

str

app

The application version.

Type:

str

class celestia.types.header.Parts(total, hash)[source]

Represents the parts of the block.

total

The total number of parts.

Type:

int

hash

The hash of the parts.

Type:

str

class celestia.types.header.BlockId(hash, parts)[source]

Represents a block identifier, which includes a hash and parts.

hash

The hash of the block.

Type:

str

parts

The parts information of the block.

Type:

Parts

class celestia.types.header.Header(version, chain_id, height, time, last_block_id, last_commit_hash, data_hash, validators_hash, next_validators_hash, consensus_hash, app_hash, last_results_hash, evidence_hash, proposer_address)[source]

Represents the header information for the block.

version

The consensus version.

Type:

ConsensusVersion

chain_id

The chain identifier.

Type:

str

height

The height of the block.

Type:

str

time

The time the block was created.

Type:

str

last_block_id

The identifier of the last block.

Type:

BlockId

last_commit_hash

The hash of the last commit.

Type:

str

data_hash

The hash of the block data.

Type:

str

validators_hash

The hash of the validators.

Type:

str

next_validators_hash

The hash of the next validators.

Type:

str

consensus_hash

The consensus hash.

Type:

str

app_hash

The application hash.

Type:

str

last_results_hash

The hash of the last results.

Type:

str

evidence_hash

The hash of the evidence.

Type:

str

proposer_address

The address of the proposer.

Type:

str

class celestia.types.header.PubKey(type, value)[source]

Represents a public key used for validating a transaction.

type

The type of public key.

Type:

str

value

The base64 encoded public key.

Type:

Base64

class celestia.types.header.Validator(address, pub_key, voting_power, proposer_priority)[source]

Represents a validator in the consensus system.

address

The address of the validator.

Type:

str

pub_key

The public key of the validator.

Type:

PubKey

voting_power

The voting power of the validator.

Type:

str

proposer_priority

The proposer priority of the validator.

Type:

str

class celestia.types.header.ValidatorSet(validators, proposer)[source]

Represents a set of validators and the proposer.

validators

The list of validators.

Type:

tuple[Validator, …]

proposer

The proposer of the block.

Type:

Validator

class celestia.types.header.Signature(block_id_flag, validator_address, timestamp, signature)[source]

Represents a signature for a commit block.

block_id_flag

The block ID flag.

Type:

int

validator_address

The address of the validator signing the block.

Type:

str

timestamp

The timestamp of the signature.

Type:

str

signature

The base64 encoded signature.

Type:

Base64

class celestia.types.header.Commit(height, round, block_id, signatures)[source]

Represents a commit for a block, including signatures.

height

The block height.

Type:

int

round

The block round.

Type:

int

block_id

The ID of the block.

Type:

BlockId

signatures

The signatures of the validators.

Type:

tuple[Signature, …]

class celestia.types.header.Dah(row_roots, column_roots)[source]

Represents the data availability header.

row_roots

The row roots.

Type:

tuple[Base64, …]

column_roots

The column roots.

Type:

tuple[Base64, …]

class celestia.types.header.ExtendedHeader(header, validator_set, dah, commit)[source]

Represents an extended header containing header, validator set, commit, and DAH.

header

The block header.

Type:

Header

validator_set

The validator set.

Type:

ValidatorSet

commit

The commit information.

Type:

Commit

dah

The data availability header.

Type:

Dah

static deserializer(result)[source]

Deserializes the provided result into a ExtendedHeader object.

Parameters:

result (dict) – The dictionary representation of a ExtendedHeader.

Returns:

A deserialized ExtendedHeader object.

Return type:

ExtendedHeader

class celestia.types.header.State(id, height, from_height, to_height, from_hash, to_hash, start, end)[source]

Represents a state for the block range.

id

The ID of the state.

Type:

int

height

The height of the block.

Type:

int

from_height

The starting height for the range.

Type:

int

to_height

The ending height for the range.

Type:

int

from_hash

The hash at the start of the range.

Type:

str

to_hash

The hash at the end of the range.

Type:

str

start

The start time of the state.

Type:

str

end

The end time of the state.

Type:

str

static deserializer(result)[source]

Deserializes the provided result into a State object.

Parameters:

result (dict) – The dictionary representation of a State.

Returns:

A deserialized State object.

Return type:

State

P2P types

class celestia.types.p2p.ResourceManagerStat(System, Transient, Services, Protocols, Peers)[source]

Represents the statistics of a resource manager, including system, transient, services, protocols, and peers.

system

System data.

Type:

dict

transient

Transient data.

Type:

dict

services

Service data.

Type:

dict

protocols

Protocol data.

Type:

dict

peers

Peer data.

Type:

dict

static deserializer(result)[source]

Deserialize a dictionary into a ResourceManagerStat instance.

Parameters:

result (dict) – The dictionary representation of a ResourceManagerStat.

Returns:

A deserialized ResourceManagerStat object.

Return type:

ResourceManagerStat

class celestia.types.p2p.BandwidthStats(TotalIn, TotalOut, RateIn, RateOut)[source]

Represents the statistics related to bandwidth, including total inbound/outbound traffic and rates for both directions.

total_in

Total inbound bandwidth.

Type:

int

total_out

Total outbound bandwidth.

Type:

int

rate_in

Inbound traffic rate.

Type:

float

rate_out

Outbound traffic rate.

Type:

float

static deserializer(result)[source]

Deserialize a dictionary into a BandwidthStats instance.

Parameters:

result (dict) – The dictionary representation of a BandwidthStats.

Returns:

A deserialized BandwidthStats object.

Return type:

BandwidthStats

class celestia.types.p2p.AddrInfo(ID, Addrs)[source]

Represents the address information with an identifier and associated addresses.

id

The unique identifier for the address.

Type:

str

addrs

A list of addresses associated with the identifier.

Type:

list

static deserializer(result)[source]

Deserialize a dictionary into an AddrInfo instance.

Parameters:

result (dict) – The dictionary representation of a AddrInfo.

Returns:

A deserialized AddrInfo object.

Return type:

AddrInfo

class celestia.types.p2p.Connectedness(*values)[source]

Bases: Enum

Enum representing the connection status.

NOT_CONNECTED

Represents a disconnected state.

CONNECTED

Represents a connected state.

class celestia.types.p2p.Reachability(*values)[source]

Bases: Enum

Enum representing the reachability state of an address.

Unknown

Unknown reachability state.

Public

The address is publicly reachable.

Private

The address is privately reachable.

Share types

class celestia.types.share.SampleCoords(row, col)[source]

A class representing coordinates for a sample, specifically the row and column.

row

The row index of the sample.

Type:

int

col

The column index of the sample.

Type:

int

class celestia.types.share.ShareProof(namespace_id, namespace_version, row_proof, data, share_proofs)[source]

A class representing a share proof, which consists of a namespace ID, namespace version, row proof, data, and share proofs.

namespace_id

The namespace identifier.

Type:

Namespace

namespace_version

The version of the namespace.

Type:

int

row_proof

The proof related to the row.

Type:

RowProof

data

The data associated with the share proof.

Type:

tuple[Base64, …]

share_proofs

Additional share proofs.

Type:

tuple[Proof, …]

class celestia.types.share.GetRangeResult(Shares, Proof)[source]

A class representing the result of a range retrieval, including shares and proof.

shares

The shares related to the range.

Type:

tuple[Base64, …]

proof

The proof associated with the range retrieval.

Type:

ShareProof

static deserializer(result)[source]

Deserialize a result dictionary into a GetRangeResult object.

Parameters:

result (dict) – The dictionary representation of a GetRangeResult.

Returns:

The deserialized GetRangeResult object.

Return type:

GetRangeResult

class celestia.types.share.ExtendedDataSquare(data_square, codec)[source]

A class representing an extended data square, including the data square and codec.

data_square

The data square.

Type:

tuple[Base64, …]

codec

The codec used for the data.

Type:

str

static deserializer(result)[source]

Deserialize a result dictionary into an ExtendedDataSquare object.

Parameters:

result (dict) – The dictionary representation of a ExtendedDataSquare.

Returns:

The deserialized ExtendedDataSquare object.

Return type:

ExtendedDataSquare

class celestia.types.share.NamespaceData(shares, proof)[source]

A class representing namespace data, consisting of shares and proof.

shares

The shares related to the namespace.

Type:

tuple[Base64, …]

proof

The proof associated with the namespace data.

Type:

Proof

static deserializer(result)[source]

Deserialize a result dictionary into a NamespaceData object.

Parameters:

result (dict) – The dictionary representation of a NamespaceData.

Returns:

The deserialized NamespaceData object.

Return type:

NamespaceData

State types

class celestia.types.state.Balance(amount, denom)[source]

Represents the balance of a particular denomination.

amount

The amount of the balance.

Type:

int

denom

The denomination of the balance.

Type:

str

static deserializer(result)[source]

Deserialize a result dictionary into a Balance object.

Parameters:

result (dict) – The dictionary representation of a Balance.

Returns:

The deserialized Balance object.

Return type:

Balance

class celestia.types.state.TXResponse(height, txhash, logs, events)[source]

Represents the response for a transaction.

height

The block height of the transaction.

Type:

int

txhash

The transaction hash.

Type:

str

logs

Logs associated with the transaction, if any.

Type:

tuple[t.Any] | None

events

Events triggered by the transaction, if any.

Type:

tuple[t.Any, …] | None

static deserializer(result)[source]

Deserialize a result dictionary into a TXResponse object.

Parameters:

result (dict) – The dictionary representation of a TXResponse.

Returns:

The deserialized TXResponse object.

Return type:

TXResponse

class celestia.types.state.Delegation(delegator_address, validator_address, shares)[source]

Represents a delegation of tokens to a validator.

delegator_address

The address of the delegator.

Type:

str

validator_address

The address of the validator.

Type:

str

shares

The amount of shares in the delegation.

Type:

float

class celestia.types.state.DelegationResponse(delegation, balance)[source]

Represents the response for a delegation query.

delegation

The delegation details.

Type:

Delegation

balance

The balance associated with the delegation.

Type:

Balance

class celestia.types.state.QueryDelegationResponse(delegation_response)[source]

Represents the response for a delegation query.

delegation_response

The delegation response details.

Type:

DelegationResponse

static deserializer(result)[source]

Deserialize a result dictionary into a QueryDelegationResponse object.

Parameters:

result (dict) – The dictionary representation of a QueryDelegationResponse.

Returns:

The deserialized QueryDelegationResponse object.

Return type:

QueryDelegationResponse

class celestia.types.state.RedelegationEntry(creation_height, completion_time, initial_balance, shares_dst)[source]

Represents a redelegation entry.

creation_height

The block height when the redelegation was created.

Type:

int

completion_time

The completion time of the redelegation.

Type:

str

initial_balance

The initial balance of the redelegation.

Type:

int

shares_dst

The amount of shares transferred to the destination validator.

Type:

float

class celestia.types.state.Redelegation(delegator_address, validator_src_address, validator_dst_address, entries)[source]

Represents a redelegation of tokens from one validator to another.

delegator_address

The address of the delegator.

Type:

str

validator_src_address

The address of the source validator.

Type:

str

validator_dst_address

The address of the destination validator.

Type:

str

entries

A list of redelegation entries.

Type:

tuple[RedelegationEntry, …]

class celestia.types.state.RedelegationResponseEntry(redelegation_entry, balance)[source]

Represents a redelegation response entry.

redelegation_entry

The redelegation entry details.

Type:

RedelegationEntry

balance

The balance of the redelegation entry.

Type:

int

class celestia.types.state.RedelegationResponse(redelegation, entries)[source]

Represents the response for a redelegation query.

redelegation

The redelegation details.

Type:

Redelegation

entries

A list of redelegation response entries.

Type:

tuple[RedelegationResponseEntry, …]

class celestia.types.state.Pagination(next_key=None, total=None)[source]

Represents pagination information.

next_key

The key for the next page of results.

Type:

str | None

total

The total number of results.

Type:

int | None

class celestia.types.state.QueryRedelegationResponse(redelegation_responses, pagination=None)[source]

Represents the response for a query to retrieve redelegations.

redelegation_responses

A list of redelegation responses.

Type:

tuple[RedelegationResponse, …]

pagination

Pagination information for the query results.

Type:

Pagination

static deserializer(result)[source]

Deserialize a result dictionary into a QueryRedelegationResponse object.

Parameters:

result (dict) – The dictionary representation of a QueryRedelegationResponse.

Returns:

The deserialized QueryRedelegationResponse object.

Return type:

QueryRedelegationResponse

class celestia.types.state.UnbondEntry(creation_height, completion_time, initial_balance, balance)[source]

Represents an unbonding entry for a validator.

creation_height

The block height when the unbonding was created.

Type:

int

completion_time

The completion time of the unbonding.

Type:

str

initial_balance

The initial balance of the unbonding.

Type:

int

balance

The current balance after unbonding.

Type:

int

class celestia.types.state.Unbond(delegator_address, validator_address, entries)[source]

Represents an unbonding of tokens from a validator.

delegator_address

The address of the delegator.

Type:

str

validator_address

The address of the validator.

Type:

str

entries

A list of unbonding entries.

Type:

tuple[UnbondEntry, …]

class celestia.types.state.QueryUnbondingDelegationResponse(unbond)[source]

Represents the response for a query to retrieve unbonding delegations.

unbond

The unbonding details.

Type:

Unbond

static deserializer(result)[source]

Deserialize a result dictionary into a QueryUnbondingDelegationResponse object.

Parameters:

result (dict) – The dictionary representation of a QueryUnbondingDelegationResponse.

Returns:

The deserialized QueryUnbondingDelegationResponse object.

Return type:

QueryUnbondingDelegationResponse