Ethereum docs
Look up any call, event, or storage item with code examples. Runtime v472 · Block #9,197,056
Developer documentation for the Ethereum pallet of the Subtensor blockchain, part of the Bittensor decentralized AI network. This page is designed for developers integrating with the chain: look up any call, event, or storage item, copy code examples in TypeScript, Python, or Rust, and filter by your role. For in-depth explanations, version history, and relationships between items, see the Reference section.
Ethereum
Transact an Ethereum transaction.
Calls 1
Submits an Ethereum-format transaction for execution.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
transaction | TransactionV3 | — | transaction (TransactionV3) |
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Build transact call (typed, named args)
const transaction = undefined as any /* TransactionV3 — replace with real value */;
const tx = api.tx.Ethereum.transact({
transaction,
});Events 1
Emitted when an Ethereum-format transaction is processed.
When it fires
- Valid Ethereum tx
- Signature valid
- Sufficient gas balance
Fields
| Name | Type | Format | Description |
|---|---|---|---|
from | H160 | 160-bit Hash | Sender's Ethereum address (H160) |
to | H160 | 160-bit Hash | Recipient/contract address (H160) |
transaction_hash | H256 | 256-bit Hash | Ethereum transaction hash (H256) |
exit_reason | ExitReason | — | Execution result (Succeed, Revert, Fatal, Error) |
extra_data | Vec<u8> | Array of Integer (0-255) | Additional data like revert reason or return value |
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Subscribe to Executed events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Ethereum.Executed.get(block.hash);
for (const evt of events) {
console.log("Executed:", evt.payload);
}
});Storage 6
Maps Ethereum block numbers to their hashes.
H256 (256-bit Hash)Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | U256 | — | — |
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query BlockHash storage
const key1 = [0n, 0n, 0n, 0n] as [bigint, bigint, bigint, bigint];
const result = await api.query.Ethereum.BlockHash.getValue(key1);
console.log("BlockHash:", result);Counter tracking number of pending transactions.
u32 (Integer)import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query CounterForPending storage (no keys - plain value)
const result = await api.query.Ethereum.CounterForPending.getValue();
console.log("CounterForPending:", result);The current Ethereum block being built.
Block import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query CurrentBlock storage (no keys - plain value)
const result = await api.query.Ethereum.CurrentBlock.getValue();
console.log("CurrentBlock:", result);Transaction receipts for the current block.
Vec<ReceiptV4> (Array of ReceiptV4)import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query CurrentReceipts storage (no keys - plain value)
const result = await api.query.Ethereum.CurrentReceipts.getValue();
console.log("CurrentReceipts:", result);Transaction statuses for the current block.
Vec<TransactionStatus> (Array of TransactionStatus)import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query CurrentTransactionStatuses storage (no keys - plain value)
const result = await api.query.Ethereum.CurrentTransactionStatuses.getValue();
console.log("CurrentTransactionStatuses:", result);Pending Ethereum transactions in the current block being built.
(TransactionV3, TransactionStatus, ReceiptV4) Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | u32 | Integer | — |
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query Pending storage
const key1 = 0;
const result = await api.query.Ethereum.Pending.getValue(key1);
console.log("Pending:", result);Errors 2
The Ethereum transaction signature is invalid.
Common Causes
- Transaction modified after signing
- Wrong chain ID in signature
- Corrupted signature data
How to Fix
Re-sign the transaction,Verify chain ID matches,Check for data corruption
Pre-log exists, preventing transaction execution.
Common Causes
- Internal state issue during block building
How to Fix
Retry in next block,Report if persistent