All pallets

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.

Index: 21 10 items

Calls 1

transact

call details

Submits an Ethereum-format transaction for execution.

Parameters

NameTypeFormatDescription
transactionTransactionV3—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

Executed

event details

Emitted when an Ethereum-format transaction is processed.

When it fires

  • Valid Ethereum tx
  • Signature valid
  • Sufficient gas balance

Fields

NameTypeFormatDescription
fromH160160-bit HashSender's Ethereum address (H160)
toH160160-bit HashRecipient/contract address (H160)
transaction_hashH256256-bit HashEthereum transaction hash (H256)
exit_reasonExitReason—Execution result (Succeed, Revert, Fatal, Error)
extra_dataVec<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

BlockHash

storage details

Maps Ethereum block numbers to their hashes.

Modifier: Default Keys: 1 Returns: H256 (256-bit Hash)

Keys

NameTypeFormatDescription
key1U256——
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);

CounterForPending

storage details

Counter tracking number of pending transactions.

Modifier: Default Keys: 0 Returns: 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);

CurrentBlock

storage details

The current Ethereum block being built.

Modifier: Optional Keys: 0 Returns: Block
Modified by: transact
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);

CurrentReceipts

storage details

Transaction receipts for the current block.

Modifier: Optional Keys: 0 Returns: Vec<ReceiptV4> (Array of ReceiptV4)
Modified by: transact
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);

CurrentTransactionStatuses

storage details

Transaction statuses for the current block.

Modifier: Optional Keys: 0 Returns: Vec<TransactionStatus> (Array of TransactionStatus)
Modified by: transact
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

storage details

Pending Ethereum transactions in the current block being built.

Modifier: Optional Keys: 1 Returns: (TransactionV3, TransactionStatus, ReceiptV4)

Keys

NameTypeFormatDescription
key1u32Integer—
Modified by: transact
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

InvalidSignature

error details #0

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

Thrown by: transact

PreLogExists

error details #1

Pre-log exists, preventing transaction execution.

Common Causes

  • Internal state issue during block building

How to Fix

Retry in next block,Report if persistent

Thrown by: transact