KOR Protocol Developer Docs
  • KOR Protocol: Introduction
    • Overview
    • Partners
  • Overview of KOR SDK
    • Notable Features
    • Merits of using KOR SDK
    • Use Cases
  • SDK Reference
    • Introduction
    • SDK Installation
    • SDK Initialization
    • Client Methods
      • Asset
      • NFT
      • On-Chain IP
      • On-Chain License
      • Royalty Distribution
      • Conflict Management
    • Tutorials
      • Pre-requisites
      • Mint and Register in Own Collection
      • Mint in KOR Collection and Register
      • Register Existing Minted Token as IP
      • Launch 100-Song Album via IPFS
      • Launch 5-Song Album via AWS S3
      • Register Asset as Derivative
      • Update License Terms of Existing IP
      • Raise, resolve and cancel conflicts
      • Create a copy NFT of an IP
    • Releases
    • Deployed Smart Contracts
  • Essential Business Flows
  • Architecture
    • Overview
    • Event Listener
    • Modules
      • Asset Module
      • NFT Module
      • On-Chain IP Module
      • On-Chain License Module
      • Royalty Distribution Module
      • Conflict Management Module
  • Key Definitions
  • Community
Powered by GitBook
On this page
  1. SDK Reference

SDK Initialization

PreviousSDK InstallationNextClient Methods

Last updated 4 months ago

To initialize the SDK, you need to provide your API key and the RPC URL of the blockchain network.

import { initKorSDK } from '@kor_protocol/core-sdk';

const apiKey = 'your-api-key';
const rpcUrl = 'https://your-rpc-url';
const origin  = 'sandbox-origin-url';
const recaptchaToken = 'your-recaptcha-token'; //optional

const korSDK = initKorSDK(apiKey, {rpcUrl, chain, origin});
  1. API Key: Your unique identifier used to authenticate requests to the KOR Protocol backend. Please fill this form to obtain an api key .

  2. RPC URL: This is the URL of the blockchain network you are connecting to. It could be the URL of a public or private Ethereum node.

  3. Chain: This is the id of the chain on which operations should be performed. *Note: Currently only base sepolia (chain id: 84532) is supported.

  4. Origin: Initializes the module in a sandbox/production environment. For sandbox environment use

  5. Recaptcha Token: If you have configured Google Invisible reCAPTCHA by providing the site key and site secret, you need to execute reCAPTCHA on the front end using Google's grecaptcha.execute function to generate a reCAPTCHA token. This token must be passed during SDK initialization for validation.

Please ensure that the domain is properly configured while creating the site key in the Google reCAPTCHA admin console.

If Google reCAPTCHA is not configured, this field is optional.

<ReCAPTCHA
  sitekey={recaptchaValue}
  size="invisible"
  ref={reCaptchaRef}
  className="recaptcha"
/>


 <button
        onClick={async () => {
          try {
            let token: string | undefined | null = undefined;
            if (reCaptchaRef.current) {
              token = await reCaptchaRef.current.executeAsync();
              reCaptchaRef.current.reset();
            }
           
            await initKorSDK(value, {
              chain: 84532,
              rpc: 'your-rpc-url',
              origin: 'https://dq9c2zl6kih9v.cloudfront.net/kor-sdk-api',
              recaptchaToken: token,
            });
          } catch (error) {
            console.error(error);
          }
        }}
        type="button"
        className="btn btn-primary my-2"
      >
        Submit
</button>

By using the initialiseKorSDK method from the @kor_protocol/core-sdk package, you can create an instance of the SDK by providing these parameters. This instance will allow you to interact with the KOR Protocol APIs and perform various KOR Protocol operations.

https://u0d76il5b5y.typeform.com/korSDKsignup
https://dq9c2zl6kih9v.cloudfront.net/kor-sdk-api