{ "cells": [ { "cell_type": "markdown", "id": "e5f6a7b8-0005-0000-0000-000000000001", "metadata": {}, "source": [ "# Watermarking\n", "\n", "Generate `SPDX-Anchor` and `DAPX-Anchor` tags for registered artifacts.\n", "\n", "- **`SPDX-Anchor`** — for `CODE` artifacts. Extends the SPDX standard with an on-chain anchor.\n", "- **`DAPX-Anchor`** — for all other artifact types.\n", "\n", "> These examples run against Sepolia testnet (`network=\"sepolia\"`).\n", "> To run against Base mainnet: replace `configure(network=\"sepolia\")` with `configure(network=\"base\")`.\n", "> All function calls, record structures, and output shapes are identical across networks." ] }, { "cell_type": "code", "execution_count": 1, "id": "e5f6a7b8-0005-0000-0000-000000000002", "metadata": {}, "outputs": [], "source": [ "# Cell 1 — setup\n", "from anchorregistry import configure, watermark, BASE_SEPOLIA_RPC, V1A_BASE_SEPOLIA\n", "\n", "configure(\n", " network=\"base-sepolia\",\n", " contract_address=V1A_BASE_SEPOLIA,\n", " rpc_url=BASE_SEPOLIA_RPC, # swap for Infura / Alchemy URL for faster scans\n", ")\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "e5f6a7b8-0005-0000-0000-000000000003", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6\n" ] } ], "source": [ "# Cell 2 — RESEARCH type → DAPX-Anchor (auto-resolved from chain)\n", "# Omit artifact_type — the function fetches the type from the contract\n", "line = watermark(\"AR-2026-dPXazj6\")\n", "print(line)\n", "# → DAPX-Anchor: anchorregistry.ai/AR-2026-D5bqN06" ] }, { "cell_type": "code", "execution_count": 3, "id": "e5f6a7b8-0005-0000-0000-000000000004", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6\n" ] } ], "source": [ "# Cell 3 — pass artifact_type explicitly (skips on-chain lookup)\n", "line = watermark(\"AR-2026-dPXazj6\", artifact_type=\"RESEARCH\")\n", "print(line)\n", "# → DAPX-Anchor: anchorregistry.ai/AR-2026-D5bqN06" ] }, { "cell_type": "code", "execution_count": 4, "id": "e5f6a7b8-0005-0000-0000-000000000005", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DAPX-Anchor: anchorregistry.ai/AR-2026-86pNXz1\n" ] } ], "source": [ "# Cell 4 — DATA type → DAPX-Anchor\n", "line = watermark(\"AR-2026-86pNXz1\")\n", "print(line)\n", "# → DAPX-Anchor: anchorregistry.ai/AR-2026-p12z0e1" ] }, { "cell_type": "code", "execution_count": 5, "id": "e5f6a7b8-0005-0000-0000-000000000006", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SPDX-Anchor: anchorregistry.ai/AR-2026-yPZBgoP\n" ] } ], "source": [ "# Cell 5 — CODE type → SPDX-Anchor (explicit type override)\n", "# For CODE artifacts, watermark() produces an SPDX-Anchor tag\n", "# which extends the SPDX licence header standard with an on-chain anchor\n", "line = watermark(\"AR-2026-yPZBgoP\")\n", "print(line)\n", "# → SPDX-Anchor: anchorregistry.ai/AR-2026-D5bqN06" ] }, { "cell_type": "code", "execution_count": 6, "id": "e5f6a7b8-0005-0000-0000-000000000007", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# My Project\n", "\n", "DAPX-Anchor: anchorregistry.ai/AR-2026-dPXazj6\n" ] } ], "source": [ "# Cell 6 — embed in a README or source file\n", "readme_line = f\"# My Project\\n\\n{watermark('AR-2026-dPXazj6')}\"\n", "print(readme_line)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.15" } }, "nbformat": 4, "nbformat_minor": 5 }