Architecture
- Core contracts use UUPS upgradeable proxies (OpenZeppelin 5.x) with ERC-7201 namespaced storage. Future upgrades preserve state.
- ( by IdentityRegistry) and (minted by MachineNFT) are separate ERC-721 spaces with independent
tokenIdsequences linked bymachineId. See Machine NFT. - IdentityRegistry implements ERC-8004 for DID-anchored machine metadata; the JSON Machine Card is served by the .
peaq mainnet addresses
Set these in your environment. The reads them fromfromEnv() / from_env().
Core
Precompiles
Optional
Base mainnet addresses
Needed when bridging into peaq from . Pass asbaseNftAddress / base_nft_address to bridgeNft / bridge_nft.
Agung testnet addresses
Use these for development on . The contract surface matches mainnet; only the deployed addresses differ.Core
Precompiles
Identical to mainnet: same fixed addresses on every peaq runtime.Optional
Core contracts
IdentityRegistry
Central machine identity registry. Mints an ERC-721 Identity NFT to each machine on and orchestrates throughIdentityStaking.stakeFor(). Implements ERC-8004 so that each Identity NFT’s tokenURI resolves to the machine’s DID-anchored Machine Card. themselves live on the peaq DID precompile (W3C DID), written by the SDK via writeMachineDIDAttributes and read by the MCR API. Tracks per-machine status (None → Pending → Verified / Rejected / Deactivated). Supports self-registration and proxy registration.
SDK methods: registerMachine, registerFor
Key state: minBond (currently 1 PEAQ), nextMachineId, operatorOf, machineStatus
IdentityStaking
Bond token storage. Tokens are staked at registration time viastakeFor() and held permanently; no withdrawal path is exposed. Only authorized callers (IdentityRegistry) can initiate stakes. Supports pause / unpause by owner.
SDK interaction: Indirect. registerMachine / registerFor route the bond through here automatically.
EventRegistry
On-chain store for revenue (type0) and activity (type 1) . Gates event submission on (a) the machine being registered in IdentityRegistry, and (b) the machine being bonded in IdentityStaking. Authorization rule: msg.sender must be the machine or the . Stores a keccak256 of the raw data; payloads stay off-chain.
SDK methods: submitEvent, batchSubmitEvents
Concept: Events
MachineNFT
LayerZero V2 ONFT representing a machine’s financial profile. Minted in a separatemintNft call after registration: the Machine NFT tokenId is independent from the Identity NFT tokenId. tokenURI resolves to the MCR API’s /metadata/{token_id} endpoint, which returns the Machine Card.
SDK methods: mintNft, tokenIdOf
Concept: Machine NFT
Cross-chain contracts
MachineNFTAdapter (peaq)
WrapsMachineNFT for LayerZero V2 bridging. Lock/unlock pattern: locks the on peaq while the mirror exists on the destination chain. Needed only when bridging from peaq.
SDK methods: bridgeNft / bridge_nft when source is "peaq"
MachineNFTBase (Base)
StandardONFT721 on Base. Burn/mint pattern: NFT is burned when bridged back to peaq. Needed when bridging from Base.
SDK methods: bridgeNft / bridge_nft when source is "base" (pass the address as baseNftAddress / base_nft_address)
ERC-4337 smart accounts
MachineAccountFactory
CREATE2 factory for deployingMachineSmartAccount BeaconProxy instances. Standard ERC-4337 flow: smart accounts run through the canonical EntryPoint at 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 (same address across all networks).
SDK methods: deploySmartAccount / deploy_smart_account, getSmartAccountAddress / get_smart_account_address
MachineSmartAccount
The shared BeaconProxy implementation behind deployed smart accounts. Handles owner/machine RBAC and broad machine execution authority. Users never interact with the implementation directly; calls go to the deployed proxy.AdminFlags
Optional peaq-chain contract read by the MCR API server (not the SDK). Holds admin-set flags that modify responses: per-machinenegative_flags and trust-level overrides. MCR consumers see the adjusted score in their API response.
When the contract isn’t configured, contracts.admin_flags on GET /ready returns false and the service serves unmodified MCR. See API overview.
Precompiles (peaq chain)
LayerZero endpoints
Used by the bridge adapters. You don’t set these directly; the SDK handles them.
The SDK exports the EIDs as
LAYER_ZERO_EIDS (JS) / LAYERZERO_EIDS (Python) for reference.
Upgrade pattern
All core contracts (IdentityRegistry, IdentityStaking, EventRegistry, MachineNFT) use OpenZeppelin UUPS upgradeable proxies with ERC-7201 namespaced storage. Implementation slots are kept distinct by namespace, so future upgrades won’t collide with existing state. MachineSmartAccount uses a BeaconProxy pattern: a single implementation upgrade simultaneously applies to every deployed smart account.See also
Install
Wire the contract addresses into
.env for the SDK.SDK reference
Every method that reads or writes these contracts.
API reference
Off-chain reads derived from the on-chain state.

