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
  • Adding Service Endpoints to InfraDID
  • Removing Service Endpoints from InfraDID
  • Adding and Removing Service Endpoints from InfraDID Using the infra-did-js Library
  1. InfraBlockchain
  2. Tutorials
  3. Service Chains
  4. Play with InfraDID

Add Service Endpoint

This tutorial explains how to add service endpoints to a DID registered with InfraDID.

PreviousAdd KeysNextCreate InfraDID

Last updated 1 year ago

Before you begin

Before you begin, Make sure you have the following:

Adding Service Endpoints to InfraDID

To make a list of service endpoints available for a specific DID and store it on the chain, making it public for others to inspect the Document of a specific DID, follow these steps:

  1. Visit the and follow the steps below.

  • Go to Developer - Extrinsic and select the addServices extrinsic of the didModule palette.

    Configure it as shown below and trigger the extrinsic:

Removing Service Endpoints from InfraDID

To remove service endpoints from InfraDID, follow these steps:

  • Go to Developer - Extrinsic and select the removeServices extrinsic of the didModule palette.

    Configure it as shown below and trigger the extrinsic:

Adding and Removing Service Endpoints from InfraDID Using the infra-did-js Library

To add and remove service endpoints from InfraDID using the infra-did-js library:

  1. yarn add infra-did-js
  2. Write code to set up the basic configuration code for accessing InfraDID chain, as shown below:

    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 code to add service endpoints to InfraDID:

    // Add Service Endpoint
    /*
    addServiceEndpoint(
      originsTexts: string[],
      endpointType?: ServiceEndpointType,
      endpointIdText?: string,
    )
    */
    await infraApi.didModule.addServiceEndpoint(SOME_SERVICE_ENDPOINT_URLS);
  4. Alternatively, write code to remove service endpoints from InfraDID:

    // Remove Service Endpoint
    /*
    removeServiceEndpoint(
      endpointIdText?: string
    )
    */
    await infraApi.didModule.removeServiceEndpoint();

Visit the and follow the steps below.

Install the library.

InfraBlockchain Explorer
infra-did-js
Creating InfraDID
InfraBlockchain Explorer
add-services
remove-services