Quickstart

Minimal working example. One anchor, live output.

These examples run against Sepolia testnet (network="sepolia"). To run against Base mainnet: replace configure(network="sepolia") with configure(network="base"). All function calls, record structures, and output shapes are identical across networks.

[1]:
# Cell 1 — setup
from anchorregistry import configure, get_by_arid, BASE_SEPOLIA_RPC, V1A_BASE_SEPOLIA

configure(
    network="base-sepolia",
    contract_address=V1A_BASE_SEPOLIA,
    rpc_url=BASE_SEPOLIA_RPC,  # swap for Infura / Alchemy URL for faster scans
)

[2]:
# Cell 2 — fetch a single anchor
record = get_by_arid("AR-2026-dPXazj6")
record
[2]:
{'ar_id': 'AR-2026-dPXazj6',
 'registered': True,
 'artifact_type_index': 1,
 'artifact_type_name': 'RESEARCH',
 'tx': '0x826f623ce984a9cadeb5d72c710d279e7385cd83ee4815d092e393d5d574ec57',
 'block': 40225238,
 'registrant': '0xc7a7afde1177fbf0bb265ea5a616d1b8d7ed8c44',
 'manifest_hash': '981e16e83f1e0068d87a89e04962b9287bb5f024782beca6fec837304e8c308e',
 'parent_ar_id': '',
 'descriptor': '',
 'title': 'test sepolia anchor',
 'author': '',
 'tree_id': '0xf07140ce4deaf3b5dac859091a079f82e9656f173593feda7895d940b8fa5d13',
 'token_commitment': '0xf07140ce4deaf3b5dac859091a079f82e9656f173593feda7895d940b8fa5d13',
 'data': {'doi': '',
  'institution': '',
  'co_authors': '',
  'url': 'https://anchorregistry.com/'}}

Every record has two levels:

  • Universal fieldsar_id, title, author, artifact_type_name, manifest_hash, registrant, tree_id, parent_ar_id, token_commitment, block, tx

  • Type-specific fields — nested under record["data"], keys depend on artifact_type_name

For RESEARCH records, data contains: doi, institution, co_authors, url.

[3]:
# Cell 3 — error handling
from anchorregistry import AnchorNotFoundError, ConfigurationError

try:
    get_by_arid("AR-0000-INVALID")
except AnchorNotFoundError as e:
    print(f"AnchorNotFoundError: {e}")
AnchorNotFoundError: AR-ID not found on-chain: AR-0000-INVALID