# Learn

> Short, plain explanations of the ideas behind tracing AI agents that move money on-chain: agentic payments, transaction lifecycles, fees and reverts.

Source: https://hashspan.dev/learn

Short, plain explanations of the ideas behind tracing AI agents that move money on-chain. Each page answers one question first, then shows where it appears in a trace.

## From zero

New to crypto and AI agents? [Start from zero](https://hashspan.dev/learn/start.md): Short videos and plain pages, one step at a time.

## Start here

### What is a span?

One timed operation, such as a tool call or a transaction send, with a name, a start, an end and attributes.

### What is a trace?

The tree of spans for one request or agent run. Child spans nest under the operation that caused them.

## Agentic era

OpenTelemetry for AI agents, one idea per page: spans, attributes, context, sampling and export, each shown on a real agent run.

- [Traces and spans: the anatomy of one agent run](https://hashspan.dev/learn/otel-traces-and-spans.md): Trace vs span in OpenTelemetry, on one real agent run: a span is one operation, a trace is every span with the same trace ID. Span ID and parent ID explained.
- [Span attributes: putting the tx hash on the span](https://hashspan.dev/learn/otel-span-attributes.md): OpenTelemetry span attributes explained with an agent's transaction: key and value rules, the allowed types, and why fees in wei go in as strings.
- [Span status codes: Unset, Error and Ok](https://hashspan.dev/learn/otel-span-status.md): How to mark an OpenTelemetry span as an error: status code Error plus an error.type attribute. Why success stays Unset, and when to use Ok. With code.
- [Span events vs logs](https://hashspan.dev/learn/otel-span-events.md): OpenTelemetry span event vs log: what a span event is, how exceptions are recorded on spans, and why OpenTelemetry is moving events to the Logs API.
- [Span kind: client, server, internal](https://hashspan.dev/learn/otel-span-kind.md): OpenTelemetry span kind explained on one agent trace: client vs internal, server, producer and consumer, and why a transaction send is a CLIENT span.
- [Span links: connecting spans that aren't parent and child](https://hashspan.dev/learn/otel-span-links.md): What an OpenTelemetry span link is, how it differs from a parent span, and how to add one in code, even when the linked span is in another trace.
- [Context propagation in async Node.js](https://hashspan.dev/learn/otel-context-propagation.md): OpenTelemetry context propagation in Node.js: how the active span survives await, what breaks without a context manager, and the traceparent header.
- [Baggage vs span attributes](https://hashspan.dev/learn/otel-baggage.md): OpenTelemetry baggage vs attributes, with an agent ID as the example: what travels to other services, what lands on spans, and what to keep private.
- [Resource attributes: who emitted this span?](https://hashspan.dev/learn/otel-resource-attributes.md): OpenTelemetry resource attributes and service.name for an AI agent: what belongs on the resource, what on the span, and why env vars get ignored.
- [Semantic conventions: shared names for spans and attributes](https://hashspan.dev/learn/otel-semantic-conventions.md): What OpenTelemetry semantic conventions are, what Stable and Development mean, where the GenAI names stand, and a lookup for every attribute name.
- [Sampling without losing the spans that moved money](https://hashspan.dev/learn/otel-sampling.md): An OpenTelemetry sampling strategy for agents that move money: head vs tail sampling, what a 10% sampling rate drops, and a policy that keeps reverts.
- [Exporters and OTLP: getting spans to Jaeger or Langfuse](https://hashspan.dev/learn/otel-exporters-otlp.md): The OpenTelemetry OTLP exporter in a TypeScript Node.js example: send agent spans to Jaeger or Langfuse, and why spans vanish without shutdown.

## Blockchain era

What happens to a transaction after an agent sends it: the lifecycle, fees, reverts and replaced transactions.

- [How do AI agents pay? Agent payments explained](https://hashspan.dev/learn/ai-agent-payments.md): AI agents pay within a business's budget, through a shop's checkout, or per request with a stablecoin. The three ways in plain words, and what can go wrong.
- [Transaction lifecycle: send, mempool, confirm](https://hashspan.dev/learn/tx-lifecycle.md): What happens between sending an EVM transaction and knowing whether it worked: the hash, the pending pool, the block and the receipt.
- [What is the L1 data fee?](https://hashspan.dev/learn/l1-data-fee.md): On OP Stack chains like Base, every transaction also pays to publish its data to Ethereum. What that fee is, why agents should care and where to see it.
- [Flashblocks: a receipt before the block exists](https://hashspan.dev/learn/flashblocks-preconfirmations.md): Base's flashblocks return a transaction receipt before its block is sealed. What a preconfirmation is, how to spot one, and why its fee can change.
- [ERC-4337 user operations: when the transaction isn't yours](https://hashspan.dev/learn/erc-4337-user-operations.md): An ERC-4337 smart account sends user operations, not transactions. What a bundler, the EntryPoint and a paymaster do, and which hash and fee are the agent's.
- [EIP-5792 call batches: one request, several calls](https://hashspan.dev/learn/eip-5792-call-batches.md): EIP-5792 lets an app ask a wallet to send several calls at once and poll their status. What the batch id and status codes mean, and when calls are atomic.
- [EIP-7702: when a plain account runs contract code](https://hashspan.dev/learn/eip-7702-delegation.md): EIP-7702 lets a regular account delegate to contract code with a signed authorization. What a type 4 transaction carries, and what to record about it.
- [HTTP 402 Payment Required: what it means and how x402 uses it](https://hashspan.dev/learn/http-402-payment-required.md): HTTP 402 Payment Required is still only reserved in the HTTP standard. What it means, how to fix it, and a real x402 402 → pay → 200 exchange, header by header.
- [x402 vs MPP: the same paid request, traced both ways](https://hashspan.dev/learn/x402-vs-mpp.md): x402 and MPP both turn HTTP 402 into a payment. We paid one API with each and traced it: the headers, who sends the transaction, and what the trace shows.

## OpenTelemetry attributes

- [OpenTelemetry attributes: semantic conventions lookup](https://hashspan.dev/learn/otel-attributes.md): every attribute with type, stability and the spans that set it
- [gen_ai.* attributes: OpenTelemetry GenAI semantic conventions](https://hashspan.dev/learn/otel-attributes/gen-ai.md): gen_ai.*, mcp.*
- [rpc.* and jsonrpc.* attributes: OpenTelemetry RPC conventions](https://hashspan.dev/learn/otel-attributes/rpc.md): rpc.*, jsonrpc.*
- [http.* attributes: OpenTelemetry HTTP semantic conventions](https://hashspan.dev/learn/otel-attributes/http.md): http.*
- [error.type: the OpenTelemetry error attribute](https://hashspan.dev/learn/otel-attributes/error.md): error.*
- [server.address and server.port: OpenTelemetry attributes](https://hashspan.dev/learn/otel-attributes/server.md): server.*, client.*

## Videos

Short videos on the same ideas, for first-timers, on the hashspan YouTube channel (https://www.youtube.com/@hashspan).

- [Amazon blocked an AI from shopping for you. Here's why it matters](https://www.youtube.com/shorts/4eXI5KcSGZ4) (Short): When software spends money, how does anyone know who sent it, and whether you said yes?
- [Quantum computers will break Bitcoin? Not the part you think](https://www.youtube.com/shorts/ssvXdnAFvyg) (Short): The hashes that hold a chain together are fine. The weak spot is the signature.
- [Money with no undo button](https://www.youtube.com/shorts/49ieQMZccig) (Short): A bank can give stolen card money back. Crypto has no bank in the middle to undo it.
- [What if you lose these 12 words?](https://www.youtube.com/shorts/djdNYtIh5Js) (Short): Lose your phone and the 12 words bring everything back. Lose the words too, and nobody can.
- [Your crypto address is a mailbox. Here's why that's safe #5](https://www.youtube.com/shorts/wmfaaGxGCvc) (Short): Anyone can drop a letter in, but only your private key opens it.
- [Your crypto isn't in your wallet. So where is it? #4](https://www.youtube.com/shorts/GIr8DnWCGf4) (Short): Your coins live on the blockchain. Your wallet holds the keys.
- [Crypto Wallets Explained in 3 Minutes](https://www.youtube.com/watch?v=oAh5KsM_rss) (3 min): A wallet holds no coins, only a key. What that means, and the words you must never lose.
- [Bitcoin vs Ethereum: who writes the next block? #3](https://www.youtube.com/shorts/GoxZPHeVdno) (Short): Proof of work and proof of stake: how each chain picks who writes the next page.
- [Why can't anyone secretly change a blockchain? #2](https://www.youtube.com/shorts/76WhSIgvGIg) (Short): Edit one page and every page after it breaks, so the change shows.
- [What if changing one letter changed everything?](https://www.youtube.com/shorts/TfnnjSYqtls) (Short): Change “Alex paid 10” to “11” and the whole hash changes with it.
- [Blockchain Explained in 3 Minutes](https://www.youtube.com/watch?v=2Hs-nu03aFE) (3 min): Blocks, hashes and why a chain is hard to change, for first-timers.
- [What happens when you send crypto?](https://www.youtube.com/shorts/2ntrt0bsP6k) (Short): From the send button to a block, in under a minute.

## Glossary

Each term has an anchor on https://hashspan.dev/learn, such as https://hashspan.dev/learn#term-span.

### First steps

- **Blockchain** (https://hashspan.dev/learn#term-blockchain): A shared record kept by many computers at once, written in blocks that are chained together by hashes. Explained in full: https://hashspan.dev/learn/what-is-a-blockchain.md
- **Block** (https://hashspan.dev/learn#term-block): A batch of transactions added to the chain together: one page of the shared notebook. Explained in full: https://hashspan.dev/learn/what-is-a-blockchain.md
- **Hash** (https://hashspan.dev/learn#term-hash): A short code calculated from data. Change the data even slightly and the code is completely different. Explained in full: https://hashspan.dev/learn/what-is-a-blockchain.md
- **Node** (https://hashspan.dev/learn#term-node): A computer that keeps its own copy of the blockchain and checks new blocks. Explained in full: https://hashspan.dev/learn/what-is-a-blockchain.md
- **Wallet** (https://hashspan.dev/learn#term-wallet): An app that holds your keys and shows what is yours on the blockchain. The coins stay on the blockchain. Explained in full: https://hashspan.dev/learn/what-is-a-crypto-wallet.md
- **Address** (https://hashspan.dev/learn#term-address): A public code that receives coins, made from your public key. Safe to share. Explained in full: https://hashspan.dev/learn/what-is-a-crypto-wallet.md
- **Private key** (https://hashspan.dev/learn#term-private-key): The secret number that signs your transactions, and so moves your coins. Never share it. Explained in full: https://hashspan.dev/learn/what-is-a-crypto-wallet.md
- **Seed phrase** (https://hashspan.dev/learn#term-seed-phrase): Also called a recovery phrase: usually 12 or 24 words that can rebuild your keys on another device. Never share it. Explained in full: https://hashspan.dev/learn/what-is-a-crypto-wallet.md
- **Transaction** (https://hashspan.dev/learn#term-transaction): A message signed with your private key that moves coins. It counts once a block includes it. Explained in full: https://hashspan.dev/learn/what-happens-when-you-send-crypto.md
- **Confirmation** (https://hashspan.dev/learn#term-confirmation): A block that holds your transaction or comes after it. One confirmation means it is in a block. Each one makes it harder to reverse. Explained in full: https://hashspan.dev/learn/what-happens-when-you-send-crypto.md

### OpenTelemetry

- **Span** (https://hashspan.dev/learn#term-span): One timed operation, such as a tool call or a transaction send, with a name, a start, an end and attributes. Explained in full: https://hashspan.dev/learn/otel-traces-and-spans.md
- **Trace** (https://hashspan.dev/learn#term-trace): Every span that shares one trace ID, such as all the work in one agent run. Explained in full: https://hashspan.dev/learn/otel-traces-and-spans.md
- **Span attribute** (https://hashspan.dev/learn#term-span-attribute): A key-value pair on a span, such as blockchain.tx.hash, that you search and group by. Explained in full: https://hashspan.dev/learn/otel-span-attributes.md
- **Span status** (https://hashspan.dev/learn#term-span-status): Unset, Error or Ok: whether the operation the span describes failed. Explained in full: https://hashspan.dev/learn/otel-span-status.md
- **Span event** (https://hashspan.dev/learn#term-span-event): A named, timestamped record inside one span, such as an exception. Explained in full: https://hashspan.dev/learn/otel-span-events.md
- **Span kind** (https://hashspan.dev/learn#term-span-kind): The role a span plays in a call: CLIENT, SERVER, INTERNAL, PRODUCER or CONSUMER. Explained in full: https://hashspan.dev/learn/otel-span-kind.md
- **Span link** (https://hashspan.dev/learn#term-span-link): A pointer from one span to another span's context, in the same trace or a different one. Explained in full: https://hashspan.dev/learn/otel-span-links.md
- **Context propagation** (https://hashspan.dev/learn#term-context-propagation): Carrying the active trace and span across await and, in headers such as traceparent, across processes. Explained in full: https://hashspan.dev/learn/otel-context-propagation.md
- **Baggage** (https://hashspan.dev/learn#term-baggage): Key-value pairs carried in the context and sent to downstream services. They reach a span only if code copies them. Explained in full: https://hashspan.dev/learn/otel-baggage.md
- **Resource** (https://hashspan.dev/learn#term-resource): Attributes that describe who emitted the telemetry, such as service.name, shared by every span from one SDK. Explained in full: https://hashspan.dev/learn/otel-resource-attributes.md
- **Semantic conventions** (https://hashspan.dev/learn#term-semantic-conventions): Agreed names for spans and attributes, such as error.type, each with a stability level. Explained in full: https://hashspan.dev/learn/otel-semantic-conventions.md
- **GenAI semantic conventions** (https://hashspan.dev/learn#term-genai-semantic-conventions): OpenTelemetry's names for LLM and agent work, such as invoke_agent, execute_tool and gen_ai.agent.id. Still in Development. Explained in full: https://hashspan.dev/learn/otel-semantic-conventions.md
- **Agent identity** (https://hashspan.dev/learn#term-agent-identity): Which agent did the work, recorded on spans as gen_ai.agent.id and gen_ai.agent.name. Explained in full: https://hashspan.dev/learn/otel-baggage.md
- **Sampling** (https://hashspan.dev/learn#term-sampling): Deciding which traces to keep: when a trace starts (head) or after its spans arrive (tail). Explained in full: https://hashspan.dev/learn/otel-sampling.md
- **OTLP** (https://hashspan.dev/learn#term-otlp): OpenTelemetry's protocol for sending telemetry to a backend, over HTTP or gRPC. Explained in full: https://hashspan.dev/learn/otel-exporters-otlp.md

### On-chain

- **Transaction hash** (https://hashspan.dev/learn#term-transaction-hash): The identifier a node returns as soon as it accepts a transaction, before anything has run. Explained in full: https://hashspan.dev/learn/tx-lifecycle.md
- **Mempool** (https://hashspan.dev/learn#term-mempool): The pool of pending transactions waiting to be included in a block. Explained in full: https://hashspan.dev/learn/tx-lifecycle.md
- **Receipt** (https://hashspan.dev/learn#term-receipt): The record of an included transaction's outcome: status, gas used, effective gas price and logs. Explained in full: https://hashspan.dev/learn/tx-lifecycle.md
- **Nonce** (https://hashspan.dev/learn#term-nonce): A sender's transaction counter. Two transactions with the same sender and nonce can't both be mined. Explained in full: https://hashspan.dev/learn/tx-lifecycle.md
- **Replaced transaction** (https://hashspan.dev/learn#term-replaced-transaction): A transaction whose nonce was taken by another one from the same sender, such as a speed-up or a cancel. Explained in full: https://hashspan.dev/learn/tx-lifecycle.md
- **Revert reason** (https://hashspan.dev/learn#term-revert-reason): Why a reverted transaction failed: an Error(string) message, a panic code or a custom error. Explained in full: https://hashspan.dev/docs/reference/semantic-conventions.md
- **Gas** (https://hashspan.dev/learn#term-gas): The unit of computation a transaction pays for. Gas used × effective gas price is its execution fee. Explained in full: https://hashspan.dev/learn/l1-data-fee.md
- **Effective gas price** (https://hashspan.dev/learn#term-effective-gas-price): The price per unit of gas a transaction actually paid: the base fee plus the priority fee. Explained in full: https://hashspan.dev/learn/l1-data-fee.md
- **L1 data fee** (https://hashspan.dev/learn#term-l1-data-fee): The part of an OP Stack transaction's cost that pays for publishing its data to Ethereum. Explained in full: https://hashspan.dev/learn/l1-data-fee.md
- **OP Stack** (https://hashspan.dev/learn#term-op-stack): The software behind rollups such as Base and OP Mainnet, which publish their transaction data to Ethereum. Explained in full: https://hashspan.dev/learn/l1-data-fee.md
- **x402** (https://hashspan.dev/learn#term-x402): An open protocol for paying for HTTP requests through the 402 Payment Required status code, so agents can pay per request. Explained in full: https://hashspan.dev/docs/adapters/x402.md
- **MPP** (https://hashspan.dev/learn#term-mpp): The Machine Payments Protocol: an API answers 402 Payment Required with a challenge, and the agent pays it on Tempo with a token transfer. Explained in full: https://hashspan.dev/docs/adapters/mpp.md
- **Agentic payments** (https://hashspan.dev/learn#term-agentic-payments): Payments that software agents make on their own, such as per-request API payments over x402 or MPP. Explained in full: https://hashspan.dev/docs/x402-tutorial.md
- **ERC-4337** (https://hashspan.dev/learn#term-erc-4337): An Ethereum standard for smart contract accounts that works without protocol changes, through user operations and bundlers. Explained in full: https://hashspan.dev/learn/erc-4337-user-operations.md
- **User operation** (https://hashspan.dev/learn#term-user-operation): The transaction-like object an ERC-4337 smart account signs. A bundler puts it on chain. Explained in full: https://hashspan.dev/learn/erc-4337-user-operations.md
- **Call batch** (https://hashspan.dev/learn#term-call-batch): Several calls sent to a wallet in one EIP-5792 request, tracked by a batch id instead of a transaction hash. Explained in full: https://hashspan.dev/learn/eip-5792-call-batches.md
- **EIP-7702 delegation** (https://hashspan.dev/learn#term-eip-7702-delegation): A regular account's pointer to contract code, set by a signed authorization in a type 4 transaction. Explained in full: https://hashspan.dev/learn/eip-7702-delegation.md
- **Flashblocks preconfirmation** (https://hashspan.dev/learn#term-flashblocks-preconfirmation): A receipt Base returns before the block is sealed. Its block hash is all zeros. Explained in full: https://hashspan.dev/learn/flashblocks-preconfirmations.md

## More

- [Docs](https://hashspan.dev/docs.md): install hashspan and trace your first transaction.
- [Blog](https://hashspan.dev/blog.md): deep dives on traces, fees, reverts and agent payments.
- [Errors](https://hashspan.dev/errors.md): transaction errors, each with the exact messages and the fix.
- [Error message decoder](https://hashspan.dev/errors/decode.md): paste an error and get the matching page.
