Skip to content

Commit 67a878c

Browse files
JFWooten4codex
andcommitted
📝 Restructure ledger entry overview
Co-authored-by: Codex <noreply@openai.com>
1 parent ffdf6fc commit 67a878c

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

  • docs/learn/fundamentals/stellar-data-structures/ledgers

docs/learn/fundamentals/stellar-data-structures/ledgers/entries.mdx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,76 +6,82 @@ description: "Ledger entries are the durable data structures that make up the St
66
---
77

88

9-
Data is stored on the ledger as ledger entries, akin to key-value stores. Each key is a `LedgerKey` instance defined in [protocol XDR](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L588). Keys state which object we reference, pointing to `LedgerEntry` values defined in [protocol XDR](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L548). Thus entry instances contain the data stored at that key.
9+
Data is stored on the ledger as ledger entries, akin to key-value stores. Each key is a `LedgerKey` instance. Keys state which object we reference, pointing to `LedgerEntry` values. Thus entry instances contain the data stored at that key.
10+
11+
:::note Internal Design
1012

1113
Each `LedgerKey` contains only the fields needed to identify its entry. Those identifying fields also appear in the full entry. For example, an `OfferKey` [contains](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L603-L608) its `sellerID` and `offerID`, while the corresponding `OfferEntry` [contains](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L326-L349) those fields along with the full record of ledger data: `amount`, `price`, [assets](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L55-L67), and more.
1214

13-
## 10 Ledger Key Cases
15+
:::
16+
17+
## Entry Types
18+
19+
The descriptions below summarize the linked conceptual documentation. The protocol XDR definitions of [`LedgerKey`](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L588-L651) and [`LedgerEntry`](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-ledger-entries.x#L548-L586) are the source of truth for the exact fields and types.
1420

15-
### Account
21+
### 1. Account {#account}
1622

1723
The `AccountEntry` holistically defines a Stellar account, including its balance, sequence number, thresholds, signers, and flags. Learn more in the [Accounts section](../accounts.mdx).
1824

1925
- **Key:** Identified by `AccountID`
2026
- **Entry:** Full account record including balance, sequence number, thresholds, flags, home domain, and list of signers. Tracks [subentries](../accounts.mdx#subentries) that drive the minimum balance requirement.
2127

22-
### Trustline
28+
### 2. Trustline {#trustline}
2329

2430
The `TrustLineEntry` defines a balance line to a non-native asset issued on the network. It is created and updated via [`changeTrustOp`](../../transactions/list-of-operations.mdx#change-trust). Learn more in the [Trustlines section](../accounts.mdx#trustlines).
2531

2632
- **Key:** `(AccountID, asset)`
2733
- **Entry:** Trustline state for a non-native asset. Stores the asset balance, limit, authorization flags, and trading liability counters.
2834

29-
### Offer
35+
### 3. Offer {#offer}
3036

3137
The `OfferEntry` represents an offer made on the SDEX order book. Learn more in the [orderbooks DEX section](../../liquidity-on-stellar-sdex-liquidity-pools.mdx#orderbook).
3238

3339
- **Key:** `(sellerID, offerID)`
3440
- **Entry:** A single offer on the DEX. Contains the selling and buying assets, amount, price, and [passive](../../liquidity-on-stellar-sdex-liquidity-pools.mdx#passive-offer) flags.
3541

36-
### Account Data
42+
### 4. Account Data {#account-data}
3743

3844
A `DataEntry` stores key-value data entries attached to an account. It is used through the [`manageDataOp`](../../transactions/list-of-operations.mdx#manage-data).
3945

4046
- **Key:** `(accountID, dataName)`
4147
- **Entry:** Arbitrary key-value pair (`DataValue`) attached to an account.
4248

43-
### Claimable Balance
49+
### 5. Claimable Balance {#claimable-balance}
4450

4551
The `ClaimableBalanceEntry` tracks a balance that may or may not actively be claimable. Learn more in the [Claimable Balances section](../../../../build/guides/transactions/claimable-balances.mdx).
4652

4753
- **Key:** `balanceID`
4854
- **Entry:** Tracks the asset, amount, claimants, [predicates](../../../../build/guides/transactions/claimable-balances.mdx#other-parameters), and optional flags.
4955

50-
### Liquidity Pool
56+
### 6. Liquidity Pool {#liquidity-pool}
5157

5258
The `LiquidityPoolEntry` defines the configuration of a constant-product liquidity pool between two assets. Learn more in the [liquidity pools section](../../liquidity-on-stellar-sdex-liquidity-pools.mdx#liquidity-pools).
5359

5460
- **Key:** `liquidityPoolID`
5561
- **Entry:** Holds pool parameters (two assets, fee rate), reserves, total pool shares, and a pool's trustline count (to prevent entry scanning).
5662

57-
### Contract Data
63+
### 7. Contract Data {#contract-data}
5864

5965
`ContractDataEntry` stores a piece of data under a contract-defined key. Learn more in the [Persisting Contract Data section](../../contract-development/storage/persisting-data.mdx#ledger-entries).
6066

6167
- **Key:** `(contract, key, durability)`
6268
- **Entry:** Stores the `SCVal` value associated with that key under the contract. Used for Soroban data storage alongside keys.
6369

64-
### Contract Code
70+
### 8. Contract Code {#contract-code}
6571

6672
The `ContractCodeEntry` contains the Wasm bytecode of a Soroban contract. Learn more in the [Smart Contracts Overview section](../../../../build/smart-contracts/overview.mdx).
6773

6874
- **Key:** `hash` of the Wasm module.
6975
- **Entry:** Contains the Wasm bytecode and associated cost inputs to deploy or invoke contracts. [Fee metadata](../../fees-resource-limits-metering.mdx#resource-fee) takes into account component factors like number of instructions, functions, and variables.
7076

71-
### Config Setting
77+
### 9. Config Setting {#config-setting}
7278

7379
The `ConfigSettingEntry` holds governed network configuration values for over a dozen rules. Learn more in the [Soroban Settings section](../../../../validators/admin-guide/soroban-settings.mdx).
7480

7581
- **Key:** `configSettingID` (index of setting [in list](https://github.com/stellar/stellar-xdr/blob/v27.0/Stellar-contract-config-setting.x#L373-L396))
7682
- **Entry:** Active value of a network-level parameter (e.g., protocol limits, compute fees, state archival). The whole validator quorum set has to agree on these values.
7783

78-
### TTL
84+
### 10. TTL {#ttl}
7985

8086
The `TTLEntry` defines the time-to-live of an associated contract data or code entry. Learn more in the [State archival section](../../contract-development/storage/state-archival.mdx#ttl).
8187

0 commit comments

Comments
 (0)