The ledger in five minutes¶
The handful of IOTA ideas the rest of the book relies on: objects, programmable transaction blocks, gas, events and checkpoints.
You will learn / You need
You will learn: what an object is and why shared objects are slower, what a PTB contains, what a gas coin limits, and how events and checkpoints show up in this framework. You need: nothing. This is the first concept page.
Objects¶
IOTA stores state as objects. Each object has an ID and a type defined in a Move module, and each is in one of three ownership states:
| Kind | Who can use it | Consequence in this framework |
|---|---|---|
| Owned | Only its owner (an address) | Transactions that touch only owned objects do not need consensus ordering |
| Shared | Anyone | Every transaction that uses it is ordered by consensus |
| Immutable (frozen) | Anyone, read-only | Read without contention |
The framework relies on the difference. SourceConfig in stealth_name_service/Move/bridge_source/sources/bridge_source.move is frozen on purpose: a shared object would put every request call through consensus and serialise the source side of the bridge behind one object. The destination BridgeAA account is a shared object, so every bridged call goes through consensus, and stealth_name_service/backend/.env_sample sizes the gas pool for hold times of a second or more instead of milliseconds.
Programmable transaction blocks¶
A PTB is one transaction made of an ordered list of commands. In this framework the commands are Move calls: each names a package, a module, a function, optional type arguments and a list of arguments.
Arguments come in two kinds:
- Pure arguments are plain values, BCS-encoded (Binary Canonical Serialization) bytes in the transaction's input list (a number, an address, a byte string).
- Object arguments refer to an object by ID and ownership kind.
A command can also use the result of an earlier command as an argument. The BridgeAA authenticator accepts only pure arguments, because it compares them byte for byte (why). Writing a payload shows how JSON becomes a PTB.
Gas¶
Every transaction pays for its computation and storage in IOTA, taken from a gas coin, which is itself an object. Two numbers matter:
- The gas budget is the ceiling you set on the transaction.
- The gas cost is what the transaction actually used, which is at most the budget.
A coin is an owned object, so it serves one transaction at a time. Sustained throughput therefore needs roughly rate x hold_time coins, and the handler keeps a pool of them (EVENT_HANDLER_GAS_COINS). A coin too small to cover the budget is retired from the pool. Gas pool sizing has the arithmetic.
Events¶
A Move module can emit an event: a typed record that is stored with the transaction and can be queried by module. The bridge uses events as its message bus. bridge_source::request emits CrossChainRequest, and bridge_source::acknowledge emits RequestAcknowledged. bridge_target::record emits Recorded, which is the visible proof that a bridged call arrived. The listener polls the node for new events and keeps a cursor so it does not read the same page twice.
Checkpoints¶
The chain groups finalised transactions into checkpoints. You meet them in three places: the backend response (checkpoint_height, see HTTP API), the load-test CSV and the handler's CSV, which record the node's checkpoint height at the moment it answered the call (the checkpoint_height column; see CSV schemas).
Testnet and Devnet in this repository¶
The two networks have fixed roles in the sample configuration (stealth_name_service/backend/.env_sample; these are sample values, not defaults in the code):
| Network | Role | Chain id |
|---|---|---|
| Testnet | Source: bridge_source is published here and the listener watches it |
BRIDGE_SOURCE_CHAIN_ID=1 |
| Devnet | Destination: bridge_target and the BridgeAA account live here, and the handler runs against it (EVENT_HANDLER_NETWORK=devnet) |
BRIDGE_TARGET_CHAIN_ID=2 |
The chain ids are labels the bridge makes up, not network identifiers. They must agree with the BridgeAA's own chain id and with the entries in its access control list (ACL).
Next¶
Relayers and cross-chain calls shows how an event on one network becomes a transaction on the other.