Skip to main content
Tier 1 verification, machine-origin authentication, proves that data came from a specific machine and has not been altered. The machine signs its own data, and anyone can check that signature against the machine’s onchain identity.

Overview

  • Registration: the machine is registered onchain with a DID.
  • Data generation and signing: the machine generates data and signs it with its private key.
  • Data storage: the signed payload is written to chain storage.
  • Retrieval and verification: any party reads the payload back and checks the signature.

Prerequisites

  • A Node.js environment.
  • The @peaq-network/sdk, @polkadot/keyring, @polkadot/util, and @polkadot/util-crypto packages installed.
  • A seeds.json file holding the owner’s and the machine’s account seeds. Both accounts need agung tokens for fees: the owner signs the registration in step 1 and the machine signs the storage write in step 3. See Get test tokens.

1. Registration

The owner registers the machine onchain, creating the identity the rest of the flow verifies against.

2. Data generation and signing

The machine signs the data it generates with its private key. Signing happens inside the machine, so the snippet below only illustrates the shape of that step.

3. Data storage

The signed payload goes into chain storage, where anyone can read it back.

4. Retrieval and verification

Any network participant reads the payload back and checks the signature against the public key of the machine’s identity.

Handling keys

The examples read account seeds from a seeds.json file for brevity. Keep machine and owner seeds out of source control and out of shared machines: anyone holding the machine seed can sign data as that machine.