Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ npx skills add base/base-skills
|Specifications/Specifications/Base Protocol/Bridging:specifications/base-protocol/bridging/standard-bridges,specifications/base-protocol/bridging/deposits,specifications/base-protocol/bridging/withdrawals,specifications/base-protocol/bridging/cross-domain-messengers,specifications/base-protocol/bridging/base-solana-bridge
|Specifications/Specifications/Base Protocol/Proofs:specifications/base-protocol/proofs/overview,specifications/base-protocol/proofs/challenger,specifications/base-protocol/proofs/proposer,specifications/base-protocol/proofs/registrar,specifications/base-protocol/proofs/tee-prover,specifications/base-protocol/proofs/zk-prover,specifications/base-protocol/proofs/proof-contracts
|Specifications/Specifications/B20:specifications/b20/specification-overview,specifications/b20/reference/constants-addresses,specifications/b20/reference/errors-events,specifications/b20/reference/invariants-tests,specifications/b20/changelog
|Specifications/Specifications/B20/Interfaces:specifications/b20/reference/interfaces/i-activation-registry,specifications/b20/reference/interfaces/ib20,specifications/b20/reference/interfaces/ib20-asset,specifications/b20/reference/interfaces/ib20-factory,specifications/b20/reference/interfaces/ib20-stablecoin,specifications/b20/reference/interfaces/i-policy-registry
|Specifications/Specifications/B20/Interfaces:specifications/b20/reference/interfaces/i-activation-registry/index,specifications/b20/reference/interfaces/ib20/index,specifications/b20/reference/interfaces/ib20-asset/index,specifications/b20/reference/interfaces/ib20-factory/index,specifications/b20/reference/interfaces/ib20-stablecoin/index,specifications/b20/reference/interfaces/i-policy-registry/index
|Specifications/Specifications/Transactions:specifications/transactions/transaction-ordering,specifications/transactions/transaction-finality,specifications/transactions/network-fees,specifications/transactions/throughput-and-limits,specifications/transactions/troubleshooting-transactions
|Specifications/Specifications/Builder Codes:specifications/builder-codes/overview,specifications/builder-codes/for-app-developers,specifications/builder-codes/for-wallet-developers,specifications/builder-codes/for-agent-developers
|Specifications/Specifications/Validity Transactions:specifications/build-transaction/validity-transactions,specifications/build-transaction/build-a-validity-transaction,specifications/build-transaction/base_sendRawTransactionValidity,specifications/build-transaction/fees-ordering-and-lifecycle,specifications/build-transaction/predicates-and-safety,specifications/build-transaction/troubleshooting
|Specifications/Reference:specifications/reference/base-contracts,specifications/reference/smart-contracts,specifications/reference/configuration,specifications/reference/glossary
|Specifications/Node Operators:specifications/node-operators/run-a-node,specifications/node-operators/performance-tuning,specifications/node-operators/snapshots,specifications/node-operators/troubleshooting
|Specifications/Security:specifications/security/security-council-for-base,specifications/security/avoid-malicious-flags,specifications/security/report-a-vulnerability
Expand Down
11 changes: 11 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@
"specifications/builder-codes/for-wallet-developers",
"specifications/builder-codes/for-agent-developers"
]
},
{
"group": "Validity Transactions",
"pages": [
"specifications/build-transaction/validity-transactions",
"specifications/build-transaction/build-a-validity-transaction",
"specifications/build-transaction/base_sendRawTransactionValidity",
"specifications/build-transaction/fees-ordering-and-lifecycle",
"specifications/build-transaction/predicates-and-safety",
"specifications/build-transaction/troubleshooting"
]
}
]
},
Expand Down
26 changes: 20 additions & 6 deletions docs/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,17 @@ const client = createPublicClient({ chain: base, transport: http() })

##### Interfaces

- [IActivationRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-activation-registry): Generated B20 reference for IActivationRegistry functions, events, and errors.
- [IActivationRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-activation-registry/index): Generated B20 reference for IActivationRegistry functions, events, and errors.

- [IB20 Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20): Generated B20 reference for IB20 functions, events, and errors.
- [IB20 Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20/index): Generated B20 reference for IB20 functions, events, and errors.

- [IB20Asset Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-asset): Generated B20 reference for IB20Asset functions, events, and errors.
- [IB20Asset Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-asset/index): Generated B20 reference for IB20Asset functions, events, and errors.

- [IB20Factory Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-factory): Generated B20 reference for IB20Factory functions, events, and errors.
- [IB20Factory Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-factory/index): Generated B20 reference for IB20Factory functions, events, and errors.

- [IB20Stablecoin Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-stablecoin): Generated B20 reference for IB20Stablecoin functions, events, and errors.
- [IB20Stablecoin Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-stablecoin/index): Generated B20 reference for IB20Stablecoin functions, events, and errors.

- [IPolicyRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-policy-registry): Generated B20 reference for IPolicyRegistry functions, events, and errors.
- [IPolicyRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-policy-registry/index): Generated B20 reference for IPolicyRegistry functions, events, and errors.

- [Constants & Addresses](https://docs.base.org/specifications/b20/reference/constants-addresses): Copy B20 precompile addresses, roles, policy scopes, variant bytes, policy IDs, and supply-cap constants.

Expand Down Expand Up @@ -326,6 +326,20 @@ const client = createPublicClient({ chain: base, transport: http() })

- [Builder Codes for Agent Developers](https://docs.base.org/specifications/builder-codes/for-agent-developers): Attribute your AI agent's onchain transactions to your identity on Base and unlock analytics and leaderboard features.

#### Validity Transactions

- [Overview](https://docs.base.org/specifications/build-transaction/validity-transactions): Submit signed transactions that Base considers when onchain conditions match.

- [Build a Validity Transaction](https://docs.base.org/specifications/build-transaction/build-a-validity-transaction): Sign and submit a validity transaction with Viem.

- [Validity Transaction RPC](https://docs.base.org/specifications/build-transaction/base_sendRawTransactionValidity): Submit a signed raw transaction with validity predicates.

- [Fees, Ordering, and Lifecycle](https://docs.base.org/specifications/build-transaction/fees-ordering-and-lifecycle): Understand fees, expiry, and replacement for validity transactions.

- [Predicates and Safety](https://docs.base.org/specifications/build-transaction/predicates-and-safety): Use validity predicates safely.

- [Troubleshooting](https://docs.base.org/specifications/build-transaction/troubleshooting): Diagnose validity transaction submission and inclusion issues.

### Reference

- [Contract Addresses](https://docs.base.org/specifications/reference/base-contracts): A comprehensive list of contract addresses for Base Mainnet and Base Testnet, including links to their respective blockchain explorers.
Expand Down
26 changes: 20 additions & 6 deletions docs/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@

##### Interfaces

- [IActivationRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-activation-registry): Generated B20 reference for IActivationRegistry functions, events, and errors.
- [IActivationRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-activation-registry/index): Generated B20 reference for IActivationRegistry functions, events, and errors.

- [IB20 Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20): Generated B20 reference for IB20 functions, events, and errors.
- [IB20 Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20/index): Generated B20 reference for IB20 functions, events, and errors.

- [IB20Asset Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-asset): Generated B20 reference for IB20Asset functions, events, and errors.
- [IB20Asset Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-asset/index): Generated B20 reference for IB20Asset functions, events, and errors.

- [IB20Factory Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-factory): Generated B20 reference for IB20Factory functions, events, and errors.
- [IB20Factory Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-factory/index): Generated B20 reference for IB20Factory functions, events, and errors.

- [IB20Stablecoin Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-stablecoin): Generated B20 reference for IB20Stablecoin functions, events, and errors.
- [IB20Stablecoin Reference](https://docs.base.org/specifications/b20/reference/interfaces/ib20-stablecoin/index): Generated B20 reference for IB20Stablecoin functions, events, and errors.

- [IPolicyRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-policy-registry): Generated B20 reference for IPolicyRegistry functions, events, and errors.
- [IPolicyRegistry Reference](https://docs.base.org/specifications/b20/reference/interfaces/i-policy-registry/index): Generated B20 reference for IPolicyRegistry functions, events, and errors.

- [Constants & Addresses](https://docs.base.org/specifications/b20/reference/constants-addresses): Copy B20 precompile addresses, roles, policy scopes, variant bytes, policy IDs, and supply-cap constants.

Expand Down Expand Up @@ -260,6 +260,20 @@

- [Builder Codes for Agent Developers](https://docs.base.org/specifications/builder-codes/for-agent-developers): Attribute your AI agent's onchain transactions to your identity on Base and unlock analytics and leaderboard features.

#### Validity Transactions

- [Overview](https://docs.base.org/specifications/build-transaction/validity-transactions): Submit signed transactions that Base considers when onchain conditions match.

- [Build a Validity Transaction](https://docs.base.org/specifications/build-transaction/build-a-validity-transaction): Sign and submit a validity transaction with Viem.

- [Validity Transaction RPC](https://docs.base.org/specifications/build-transaction/base_sendRawTransactionValidity): Submit a signed raw transaction with validity predicates.

- [Fees, Ordering, and Lifecycle](https://docs.base.org/specifications/build-transaction/fees-ordering-and-lifecycle): Understand fees, expiry, and replacement for validity transactions.

- [Predicates and Safety](https://docs.base.org/specifications/build-transaction/predicates-and-safety): Use validity predicates safely.

- [Troubleshooting](https://docs.base.org/specifications/build-transaction/troubleshooting): Diagnose validity transaction submission and inclusion issues.

### Reference

- [Contract Addresses](https://docs.base.org/specifications/reference/base-contracts): A comprehensive list of contract addresses for Base Mainnet and Base Testnet, including links to their respective blockchain explorers.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "Validity Transaction RPC"
sidebarTitle: "Validity Transaction RPC"
description: "Submit a signed raw transaction with validity predicates."
---

Submits a signed legacy, EIP-2930, or EIP-1559 transaction with predicates that control when Base can include it. EIP-1559 is recommended.

<Warning>
This experimental method is currently available on Vibenet. The production API contract is not yet confirmed.
</Warning>

## Parameters

Pass two parameters. The first is a signed, serialized transaction. The second contains a non-empty `validity` array.

<RequestExample>
```json Request lines wrap expandable

Check warning on line 18 in docs/specifications/build-transaction/base_sendRawTransactionValidity.mdx

View workflow job for this annotation

GitHub Actions / Docs Style / Conformance

Docs style

[codeblock/highlight] Consider `highlight={}` to draw attention to key lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "base_sendRawTransactionValidity",
"params": [
"0x<signed-raw-transaction>",
{
"validity": [
{
"type": "storage",
"params": {
"address": "0x8ba1f109551bD432803012645Ac136ddd64DBA72",
"slot": "0x8",
"mask": "0xff",
"op": "=",
"value": "0x2a"
}
}
]
}
]
}
```
</RequestExample>

## Predicates

| Type | Parameters |
| --- | --- |
| `balance` | `address`, `op`, `value` |
| `storage` | `address`, `slot`, `op`, `value`, optional `mask` |
| `block_number` | `op`, `value` |
Comment thread
soheimam marked this conversation as resolved.
| `flashblock_index` | `op`, `value` |

The supported operators are `<`, `<=`, `=`, `!=`, `>`, and `>=`. Predicate values use `0x`-prefixed hexadecimal strings. The `mask` defaults to all ones.

## Returns

<ResponseField name="result" type="string">
The 32-byte hash of the submitted transaction.
</ResponseField>

Returning a hash confirms acceptance. It does not confirm inclusion.

## Errors

The method returns JSON-RPC errors. Handle an unavailable method, invalid parameters, and a missing transaction hash.

Error codes and messages are not yet stable.

Read [Predicates and Safety](/specifications/build-transaction/predicates-and-safety) for evaluation rules. Read [Troubleshooting](/specifications/build-transaction/troubleshooting) when a transaction is not included.
104 changes: 104 additions & 0 deletions docs/specifications/build-transaction/build-a-validity-transaction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: "Build a Validity Transaction"
description: "Sign and submit a validity transaction with Viem."
---

This guide uses an EIP-1559 transaction with Viem because it is the recommended transaction type. The API also supports signed legacy and EIP-2930 transactions.

<Warning>
Validity Transactions are experimental. `base_sendRawTransactionValidity` is currently available on Vibenet.
</Warning>

## 1. Create Predicates

Use `balance` or `storage` to wait for account or contract state. Use `block_number` and `flashblock_index` to constrain the candidate position. Every predicate must match.

```ts Predicate setup lines wrap expandable

Check warning on line 16 in docs/specifications/build-transaction/build-a-validity-transaction.mdx

View workflow job for this annotation

GitHub Actions / Docs Style / Conformance

Docs style

[codeblock/highlight] Consider `highlight={}` to draw attention to key lines
import type { Address, Hex } from 'viem';

const validity = [
{
type: 'balance',
params: {
address: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' as Address,
op: '>=',
value: '0x1' as Hex,
},
},
{
type: 'storage',
params: {
address: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' as Address,
slot: '0x8' as Hex,
op: '=',
value: '0x2a' as Hex,
},
},
{
type: 'block_number',
params: { op: '<=', value: '0x11a6a1' as Hex },
},
{
type: 'flashblock_index',
params: { op: '<=', value: '0x2' as Hex },
},
] as const;
```

Omit `mask` to compare the full storage word. Use `flashblock_index` to target a position within a Flashblock.

## 2. Sign an EIP-1559 Transaction

Use the sender's next nonce. The signed payload becomes the first RPC parameter.

```ts Sign transaction lines wrap expandable

Check warning on line 54 in docs/specifications/build-transaction/build-a-validity-transaction.mdx

View workflow job for this annotation

GitHub Actions / Docs Style / Conformance

Docs style

[codeblock/highlight] Consider `highlight={}` to draw attention to key lines
import { createPublicClient, http, type Chain } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';

const client = createPublicClient({ chain, transport: http(rpcUrl) });
const account = privateKeyToAccount(privateKey);
const fees = await client.estimateFeesPerGas();
const nonce = await client.getTransactionCount({
address: account.address,
blockTag: 'latest',
});

const rawTransaction = await account.signTransaction({
chainId: (chain as Chain).id,
type: 'eip1559',
nonce,
to: '0x...' as Address,
data: '0x...' as Hex,
value: 0n,
gas: 100_000n,
maxFeePerGas: fees.maxFeePerGas,
maxPriorityFeePerGas: fees.maxPriorityFeePerGas,
});
```

## 3. Submit the Transaction

Pass the signed transaction and `validity` as separate parameters.

```ts Submit transaction lines wrap expandable

Check warning on line 83 in docs/specifications/build-transaction/build-a-validity-transaction.mdx

View workflow job for this annotation

GitHub Actions / Docs Style / Conformance

Docs style

[codeblock/highlight] Consider `highlight={}` to draw attention to key lines
const response = await fetch(rpcUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'base_sendRawTransactionValidity',
params: [rawTransaction, { validity }],
}),
});

const body = await response.json();
if (body.error) throw new Error(body.error.message);
const hash = body.result;
```

## 4. Check Inclusion

The RPC returns a transaction hash. Use [`eth_getTransactionReceipt`](/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionReceipt) to check for an onchain receipt.

For field definitions, see [Validity Transaction RPC](/specifications/build-transaction/base_sendRawTransactionValidity).
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Fees, Ordering, and Lifecycle"
description: "Understand fees, expiry, and replacement for validity transactions."
---

## Fees

Transactions use the normal fee rules for their type. For EIP-1559 transactions, set `maxFeePerGas` and `maxPriorityFeePerGas` on the signed transaction.

A transaction that is not included does not pay onchain execution fees. An included transaction pays normal execution fees, even if it reverts.

## Ordering

A transaction competes for inclusion only after every predicate matches. A matching predicate does not reserve block space.

## Expiry

Add a `block_number` predicate with a maximum block to limit a transaction's lifetime. Combine it with `flashblock_index` to tighten the expiry bound to a position within that block's Flashblocks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we typically capitalize flashblock.


## Replacement

A later transaction with the same sender and nonce can replace a pending transaction. If the RPC returns an underpriced-replacement error, increase the fee fields, sign again, and retry.
Loading
Loading