Skip to main content
P-256, also called secp256r1, is widely supported by secure elements, TPMs, passkeys, mobile secure enclaves, and industrial hardware. On peaq, you can use it to verify that a machine action was signed by the private key associated with an enrolled P-256 public key.
P-256 verification is available on peaq mainnet (chain ID 3338) today. The audited Daimo verifier is deployed at 0xc2b78104907F722DABAc4C69f826a522B2754De4.
P-256 signatures move from machine hardware through application policy to onchain verification and authorization.

How verification works

  1. A machine hashes an action and signs the hash with a P-256 private key held by its secure hardware.
  2. The application checks its policy, including the active public key, chain ID, nonce, expiry, and revocation status.
  3. A smart contract verifies the signature onchain.
  4. The application authorizes the requested payment, command, access, or data operation.
P-256 proves possession of the private key. It does not prove that the key came from genuine hardware; use trusted enrollment or hardware attestation when provenance matters.

Choose an integration path

Gas usage varies with compiler settings and input data. Do not call 0x100 on peaq until the precompile is announced as live.

Use OpenZeppelin P256

OpenZeppelin Contracts 5.1 or later provides a portable P256.verify() function. It checks for the RIP-7212 precompile and falls back to its Solidity implementation when the precompile is unavailable.
P256Example.sol
The same deployed contract will use the lower-cost native path after the RIP-7212 precompile becomes available.

Call the mainnet verifier directly

The Daimo singleton accepts the RIP-7212-shaped 160-byte payload directly. There is no function selector or ABI wrapper.
PeaqP256Verifier.sol
The result check handles both verifier outputs safely: the singleton returns a 32-byte 0 for an invalid signature, while a conforming RIP-7212 precompile returns empty output.

Build the 160-byte input

Concatenate five 32-byte, big-endian fields in this exact order:
The verifier does not hash the message for you. For a plain ECDSA-SHA256 flow, pass sha256(message). For WebAuthn, construct the signed hash according to the WebAuthn assertion format.
Before submitting the payload:
  • Decode DER signatures into raw r and s values.
  • Remove the 0x04 prefix from an uncompressed SEC1 public key. Decompress compressed keys offchain.
  • Confirm the stored public key is active for the machine and the requested action.

Verify through an RPC call

Use eth_call when verification is needed offchain. It executes the verifier without submitting a transaction or spending gas.
ethers.ts
Each input value in the example must be a 32-byte hex string.

Production checklist

  • Bind each public key to the intended machine identity through an authenticated enrollment flow.
  • Include the application domain, peaq chain ID, action, nonce, and expiry in the signed data.
  • Store or invalidate nonces to prevent replay attacks.
  • Define key rotation and revocation before accepting signatures in production.
  • Do not use signature bytes as a unique identifier; P-256 signatures can be malleable.
  • Require hardware attestation when you need proof of device provenance, not only proof of key possession.

References