KRNL Platform Guidebook
KRNL Platformkrnl.xyz
  • Introduction
    • Introduction
    • How Does kOS Work?
  • Setup
    • Getting Started with KRNL
    • Quick Start (CLI)
    • Quick Start (Online IDE)
      • Quick Start (Remix IDE)
      • Quick Start (Atlas IDE)
    • create-krnl-app
    • Platform Registration
  • Kernel
    • What are Kernels?
    • Kernel Registration
      • Kernel Registration (on-chain)
      • Kernel Registration (off-chain)
    • Supported OpenAPI (Off-chain Kernel)
    • Staking
  • Smart Contract
    • Steps for Smart Contract Developers
    • Choosing Kernel(s)
    • Token Authority
      • What is a Token Authority?
      • How to Build a Token Authority?
      • Generic Token Authority
      • How to Deploy a Token Authority on Oasis?
    • Decoding Kernel Responses in Solidity
    • How to Integrate Your Smart Contract with kOS?
    • Smart Contract Registration
  • DApp
    • dApp Registration
    • KRNL SDK Installation
    • Usage
    • KRNL Node RPC
  • Miscellaneous
    • Overview
    • What is the KRNL Platform?
    • What are You Trying to BUIDL?
    • Smart Contract Fundamentals
      • Why Do I Have to Register a Smart Contract?
      • How to Deploy a Smart Contract?
    • Recommended Kernels List
  • Helpful Resources
    • New to Web3?
    • Dictionary
    • Testnet Faucets
    • How to Get Etherscan API Key?
  • Litepaper
    • Litepaper
      • Overview
      • Problem Statement
      • Current State Does Not Solve the Problem
      • Introducing Kernels
      • Ecosystem of Kernels
      • The KRNL Operating System (kOS)
      • Decentralization and Security Considerations
      • Use Cases for KRNL
  • Appendices
    • FAQ
    • Bounty Program
    • Social Medias
    • Thank You
  • Workshop
    • KRNL Workshop
    • Speed's Workshop
Powered by GitBook
On this page
  • API Schema Examples
  • GET method
  • POST method

Was this helpful?

  1. Kernel
  2. Kernel Registration

Kernel Registration (off-chain)

PreviousKernel Registration (on-chain)NextSupported OpenAPI (Off-chain Kernel)

Last updated 15 days ago

Was this helpful?

In this tutorial, we will have a mock API , which can use either the GET or POST method. This API works by taking the input parameter of wallet address, and returning the result of wallet score.

This page provides an example of both the GET method and the POST method.

For the GET method, the input parameter of a wallet address has to be sent within the API path.

Similarly, for the POST method, the input parameter of a wallet address has to be sent within the "Request" body. The "Response" of the API will return the wallet score.

In this tutorial, we will use a mock endpoint called <web2-off-chain.com>.

As in the image above, some additional information is required.

Keep in mind that in order to register your service to be kernel supports only interacting with a single API endpoint. If you have multiple endpoints, you might need to modify your routes before registering on our platform.


API Schema Examples

GET method

You must provide the OpenAPI schema which will be called through the protocols.

Let's assume that the "Request" and "Response" of your API are in the below example code blocks:

The mock endpoint is <web2-off-chain.com/wallet-check-get-{}>.

For the GET method, the wallet address that needs to be checked is sent within the endpoint.

That will give us the OpenAPI schema, as in the below code block.

{
  "openapi": "3.0.3",
  "info": {
    "title": "Wallet Score Check GET",
    "version": "1.0.0",
    "description": "API for checking the score and status of a wallet address."
  },
  "servers": [
    {
      "url": "https://web2-off-chain.com"
    }
  ],
  "paths": {
    "/wallet-check-get-{wallet_address}": {
      "get": {
        "summary": "Check the score of a wallet address",
        "parameters": [
          {
            "name": "wallet_address",
            "in": "path",
            "required": true,
            "description": "The wallet address to check.",
            "schema": {
              "type": "string",
              "example": "0x1234567890"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "wallet_address": {
                      "type": "string",
                      "example": "0x1234567890"
                    },
                    "score": {
                      "type": "integer",
                      "example": 57
                    },
                    "status": {
                      "type": "string",
                      "example": "pass"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Wallet not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "WalletCheckResponse": {
        "type": "object",
        "properties": {
          "wallet_address": {
            "type": "string"
          },
          "score": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        }
      }
    }
  }
}

POST method

When using the POST method, you must provide the OpenAPI schema, which will be called through the protocols.

Let's assume that the "Request" and "Response" of your API are in the below example code blocks:

The endpoint is <web2-off-chain.com/wallet-check>.

Request

{
    "id": 6789,
    "name": "Alice",
    "age": 35,
    "wallet_address": "0x1234567890"
}

Response

{
    "wallet_address": "0x1234567890",
    "score": 57,
    "status": "pass"
}

The example of OpenAPI for POST method will be as in the code block below.

{
  "openapi": "3.0.3",
  "info": {
    "title": "Wallet Score Check",
    "version": "1.0.0",
    "description": "API for checking the score and status of a wallet address."
  },
  "servers": [
    {
      "url": "https://web2-off-chain.com"
    }
  ],
  "paths": {
    "/wallet-check": {
      "post": {
        "summary": "Check the score of a wallet address",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "default": 1234,
                    "example": 6789
                  },
                  "name": {
                    "type": "string",
                    "example": "Alice"
                  },
                  "age": {
                    "type": "integer",
                    "example": 35
                  },
                  "wallet_address": {
                    "type": "string",
                    "description": "User define"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "wallet_address": {
                      "type": "string",
                      "example": "0x1234567890"
                    },
                    "score": {
                      "type": "integer",
                      "example": 57
                    },
                    "status": {
                      "type": "string",
                      "example": "pass"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Wallet not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  }
}

After clicking Upload, a CID will be generated for your specific off-chain API.


After filling the required information, "Fee Per Query" will be the crucial field in this process. It is the part where you, as service providers, can define how much users have to pay when they execute your services. The picture below shows the Fee Per Query and Staking sections. "Additional Information" contains optional fields where you can fill the name, logo, and more.

After pressing the "Activate" button at the bottom of the page, a review window will pop up for you to revise and confirm, as shown in the picture below.

Once you have submitted the transaction, a "Transaction Complete" window will be displayed.

Congratulations! You have successfully registered your service as one of our kernels!

Cover

Register Your Kernel