This page delineates a procedure to affirm the integrity and origin of machine-generated data within a blockchain network, emphasizing “Machine-Origin Authentication” as Tier 1 verification in a Decentralized Physical Infrastructure Network (DePIN).
The machine directly generates data, signs it using its secure private key, ensuring that the data is authentic and has not been altered. This constitutes a Tier 1 level of trust.NOTEData signing is an internal process of the machine. Here is a hypothetical code snippet to illustrate this step.
Copy
Ask AI
// Hypothetical snippet for data generation and signingimport { generateKeyPair } from "./utils.js";import { hexToU8a, u8aToHex } from "@polkadot/util";import { cryptoWaitReady } from "@polkadot/util-crypto";// Simulated machine data generation and signingconst generateAndSignData = async (machineSeed) => { await cryptoWaitReady(); const machineKeypair = generateKeyPair(machineSeed); const data = "Machine-generated data"; const dataHex = u8aToHex(JSON.stringify(data)); const signature = machineKeypair.sign(hexToU8a(dataHex)); return { dataHex, signature: u8aToHex(signature) };};
Signed data is stored on the blockchain, providing an immutable record that can be publicly verified, which is consistent with the principles of Tier 1 verification
Copy
Ask AI
// import necessary libraries and functionsimport fs from "fs/promises";import { generateKeyPair, makeExtrinsicCall } from "./utils.js";import { hexToU8a, u8aToHex } from "@polkadot/util";import { cryptoWaitReady } from "@polkadot/util-crypto";const store = async () => { await cryptoWaitReady(); const seeds = JSON.parse(await fs.readFile("seeds.json", "utf8")); const machineSeed = seeds.machine; const machineKeypair = generateKeyPair(machineSeed); const dataHex = u8aToHex(JSON.stringify("test-data")); const signature = u8aToHex(machineKeypair.sign(hexToU8a(dataHex))); const payload = { data: dataHex, signature: signature, }; // Serialize payload into hex format for storage const payloadHex = u8aToHex(JSON.stringify(payload)); await makeExtrinsicCall( "peaqStorage", "addItem", [machineKeypair.address, payloadHex], true, machineKeypair );};store();
4. Data Retrieval & Verification (Trust Verification)
Any network participant can retrieve the data and verify its authenticity using the public key associated with the machine’s digital identity. This verification step confirms the Tier 1 status of the data.
The system described here provides a secure method for registering machines and verifying the origin and integrity of their data using cryptographic signatures. This approach aligns with Tier 1 verification in DePIN projects, ensuring the highest level of trust in the data’s direct origin and secure transmission.
Ensure that all key pairs and sensitive information are handled securely.
Conduct thorough testing in a controlled environment before deploying to production.
Always keep up to date with the SDK and API documentation from the blockchain network you’re working with.
Developers should refer to the official documentation of the Polkadot.js API and the specific blockchain network for detailed instructions and best practices.Building upon the established structure of “Machine Data Verification on Blockchain,” we will now introduce the concept of Tier 2 verification, termed “Pattern Matching Validation.” This tier involves validating data that may not originate directly from the device but is relevant to existing devices within the network. The verification in this tier is accomplished by comparing incoming data patterns against known patterns from devices already registered in the system.