Watermarking

Generate SPDX-Anchor and DAPX-Anchor tags for registered artifacts.

  • ``SPDX-Anchor`` — for CODE artifacts. Extends the SPDX standard with an on-chain anchor.

  • ``DAPX-Anchor`` — for all other artifact types.

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, watermark, 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 — RESEARCH type → DAPX-Anchor (auto-resolved from chain)
# Omit artifact_type — the function fetches the type from the contract
line = watermark("AR-2026-dPXazj6")
print(line)
# → DAPX-Anchor: anchorregistry.ai/AR-2026-D5bqN06
DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6
[3]:
# Cell 3 — pass artifact_type explicitly (skips on-chain lookup)
line = watermark("AR-2026-dPXazj6", artifact_type="RESEARCH")
print(line)
# → DAPX-Anchor: anchorregistry.ai/AR-2026-D5bqN06
DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6
[4]:
# Cell 4 — DATA type → DAPX-Anchor
line = watermark("AR-2026-86pNXz1")
print(line)
# → DAPX-Anchor: anchorregistry.ai/AR-2026-p12z0e1
DAPX-Anchor: anchorregistry.ai/AR-2026-86pNXz1
[5]:
# Cell 5 — CODE type → SPDX-Anchor (explicit type override)
# For CODE artifacts, watermark() produces an SPDX-Anchor tag
# which extends the SPDX licence header standard with an on-chain anchor
line = watermark("AR-2026-yPZBgoP")
print(line)
# → SPDX-Anchor: anchorregistry.ai/AR-2026-D5bqN06
SPDX-Anchor: anchorregistry.ai/AR-2026-yPZBgoP
[6]:
# Cell 6 — embed in a README or source file
readme_line = f"# My Project\n\n{watermark('AR-2026-dPXazj6')}"
print(readme_line)
# My Project

DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6