Event types
| Type | Value | Purpose | Example |
|---|---|---|---|
| Revenue | 0 | Records economic value generated by the machine | A claw machine collects $5.00 from a play session |
| Activity | 1 | Records operational activity with no direct revenue | A weather sensor reports a telemetry ping |
Trust levels
Each event carries a describing how the data was attested. See Trust levels for the concept overview.| Level | Value | Meaning | Needs source tx hash? |
|---|---|---|---|
| Self-reported | 0 | Machine self-reports. No external verification. | No |
| On-chain verifiable | 1 | Event references a verifiable on-chain transaction. | Yes |
| Hardware-signed | 2 | Event signed by tamper-resistant hardware. | No |
Currency and value units
currency is a first-class parameter on submitEvent / submit_event. Revenue events take a 3-10 char uppercase alphanumeric code (USD, HKD, JPY, …); activity events must pass "". The SDK applies a smart default when omitted on single-event submits (revenue → "USD", activity → ""); batchSubmitEvents / batch_submit_events requires it explicitly.
value is an ISO 4217 minor-unit integer:
| Currency | Subunit divisor | Example |
|---|---|---|
USD, HKD, EUR (and other 2-decimal currencies) | 100 | $1.23 → value: 123 |
JPY, KRW, VND (no subunits) | 1 | ¥100 → value: 100 |
BHD, KWD, OMR (3-decimal) | 1000 | BD 1.234 → value: 1234 |
value to USD cents using the FX rate at timestamp. The converted amount surfaces on GET /machine/{did} as usd_value (USD cents integer) on revenue events when data_visibility is onchain. amount_status distinguishes "ok", "unsupported_currency" (currency not in the FX whitelist), and "fx_unavailable" (degraded FX feed). Non-"ok" rows score conservatively and surface mcr_degraded: true on GET /mcr/{did}.
Activity events ignore the FX path entirely. They don’t accumulate revenue.
Validation
CallvalidateSubmitEventParams before submitting. It throws ValidationError on the first invalid field.
Validation rules
| Field | Constraint | Error if violated |
|---|---|---|
machineId / machine_id | Positive integer | machineId must be a positive integer |
eventType / event_type | 0 or 1 | eventType must be 0 or 1 |
value | Non-negative integer (ISO 4217 minor units) | value must be non-negative |
currency | Revenue: ^[A-Z0-9]{3,10}$. Activity: must be "". | currency must match ^[A-Z0-9]{3,10}$ / currency must be empty for activity events |
trustLevel / trust_level | 0, 1, or 2 | trustLevel must be 0, 1, or 2 |
sourceChainId / source_chain_id | 0, 3338, or 8453 | sourceChainId must be a supported chain ID |
rawData / raw_data | Non-empty when provided | rawData must not be empty when provided |
sourceTxHash / source_tx_hash | 0x-prefixed 32-byte hex (66 chars) when provided | sourceTxHash must be a 0x-prefixed 32-byte hex string |
timestamp | Positive integer | timestamp must be a positive integer |
sourceTxHash when trustLevel === 1 | Required | sourceTxHash is required when trustLevel is 1 |
metadata larger than 4096 bytes with a MetadataTooLarge . The SDK validators don’t enforce this client-side, so oversized payloads surface as a failure (RuntimeError/RpcError with code: "MetadataTooLarge") rather than ValidationError.
Computing the data hash
The EventRegistry stores a of the raw data, not the data itself. Compute it withcomputeDataHash (JS) or compute_data_hash (Python).
dataHash field in the on-chain MachineEvent struct. Consumers who need to verify the original data compare its keccak256 against the stored hash.
Submitting a revenue event (type 0)
Submitting an activity event (type 1)
Activity events record operational telemetry with no direct revenue value.Cross-chain revenue pattern
When a machine earns revenue on another (e.g., ), reference the source transaction for on-chain verifiable trust (level 1).Supported chain IDs
| Chain | ID |
|---|---|
peaq (same-chain, or use 0) | 3338 |
| Base | 8453 |
Operational limits
The SDK enforces per-transaction value caps and rate limits before submitting.| Limit | Error type | Description |
|---|---|---|
maxValuePerTx / max_value_per_tx | ValueCapExceeded | Single event value exceeds the per-transaction cap |
rateLimitMaxEvents / rate_limit_max_events | RateLimitExceeded | Too many events submitted within the rate-limit window |
0 to disable (the default).
Error handling
submitEvent / submit_event raise four distinct error types. Validation and limit errors are local; RuntimeError (JS) / RpcError (Python) wraps every chain or RPC failure. JS collapses chain and HTTP errors into a single RuntimeError; Python keeps them separate (RpcError for chain, ApiError for HTTP).
RuntimeError (JS) and RpcError/ApiError (Python).
Next steps
- Events concept for deeper coverage of event types and trust levels
- SDK reference for full method signatures

