Sub topic 1
How Ledger Design Shapes What You Can Measure
Prerequisites
This chapter assumes you know three things:
- What a blockchain, a wallet, and a transaction are.
- How to read short Python programs.
- Basic statistics, such as averages and distributions. These matter more in later chapters.
You do not need to have run a node or queried a blockchain before.
Why start with the ledger
Every on-chain metric is a calculation over records the ledger happens to keep. If the ledger stores a record, you can count it. If the ledger leaves a fact implicit, you must infer it, and the inference can be wrong. The same metric name, such as "active addresses" or "transfer volume", can therefore mean different things on different chains.
This chapter covers the two dominant ledger designs, what each one stores explicitly, and how that changes the metrics in later chapters. It also covers a third complication: value that moves without appearing as a plain transfer.
The two ledger models
Account-based ledgers
An account-based ledger keeps a table of accounts. Each account has a balance, and on some chains it also has a nonce (a counter of sent transactions) and contract storage. A transaction subtracts value from the sender's balance and adds it to the receiver's balance. Ethereum and most chains compatible with it work this way.
What this stores explicitly:
- The current balance of every account. You can read it directly at any block.
- One sender and one receiver per top-level transaction.
- The transaction value and the fee.
What it leaves implicit:
- Which earlier deposit a given withdrawal "came from". Balances are fungible numbers, not individual coins.
- How long a particular unit of value has been held. You only know when the account last changed.
UTXO ledgers
A UTXO ledger (unspent transaction output ledger) has no balance table. It keeps a set of unspent outputs. Each output is a chunk of value locked to an address or script. A transaction consumes one or more existing outputs as inputs and creates new outputs. Bitcoin works this way, as do Litecoin and Cardano's base ledger design (in an extended form).
An output must be spent whole. If you hold a 12-unit output and want to pay 5, the transaction spends the 12-unit output and creates two new outputs: 5 to the recipient and 6.9 back to you as change. The remaining 0.1 is the fee.
What this stores explicitly:
- Every output, with its creation transaction and, once spent, its spending transaction. This gives each chunk of value an exact age.
- Many inputs and many outputs per transaction.
What it leaves implicit:
- A balance. You compute one by summing the unspent outputs locked to an address.
- Which output is the payment and which is change. Both are just outputs.
- Who owns a transaction's inputs. Inputs from different addresses in one transaction are only probably controlled by one party.
Side-by-side comparison
| Property | Account-based | UTXO |
|---|---|---|
| Balance | Stored directly | Computed by summing unspent outputs |
| Transaction shape | One sender, one receiver | Many inputs, many outputs |
| Change | None | Usually a change output |
| Coin age | Not tracked per unit | Exact for each output |
| Natural address reuse | Common, since the account is the identity | Discouraged, since wallets often generate fresh addresses |
| Smart contract activity | Rich, with internal calls and event logs | Limited, depending on the chain |
How the model changes the metrics
Counting addresses
On an account chain, an address is a persistent account. Counting distinct senders and receivers in a day gives a fairly direct count of accounts that moved value, though one person can still run many accounts.
On a UTXO chain, many wallets create a new address for every receive and every change output. A single person making one payment can therefore produce an input address, a recipient address, and a fresh change address. Three addresses appear in that transaction, but at most two parties are involved. A raw address count on a UTXO chain overstates the number of participants, and the overstatement depends on wallet software defaults. The next chapter returns to this under entities and clustering.
Measuring transfer volume
Summing all output values of a UTXO transaction double counts. In the diagram above, 11.9 units appear as outputs, but only 5 units went to a different party. The 6.9 units of change simply returned to the sender.
On an account chain, the value field of a transaction is what moved, with no change output to subtract. That simplicity has its own gap, covered in the next section: much value moves inside contract calls rather than in the top-level value field.
The following code compares two volume estimates for a UTXO transaction. It treats an output as change when it pays an address that also appears among the inputs.
def naive_volume(tx):
return sum(o["value"] for o in tx["outputs"])
def volume_excluding_self_change(tx):
input_addresses = {i["address"] for i in tx["inputs"]}
return sum(o["value"] for o in tx["outputs"]
if o["address"] not in input_addresses)
# Values are integers in the chain's smallest unit.
# Change returns to an input address (address reuse).
reused = {
"inputs": [{"address": "A", "value": 800}, {"address": "A", "value": 400}],
"outputs": [{"address": "B", "value": 500}, {"address": "A", "value": 690}],
}
# Same payment, but change goes to a fresh address C.
fresh = {
"inputs": [{"address": "A", "value": 800}, {"address": "A", "value": 400}],
"outputs": [{"address": "B", "value": 500}, {"address": "C", "value": 690}],
}
for name, tx in [("reused", reused), ("fresh", fresh)]:
print(name, naive_volume(tx), volume_excluding_self_change(tx))The output is:
reused 1190 500
fresh 1190 1190The heuristic works when change returns to an input address and fails when it goes to a new one. The true economic transfer is 500 in both cases. Real analytics providers use stronger change-detection heuristics, such as matching output script types or spotting round-number payments. These heuristics still make mistakes, so published UTXO volume figures carry an error range that is rarely shown.
Computing balances and holder distribution
Holder distribution (covered later in this tutorial) needs balances. On an account chain, you read the balance table. On a UTXO chain, you sum unspent outputs per address and then face the entity question again. One person's funds may be spread across dozens of addresses, so address-level distribution overstates how many holders exist and understates how concentrated ownership is.
A concrete case: someone holds 100 units in 50 outputs of 2 units each, spread across 50 addresses. An address-level ranking shows 50 small holders. A correct entity-level view shows one holder with 100 units.
Measuring supply by age
This is where UTXO ledgers have an advantage. Each unspent output has a creation time, so you can say exactly how much supply has not moved for one year. Account chains do not track this per unit. Estimating age there requires an assumption about which units leave first, such as first-in-first-out, and different assumptions give different answers. Interpretation of age views is covered in a later chapter. For now, note that the age data is exact on UTXO chains and modeled on account chains.
Value that does not look like a transfer
Account chains that support smart contracts create two measurement problems that UTXO-style chains largely avoid.
- Internal transfers. When a contract receives a call and sends native currency onward to other accounts, those movements are not top-level transactions. They appear in execution traces. A metric built only from top-level transactions misses them. Decentralized exchange swaps, multi-send contracts, and wallet contracts all produce such movements.
- Token transfers. Tokens such as stablecoins are not native currency. Their balances live inside the token contract's own storage. A token transfer is a contract call, and the standard way to find it is the
Transferevent the contract emits in the transaction log. The top-level transaction shows only a call to the contract, usually with a native value of zero.
The consequence is that "transfers" on an account chain is a choice among at least three data sources: top-level transactions, internal traces, and token event logs. Two analysts who say "Ethereum transfer volume" may mean different sources. Each source also has its own double counting. A single swap can emit several token transfer events as value passes through pools, so summing every event overstates economic activity.
# Account model: apply top-level transfers to a balance table.
balances = {"A": 100, "B": 20, "C": 0}
def apply_transfer(balances, sender, receiver, value):
if balances.get(sender, 0) < value:
raise ValueError("insufficient balance")
balances[sender] -= value
balances[receiver] = balances.get(receiver, 0) + value
apply_transfer(balances, "A", "B", 30)
apply_transfer(balances, "B", "C", 10)
print(balances)This prints {'A': 70, 'B': 40, 'C': 10}. The balance table is easy to maintain because the model stores it directly. The code covers only the simple case. A full implementation would also process internal traces and token events, since these change balances too.
A checklist for any metric definition
Before you trust or compute any on-chain number, answer these questions about the ledger.
- Is the chain account-based or UTXO? Does the metric depend on balances, change outputs, or coin age?
- What does one address represent? A persistent account, or a one-time receiving slot?
- Which data source defines "transfer": top-level transactions, internal traces, token events, or some mix?
- Are fees, change, and self-transfers included or removed?
- Is the metric computed per address or per entity? The next chapter explains why that matters.
Common errors
- Comparing across chains without adjusting. An "active addresses" figure on a UTXO chain and on an account chain measure different things. A ratio between them says little.
- Summing UTXO outputs as volume. This counts change as value moved.
- Reading top-level value as total movement on a smart-contract chain. This misses token and internal transfers.
- Treating event-log sums as clean volume. Router and pool contracts emit multiple events per user action.
- Assuming age data exists everywhere. On account chains, supply-by-age is an estimate based on a stated assumption.
Summary
Account ledgers store balances and make "who holds what now" easy, but they hide per-unit age and push much activity into contract traces and token events. UTXO ledgers store every output, which gives exact coin age. They have no balance table and make change look like a transfer. Both models separate "address" from "person", and the UTXO model widens that gap by encouraging a new address for every receipt. The next chapter takes up that gap directly.
Exercise
A UTXO transaction spends one 20-unit output from address X. It creates a 7-unit output to address Y and a 12-unit output to a new address Z. The fee is 1 unit. Y belongs to a different person. Z is a fresh change address controlled by the sender. What is the naive output-sum volume, what is the economic transfer, and why would the "exclude outputs to input addresses" heuristic get it wrong?
Show answer
The naive output-sum volume is 7 + 12 = 19 units. The economic transfer is 7 units, because only the payment to Y went to a different party. The heuristic excludes only outputs that pay an address appearing among the inputs. Z is not among the inputs (only X is), so the 12-unit change output is counted as moved value and the heuristic reports 19, the same as the naive sum.
Exercise
You compute daily "Ethereum transfer volume" by summing the value field of top-level transactions. A stablecoin transfer of 1,000,000 units happens that day. Does it appear in your figure? Name two other data sources you would need for a fuller picture, and one risk of using each.
Show answer
It does not appear. A token transfer is a contract call with a native value of usually zero, and the token amount lives in the contract's Transfer event. Internal traces capture native currency that contracts forward onward, but need a node that records traces, and they can include movements that are mechanical rather than economic. Token event logs capture token transfers, but a single swap or routed trade can emit several events, so summing them all overstates real economic activity.
Exercise
Why is "supply not moved in over a year" exact on a UTXO chain but only an estimate on an account chain?
Show answer
A UTXO chain stores each unspent output with its creation time, so the age of every unit of value in the unspent set is known. An account chain stores only a balance per account and does not track which units are which. Estimating age requires an assumption, such as first-in-first-out spending, and different assumptions give different results.