infrablockchain-docs
en
en
  • InfraBlockchain
    • Learn
      • Architecture
        • Architecture
        • Network Participants
        • Parachain
          • System Parachains
      • Protocol
        • System Token
        • Transaction Fee
        • Proof of Transaction
      • Substrate
        • Learn
          • Basic
            • Cryptography
            • Blockchain Basics
            • Consensus
            • Networks and Nodes
            • Blockchain Transaction
            • Transaction Life Cycle
            • Offchain Operations
            • Light Client
            • Rust for Substrate
            • Introduction to Library
            • Architecture and Rust Libraries
            • File Architecture
            • Accounts, Addresses, and Keys
            • Transaction Format
            • Blockchain Randomness
          • FRAME
            • FRAME Pallets
            • FRAME Macros
            • Custom Pallets
            • Pallet Coupling
            • Origin
            • Events and Erros
            • Runtime Storage
            • State Transitions and Storage
            • SCALE Encoding
            • Weight and Fee
            • Runtime API
            • Runtime Development
          • Account
          • Address Format
          • Glossary
          • CLI
            • Archive
            • Memory Profiler
            • Node Template
            • sidecar
            • srtool
            • Subkey
            • subxt
            • try-runtime
            • tx-wrapper
          • Runtime Development
            • Basics
              • Configure Genesis State
              • Configure Runtime Constants
              • Customize a Chain Spec
              • Import a Pallet
              • Use Helper Function
            • Consensus Model
              • PoW
              • Create a Hybrid Node
            • Offchain Worker
              • Request Offchain HTTP
              • Offchain Indexing
              • Offchain Local Storage
            • Pallet Design
              • Create a Storage Structure
              • Implement Lockable Currency
              • Incorporate Randomness
              • Loose Coupling
              • Tight Coupling
            • Parachain Development
              • Add HRMP Channel
              • Add Paranodes
              • Connect to a Local Relay Chain
              • Convert a Solo Chain
              • Prepare to Launch
              • Select Collator
              • Upgrade a Parachain
            • Storage Migration
              • Basics
              • Trigger Migration
            • Test
              • Basics
              • Test a Transfer Transaction
            • Tools
              • Create a TxWrapper
              • Use Sidecar
              • try-runtime
              • Verify WASM
            • Weigths
              • Benchmark
              • Calculate Fees
              • Use Conditional Weights
              • Use Custom Weights
        • Build
          • Decide What to Build
          • Build Process
          • Determinisitc Runtime
          • Chain Spec
          • Genesis Configuration
          • Application Development
          • RPC
          • Troubleshoot Your Code
        • Tutorials
          • Install
            • Developer Tools
            • Linux
            • macOS
            • Rust Toolchain
            • Issues
            • Windows
          • Quick Start
            • Explore the Code
            • Modify Runtime
            • Start a Node
            • Substrate Basics
          • Build a Blockchain
            • Add Trusted Nodes
            • Authorize Specific Nodes
            • Build a Local Blockchain
            • Simulate Network
            • Upgrade a Running Network
          • Build Application Logic
            • Add a Pallet
            • Add Offchasin Workers
            • Publish Custom Pallets
            • Specify Origin for a Call
            • Use Macros in a Custom Pallet
          • Integrate with Tools
            • Access EVM Accounts
            • EVM Integration
            • Explore Sidecar Endpoints
            • Integrate a Light Client Node
          • Smart Contracts
            • Strategy
            • Build a Token Contract
            • Develop a Smart Contract
            • Prepare Your First Contract
            • Troubleshoot Smart Contracts
            • Use Maps for Storing Values
      • XCM
        • XCM
        • XCM Format
    • Service Chains
      • InfraDID
      • InfraEVM
      • URAuth(Universal Resource Auth)
    • DevOps
      • Build
      • Deploy
      • Monitoring
      • Runtime Upgrade
    • Tutorials
      • Basic
        • How to Interact with System Token
        • How To Pay Transaction Fee
        • How To Vote with TaaV
        • Hot to Get Validator Reward
      • Build
        • Build InfraRelayChain
        • Build Parachain
        • Open Message Passing Channels
        • Transfer Assets with XCM
      • Test
        • Benchmark
        • Check Runtime
        • Debug
        • Simulate Parachains
        • Unit Testing
      • Service Chains
        • Play with InfraDID
          • Build
          • Add Keys
          • Add Service Endpoint
          • Create InfraDID
        • Play with InfraEVM
          • Build
          • Deposit and Withdraw Token
          • Deploy ERC20 Contract
          • Deploy ERC721 Contract
          • Deploy ERC1155 Contract
  • Newnal Data Market
Powered by GitBook
On this page
  • Before You Begin
  • Creating an InfraDID
  • Registering on the InfraDID Chain
  • Creating and Registering InfraDID using the infra-did-js Library
  • Next Steps
  1. InfraBlockchain
  2. Tutorials
  3. Service Chains
  4. Play with InfraDID

Create InfraDID

This tutorial explains how to create a DID on InfraDID parachain.

PreviousAdd Service EndpointNextPlay with InfraEVM

Last updated 1 year ago

Before You Begin

Before you start, make sure to do the following:

Creating an InfraDID

Creating an InfraDID doesn't require communication with the blockchain itself.

The format of an InfraDID involves composing the DID method-specific identifier part as an SS58 address. In other words, if you structure it as did:infra:{networkID}:{SS58 address}, it becomes your own DID. You can use the public key and its corresponding private key, which can be obtained from the SS58 address, as the key pair you can use by default.

If you want to register multiple public keys or other data using the same DID or want to use other data, you'll need to go through the process of registering the DID on the chain.

Registering on the InfraDID Chain

To register InfraDID on the chain, follow these steps:

    • Go to Developer - Extrinsics - select newOnchain extrinsic of the didModule palette.

      Configure as shown below and execute the extrinsic.

  1. Check the events to ensure that the DID was created successfully.

  2. Query the storage to confirm that the DID was registered correctly on the chain.

Creating and Registering InfraDID using the infra-did-js Library

To create InfraDID using the infra-did-js library, follow these steps:

  1. yarn add infra-did-js
  2. Write the code as shown below to set up the basic configuration to access InfraDID chain using the infra-did-js library.

    import { InfraSS58, CRYPTO_INFO } from "infra-did-js";
    
    const txfeePaterAccountKeyPair = await InfraSS58.getKeyPairFromUri(
      "//Alice",
      "sr25519"
    );
    const confBlockchainNetwork = {
      networkId: "space",
      address: "ws://localhost:9944",
      // seed or keyPair required
      txfeePayerAccountKeyPair,
      // or txfeePayerAccountSeed: 'TX_FEE_PAYER_ACCOUNT_SEED'
    };
    const conf = {
      ...confBlockchainNetwork,
      did: "did:infra:space:5CRV5zBdAhBALnXiBSWZWjca3rSREBg87GJ6UY9i2A7y1rCs",
      // seed or keyPair required
      seed: "DID_SEED",
      // keyPair: keyPair,
      controllerDID:
        "did:infra:space:5HdJprb8NhaJsGASLBKGQ1bkKkvaZDaK1FxTbJRXNShFuqgY",
      controllerSeed: "DID_CONTROLLER_SEED",
      // or controllerKeyPair: controllerKeyPair
    };
    const infraApi = await InfraSS58.createAsync(conf);
  3. Write the code to create an InfraDID.

    DIDSet = await InfraSS58.createNewSS58DIDSet(networkId);
    console.log({ DIDSet });

    The console.log output will be as follows:

    {
      "DIDSet": {
        "did": "did:infra:space:5Cq2Za1Z4HJx5eTvxT5iFyXZLM1XTwVZSafQsEuK4ujNKJEF"
        // ... other information ...
      }
    }
  4. Write the code to register the created InfraDID on the chain.

    // Register DID
    await infraApi.didModule.registerOnchain();

Next Steps

Access the and follow the steps below:

You can create InfraDID using the , but you can also create InfraDID using the infra-did-js JavaScript library.

Install the library.

*InfraBlockchain Explorer
*InfraBlockchain Explorer
infra-did-js
Registering Additional Keys to InfraDID
InfraDID parachain
infra-did-method
new-onchain
new-onchain-success
new-onchain-storage