Help us shape the future of Go! Take the 2026 Go Developer Survey

erc8004

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IdentityRegistryBaseSepolia is the ERC-8004 Identity Registry on Base Sepolia.
	IdentityRegistryBaseSepolia = "0x8004A818BFB912233c491871b3d84c89A494BD9e"

	// ReputationRegistryBaseSepolia is the ERC-8004 Reputation Registry on Base Sepolia.
	ReputationRegistryBaseSepolia = "0x8004B663056A597Dffe9eCcC1965A193B7388713"

	// ValidationRegistryBaseSepolia is the ERC-8004 Validation Registry on Base Sepolia.
	ValidationRegistryBaseSepolia = "0x8004CB39f29c09145F24Ad9dDe2A108C1A2cdfC5"

	// DefaultRPCURL is the default JSON-RPC endpoint for Base Sepolia.
	DefaultRPCURL = "https://sepolia.base.org"

	// BaseSepoliaChainID is the EIP-155 chain ID for Base Sepolia.
	BaseSepoliaChainID = 84532
)
View Source
const RegistrationType = "https://eips.ethereum.org/EIPS/eip-8004#registration-v1"

RegistrationType is the canonical type URI for ERC-8004 registration v1.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRegistration

type AgentRegistration struct {
	Type           string       `json:"type"`                     // REQUIRED
	Name           string       `json:"name"`                     // REQUIRED
	Description    string       `json:"description,omitempty"`    // REQUIRED (omitempty for parsing)
	Image          string       `json:"image,omitempty"`          // REQUIRED (omitempty for parsing)
	Services       []ServiceDef `json:"services"`                 // REQUIRED (>=1)
	X402Support    bool         `json:"x402Support"`              // REQUIRED
	Active         bool         `json:"active"`                   // REQUIRED
	Registrations  []OnChainReg `json:"registrations,omitempty"`  // REQUIRED (>=1, omitempty for parsing)
	SupportedTrust []string     `json:"supportedTrust,omitempty"` // OPTIONAL
}

AgentRegistration is the JSON schema for the agent registration document served at agentURI (e.g., /.well-known/agent-registration.json). Conforms to ERC-8004 "Trustless Agents" registration format.

REQUIRED fields per spec: type, name, description, image, services (>=1), x402Support, active, registrations (>=1). OPTIONAL: supportedTrust.

Note: Description and Image use omitempty for parsing flexibility but MUST be populated when producing registration documents.

Spec: https://eips.ethereum.org/EIPS/eip-8004

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client interacts with the ERC-8004 Identity Registry on Base Sepolia.

func NewClient

func NewClient(ctx context.Context, rpcURL string) (*Client, error)

NewClient connects to rpcURL and binds to the Identity Registry contract.

func (*Client) Close

func (c *Client) Close()

Close releases the underlying RPC connection.

func (*Client) GetMetadata

func (c *Client) GetMetadata(ctx context.Context, agentID *big.Int, k string) ([]byte, error)

GetMetadata reads metadata for the given key from the agent NFT.

func (*Client) Register

func (c *Client) Register(ctx context.Context, key *ecdsa.PrivateKey, agentURI string) (*big.Int, error)

Register mints a new agent NFT with the given agentURI. Returns the minted agentId (token ID).

func (*Client) SetAgentURI

func (c *Client) SetAgentURI(ctx context.Context, key *ecdsa.PrivateKey, agentID *big.Int, uri string) error

SetAgentURI updates the agentURI for an existing agent NFT.

func (*Client) SetMetadata

func (c *Client) SetMetadata(ctx context.Context, key *ecdsa.PrivateKey, agentID *big.Int, k string, v []byte) error

SetMetadata stores arbitrary key-value metadata on the agent NFT.

func (*Client) TokenURI

func (c *Client) TokenURI(ctx context.Context, agentID *big.Int) (string, error)

TokenURI returns the ERC-721 tokenURI for the agent NFT.

type OnChainReg

type OnChainReg struct {
	AgentID       int64  `json:"agentId"`       // ERC-721 tokenId
	AgentRegistry string `json:"agentRegistry"` // CAIP-10 format: "eip155:84532:0x8004A818..."
}

OnChainReg links the registration to its on-chain record.

type ServiceDef

type ServiceDef struct {
	Name     string   `json:"name"`               // e.g., "web", "A2A", "MCP", "OASF"
	Endpoint string   `json:"endpoint,omitempty"` // full URL (omitempty for OASF entries)
	Version  string   `json:"version,omitempty"`  // protocol version (SHOULD per spec)
	Skills   []string `json:"skills,omitempty"`   // OASF skill taxonomy paths
	Domains  []string `json:"domains,omitempty"`  // OASF domain taxonomy paths
}

ServiceDef describes an endpoint the agent exposes. For OASF entries (name="OASF"), Skills and Domains provide machine-readable taxonomy for agent discovery. See https://schema.oasf.outshift.com/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL