Updated on 2024-05-10 GMT+08:00

API Key Creation

Prerequisites

You have created a public blockchain node.

Procedure

  1. Log in to the NES console.
  2. Choose Dedicated > API Keys, then click Create API Key.
  3. Describe the API key and set the access policy.

    Figure 1 Creating an API key
    Table 1 Parameter description

    Item

    Parameter

    Description

    -

    Enterprise Project

    Select an existing enterprise project, for example, default.

    If the Enterprise Management service is not enabled, this parameter is unavailable.

    -

    Description

    The description of an API key, which can contain up to 1000 characters

    Access Policy

    Target Nodes

    Nodes to be authenticated. By default, no node is selected, and the credentials take effect on all nodes of the tenant. If you select some nodes, the credentials and access policies take effect only on selected nodes.

    Access Policy Type

    Options:

    • Disabled (default): The access policy is disabled.
    • Whitelist: Your DApp can only send requests to or receive requests from the whitelist.

      Click and configure whitelist information as prompted.

      Options of Access Control By:

      • Blockchain Address: Your DApp can only send query requests to the whitelisted addresses.
      • User-Agent: Your DApp can only receive requests sent by the whitelisted user-agents.
      • IP Address: Your DApp can only receive requests sent by the whitelisted IP addresses.
      • HTTP Origin: Your DApp can only receive requests sent by the whitelisted URLs.
      Content:
      • Blockchain Address: Enter an account or contract address. For example: 0xed10421561cc4ee07e3a9b32ce6829b7ac902490
      • User-Agent: Enter user-agent information. For example: mobileDapp
      • IP Address: Enter an IP address. For example: 123.123.123.123
      • HTTP Origin: Enter a URL. For example: https://www.huawei.com/en/
    • Blacklist: Your DApp cannot send requests to or receive requests from the blacklist.

      Click and configure blacklist information as prompted.

      Options of Access Control By:

      • Blockchain Address: Your DApp cannot send query requests to the blacklisted addresses.
      • User-Agent: Your DApp cannot receive requests sent by the blacklisted user-agents.
      • IP Address: Your DApp cannot receive requests sent by the blacklisted IP addresses.
      • HTTP Origin: Your DApp cannot receive requests sent by the blacklisted URLs.
      Content:
      • Blockchain Address: Enter an account or contract address. For example: 0xed10421561cc4ee07e3a9b32ce6829b7ac902490
      • User-Agent: Enter user-agent information. For example: mobileDapp
      • IP Address: Enter an IP address. For example: 123.123.123.123
      • HTTP Origin: Enter a URL. For example: https://www.huawei.com/en/
    NOTE:

    Set one access policy type for each API key.

  4. Click OK. The API key is created and then automatically downloaded as a ZIP package.

    Each API key can be downloaded only once. Change the API key periodically for security.

  5. Decompress the package and open the credential.csv file to obtain the API key.