Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.73 KB

File metadata and controls

40 lines (30 loc) · 1.73 KB

Register a Device

After binding a Device NFT contract to a DePIN project and requesting a specific number of ioIDs for the project, physical devices can be registered n the ioIDRegistry contract, effectively "activating" the ioID. This activation process is carried out by the device owner and involves minting an ioID NFT to the device owner's account. During the minting process the ioID is associated with a specific Device NFT token, where the device's DID (Decentralized Identifier) serves as the token's ID.

Contract Call

Contract: ioIDRegistry

Function Call: function register(address deviceContract, uint256 tokenId, address device, bytes32 hash, string calldata uri, uint8 v, bytes32 r, bytes32 s ) external

Example:

// Device NFT contract address
const deviceContract = "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef"; 
// Token ID of the Device NFT
const tokenId = 1; 
// Address of the device's DID
const device = "0x9876543210abcdef9876543210abcdef98765432"; 
// Example hash of the device DID document
const hash = ""; 
// IPFS URI of the DID document
const uri = "ipfs://QmTzQ1N12ucF18hTP8mViqU2LPoQzZiLjipMuYYgQ6gXht"; 
// Example signature value for v
const v = 27; 
// Example signature value for r
const r = "0x47a204cd03a7c45a3ad68ef3d5d8b979a4e84ebcd57934055050c2d2e5a6eaa5"; 
// Example signature value for s
const s = "0x2c4c75c3b79a5a8a2bb9cb1bb25a178fb20abbb0d1e6dd6c0c8b27ed5a9538b5"; 

// ...

// Function to register the device
const tx = await ioIDRegistry.register(deviceContract, tokenId, device, hash, uri, v, r, s);
        

{% hint style="info" %} → Learn more about how to implement device registration in your devices {% endhint %}