Skip to main content
Events are the atomic units of a machine’s financial history. The EventRegistry stores them (on peaq; a machine homed on Solana writes to the Solana EventRegistry program instead, see Solana onboarding); the scoring pipeline reads them to compute credit ratings.

Two event types

Both SDKs export these as constants:

MachineEvent schema

Every event stored in the EventRegistry follows this structure. The expose the stored struct as MachineEvent (with dataHash / data_hash as a 32-byte keccak256). The SDK input type SubmitEventParams takes rawData / raw_data bytes instead; the SDK computes the hash for you before the call.

Cross-chain revenue accounting

sourceChainId and sourceTxHash together form a cross-chain audit trail. When a machine earns revenue on , the proxy submits the event to the EventRegistry on with sourceChainId = 8453 and the Base transaction hash. Any verifier can look up the on the source chain and confirm the event happened.

Data integrity via dataHash

Raw event data stays with the project (in their database, behind their API). The dataHash stored onchain is keccak256(raw_data), computed by the SDK before submission. This keeps the raw data’s on-chain footprint, and its cost, at 32 bytes regardless of payload size (the event’s other fields and its metadata are stored in full), while anyone can fetch the raw data from the endpoint the machine’s publishes (data_api under Tokenomics 1.0, a serviceEndpoints entry under Economics 2.0) and verify keccak256(fetched_data) == dataHash.

Authorization

The Tokenomics 1.0 EventRegistry (0x43c6…) reads IdentityRegistry to verify submit authority. msg.sender must be one of: All three paths produce identical on-chain records: the machineId in the stored event always identifies the machine, regardless of who submitted. The Economics 2.0 EventRegistry (0xA1e7…) has no operator or machine-wallet path: msg.sender must be the machine’s NFT owner or its DID controller in MachineRegistry, otherwise the call reverts with NotOwnerOrController. The machine’s subscription must also be Active or Grace, otherwise it reverts with SubscriptionNotEligible. On the Solana EventRegistry program the signer must be the machine’s owner or controller; the program rejects anyone else with NotOwnerOrController.

Validation

The JS SDK exports validateSubmitEventParams, which checks all nine fields before any interaction:
Key validation rules:
  • eventType must be 0 or 1
  • value must be a non-negative integer (subunit, per ISO 4217 minor units)
  • trustLevel must be 0, 1, or 2
  • sourceChainId must be a supported chain (0, 3338, or 8453)
  • When trustLevel is 1 (on-chain verifiable), sourceTxHash is required
  • rawData must be non-empty when provided (null is allowed, empty array is not)
  • currency on revenue events must match ^[A-Z0-9]{3,10}$; on activity events it must be ""
  • timestamp must be a positive integer; the EventRegistry contract additionally rejects timestamp > block.timestamp (FutureTimestamp revert)
  • metadata is capped at 4096 bytes on peaq (MetadataTooLarge revert above the limit) and at 256 bytes on the Solana EventRegistry program; the currency rule is the same on both