Astreum

BLOCKCHAIN REFERENCE

Reference

Concise reference for block fields, transaction fields, receipt fields, message types, chain query API, and node configuration parameters.

Block Fields

FieldTypeWireDescription
versionIntintBlock format version (1)
chain_idIntint0 = test, 1 = main
heightIntintMonotonic block number
timestampIntintUnix seconds
previous_block_hashBytes (32)hash ptrBLAKE3 hash of previous block
nonceIntintPoW nonce satisfying difficulty
difficultyIntintRequired leading zero bits
validator_public_key_bytesBytes (32)bytesEd25519 public key of creator
signatureBytes (64)bytesEd25519 over body hash
accounts_hashBytes (32)hash ptrAccounts trie root hash
transactions_hashBytes (32)hash ptrTransactions list hash
receipts_hashBytes (32)hash ptrReceipts list hash
bloom_hashBytes (32)hash ptrBloom tree root hash
previous_era_hashBytes (32)hash ptrPrevious era bloom root
total_transaction_feeIntintSum of tx fees in block
total_storage_feeIntintSum of storage fees in block
total_mintIntNew tokens minted (runtime)
statistics[(Int)]linkCumulative fee/stake per era

Transaction Fields

FieldTypeWireDescription
versionIntintFormat version (1)
chain_idIntintTarget chain
amountIntintTransfer amount
codeTransactionCodeintTransaction type code
cost_limitIntintMax meter cost
counterIntintSender nonce (replay protection)
dataExprexprCode or payload expression
recipientBytes (32)bytesRecipient public key
senderBytes (32)bytesSender public key
signatureBytes (64)bytesEd25519 over body hash

Transaction Codes

CodeNameSubsystem
0x00TRANSFERCore
0x10CHANNEL_UPDATEChannel
0x11CHANNEL_WITHDRAWChannel
0x12CHANNEL_CLOSEChannel
0x20TREASURY_DEPOSITTreasury
0x21TREASURY_BORROWTreasury
0x22TREASURY_REPAYTreasury
0x23TREASURY_CLOSETreasury
0x30STORAGE_CREATEStorage
0x31STORAGE_PAYMENTStorage
0x32STORAGE_REMOVEStorage
0x40CODE_ACCOUNT_CREATECode Account
0x41CODE_ACCOUNT_CALLCode Account

Receipt Fields

FieldTypeWireDescription
versionIntintFormat version (1)
transaction_hashBytes (32)hash ptrHash of originating tx
transaction_feeIntintBase tx fee
storage_feeIntintOn-chain storage fee
data_feeIntintData payload fee
execution_feeIntintVM execution fee
statusIntint0 = success, 1 = failure
logs_hashBytes (32)hash ptrTx log expression hash
mintIntintTokens minted

Account Fields

FieldTypeWireDescription
balanceIntintToken balance
counterIntintCurrent nonce
code_hashBytes (32)hash ptrDeployed code hash
data_hashBytes (32)hash ptrKey-value store root hash
channels_hashBytes (32)hash ptrPayment channels root hash

Fork Fields

FieldTypeDescription
headBytes (32)Fork tip block hash
rootBytes (32)Genesis block hash
verified_up_toBytes (32)Earliest verified ancestor
chain_fork_positionBytes (32)Block where fork diverged
reached_genesisBoolTraced to genesis block
malicious_block_hashBytes (32)First invalid block (if any)
peersSetPeers following this head

Message Types

TopicValueDirectionDescription
PING0bidirectionalKeep-alive with signed timestamp
STORAGE_REQUEST1requestRequest expression by hash with payment
STORAGE_RESPONSE2responseReturn requested expression
ROUTE_REQUEST3requestAsk peer for nearby routing entries
ROUTE_RESPONSE4responseReturn routing table entries
TRANSACTION5relayPropagate signed transaction

Query API

get_block

from astreum import get_block

block = get_block(node, height=5000)
# Returns Block or None

O(log N) block lookup by height using bloom tree binary descent from the node's latest block.

find_transactions

from astreum import find_transactions

txs = find_transactions(
    node,
    tx_hash=b"\x00" * 32,     # or specific hash
    sender=b"\x00" * 32,      # or sender pubkey
    receiver=b"\x00" * 32,    # or receiver pubkey
    key=b"\x00" * 32,         # or bloom key
    start_height=10000,       # search from height
    end_height=0,             # stop at height (0 = genesis)
    limit=10,                 # max results (0 = unlimited)
)

Bloom-filtered transaction search with AND semantics across all set filters. Uses era-skipping bloom tree search for efficiency.

Config Parameters

KeyDefaultDescription
chain"main"Chain name: main or test
chain_id1Chain ID: 0 = test, 1 = main
port52780UDP port for P2P
use_ipv6FalseEnable IPv6 dual-stack
default_seedbootstrap.astreum.org:52780Default bootstrap peer
additional_seeds[]Extra bootstrap addresses
peer_timeout900 sPeer inactivity eviction time
peer_timeout_interval10 sPeer timeout check interval
bootstrap_retry_interval30 sBootstrap retry interval
incoming_queue_size_limit64 MiBMax incoming queue size
incoming_queue_timeout1.0 sIncoming queue pop timeout
fair_use_limit1 MiBFair-use tracking window
fair_use_ratio0.5Max upload/download ratio
hot_storage_limit1 GiBIn-memory cache limit
cold_storage_limit10 GiBOn-disk storage limit
cold_storage_scale"MB"Level rollup base unit
cold_storage_pathautoCold storage directory
storage_index_interval600 sAd scan interval
storage_request_minimum_price1Min retrieval price
storage_request_price_interval5.0 sPrice recalc interval
storage_fetch_interval0.25 sFetch retry interval
storage_fetch_retries8Max fetch retries
validation_secret_keyNoneEd25519 key for block validation
storage_secret_keyautoEd25519 key for storage identity
relay_secret_keyautoX25519 key for P2P encryption
logging_enabledTrueEnable structured CSV logging
logging_retention_days7Log file retention period
verification_max_stale_seconds10Max block staleness for verification
verification_max_future_skew2Max future timestamp tolerance
verify_blockchain_interval= peer_timeout_intervalVerification worker interval
latest_block_hashNoneOverride starting block hash
verified_up_toNoneOverride verified anchor

Node API

from astreum import Node

node = Node(config={
    "chain": "main",
    "port": 52780,
    "validation_secret_key": "hex...",
})

# Connect to P2P network
node.connect()

# Validate (create blocks as scheduled validator)
node.validate()

# Verify (track and verify forks)
node.verify()

# Query the chain
block = node.latest_block

# Storage
node.add_expr_advertisement(expr_hash)
node.add_expr_req(expr_hash)

Special Addresses

AddressHex
Treasury0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Storage0x0000000000000000000000000000000000000000000000000000000000000000