npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@think-and-dev/peaq-gr-sdk

v3.1.0-beta.6

Published

JavaScript/TypeScript SDK for interacting with the get real campaign of Peaq Network

Readme

PEAQ Get Real SDK

A JavaScript/TypeScript SDK designed to interact with PEAQ Network's Get Real campaign, enabling seamless integration with precompiled contracts and decentralized identity (DID) management for machine verification.

Features

  • Machine Smart Account management for device authentication
  • Decentralized Identity (DID) handling for machine verification
  • Blockchain data storage for machine records
  • Multi-network support (mainnet and testnet)
  • Flexible chainId-based configuration
  • Get Real campaign integration for quests verification

Installation

npm install @think-and-dev/peaq-gr-sdk

Architecture

The SDK is organized into modular services, each handling specific aspects of machine verification and DID management:

Core Services

ConfigurationService

  • Manages global SDK configuration
  • Handles precompiled contract addresses based on chainId
  • Provides access to ethers accounts and provider
  • Configures network endpoints for Get Real campaign

TransactionService

  • Handles blockchain transaction management
  • Manages signatures and nonces
  • Processes transaction errors and retries

MachineAccountService

  • Deploys Smart Accounts for machine verification
  • Manages transaction execution through Smart Accounts
  • Interacts with MachineStationFactory contract for device registration

IdentityService

  • Manages machine DID creation
  • Handles email verification signatures
  • Prepares DID operations for machine verification
  • Integrates with Get Real campaign verification process

StorageService

  • Manages on-chain storage of machine verification data
  • Prepares storage operations for machine records
  • Handles machine verification status updates

Precompiled Contracts

The SDK interacts with two main precompiled contracts:

  1. DID Contract (0x800)

    • Manages decentralized identities for machines
    • Handles machine attribute registration
  2. Storage Contract (0x801)

    • Stores machine verification data
    • Manages machine records and verification history
    • Handles verification tags and metadata

Usage

Initialization

The SDK can be initialized in three ways:

  1. Using environment variables:
const sdk = PeaqSDK.fromEnv();
  1. Using partial configuration:
const sdk = PeaqSDK.fromConfig({
    machineStationFactoryContractAddress: "0x...",
    ownerPrivateKey: "0x...",
    machineOwnerPrivateKey: "0x...",
    apiKey: "your-api-key",
    projectApiKey: "your-project-api-key",
    depinSeed: "your-seed"
});
  1. Using complete configuration:
const sdk = new PeaqSDK({
    rpcUrl: "https://w3.agung.peaq.network",
    chainId: 33333,
    machineStationFactoryContractAddress: "0x...",
    ownerPrivateKey: "0x...",
    machineOwnerPrivateKey: "0x...",
    serviceUrl: "https://api.example.com",
    apiKey: "your-api-key",
    projectApiKey: "your-project-api-key",
    depinSeed: "your-seed"
});

Usage Examples

1. Deploy a Machine Smart Account for Verification

const machineAddress = await sdk.machineStationFactory.deploySmartAccount();
console.log("Machine Smart Account deployed at:", machineAddress);

2. Create a DID for Machine Verification

const didTransactionHash = await sdk.identity.createDID({
    didAddress: machineAddress,
    email: "[email protected]",
    tag: "machine-verification"
});
console.log("Machine DID created with transaction:", didTransactionHash);

3. Store Machine Verification Data

const storageTransactionHash = await sdk.storage.storeData({
    customTag: "VERIFICATION",
    email: "[email protected]",
    tag: "machine-verification",
    tags: ["verified-machine", "get-real-campaign"]
});
console.log("Verification data stored with transaction:", storageTransactionHash);

Network Configuration

The SDK supports different network configurations based on chainId:

// Precompiled addresses by network
const PEAQ_CHAIN_ADDRESSES = {
    // PEAQ Mainnet
    3338: {
        DID_CONTRACT: '0x0000000000000000000000000000000000000800',
        STORAGE_CONTRACT: '0x0000000000000000000000000000000000000801'
    },
    // AGUNG Testnet
    9990: {
        DID_CONTRACT: '0x0000000000000000000000000000000000000800',
        STORAGE_CONTRACT: '0x0000000000000000000000000000000000000801'
    }
};

Required Environment Variables

When using PeaqSDK.fromEnv(), the following variables are required:

RPC_URL=https://w3.agung.peaq.network
CHAIN_ID=33333
MACHINE_STATION_FACTORY_ADDRESS=0x...
OWNER_PRIVATE_KEY=0x...
MACHINE_OWNER_PRIVATE_KEY=0x...
SERVICE_URL=https://api.example.com
API_KEY=your-api-key
PROJECT_API_KEY=your-project-api-key
DEPIN_SEED=your-seed

Error Handling

The SDK includes specific error handling for various scenarios:

try {
    await sdk.machineStationFactory.deploySmartAccount();
} catch (error) {
    if (error.code === "ACTION_REJECTED") {
        console.log("Transaction rejected by user");
    } else if (error.code === "NETWORK_ERROR") {
        console.log("Network error occurred");
    } else {
        console.log("Unknown error:", error);
    }
}

License

MIT