Introduction

This page introduces Klaytn API Service (KAS).

Klaytn API Service (KAS)

Klaytn API Service (KAS) is the service that enables you to use Klaytn blockchain platform via API (Application Programming Interface). It offers more accessible, simpler, and faster development of blockchain applications on Klaytn.

In general, a blockchain application is used to send transactions to a blockchain platform. An enterprise environment has to prepare and operate expensive and high-performance nodes, as well as create several accounts and individually manage private-public key pairs, to send transactions to Klaytn or Ethereum.

However, KAS runs operations for sending transactions with REST (REpresentational State Transfer) API or SDK (Software Development Kit) without installing and operating nodes or managing the account keys. Blockchain accounts can also be grouped and organized by use, and data can easily be anchored to the main chain with APIs if a service chain is operated.

The inquiry function provides information on tokens that were issued with token contracts (KIP-7, KIP-17, ERC-20, and ERC-721) and transaction history to check if these tokens were sent to other accounts. KAS presents its users with the following advantages:

1. Reduced blockchain node operation and management costs

2. Improved development agility and convenience

  • Sending all transaction types in Klaytn through API calls

  • Supporting KLAY, KIP-7, KIP-17, ERC-20, and ERC-721 tokens

  • Providing various methods for reading token contract information and token transaction records

3. Safe Klaytn account key management

  • Secured structure of private keys for Klaytn accounts

  • Easy development of unique Klaytn wallet

  • Support for multisig keys

4. Easy data anchoring

  • Anchoring service chain data to Klaytn's main chain, Cypress, through simple settings and API calls

  • Improving the integrity of service chain data with data anchoring

  • Applicable to other private chains

KAS Console

KAS Console is a web application for using and managing KAS APIs. With this, different operations, such as creating API authentication keys for calling KAS APIs as described below, setting API call privileges, and storing and managing Klaytn accounts for APIs, can be performed.

For inquires about this document or KAS, please visit Developer Forum.

Klaytn Node API

What is Klaytn Node API?

Klaytn Node API provides Klaytn's JSON-RPC API, which used to be available only if Klaytn Endpoint Node (EN) is installed and operated. Therefore, users can access and use Klaytn mainnet (Cypress) and testnet (Baobab) without building separate high-performance nodes. If a user already has a written code to call JSON-RPC API, he/she can input the authentication information on the API call header for use, with little modification using KAS.

Klaytn Node

The user must be a member of a blockchain network to use the Klaytn blockchain. Joining a blockchain network means synchronizing the blockchain continuously in real time. As such, the entire blockchain data will be copied to the respective server if the user joins the blockchain network, and the copied blockchain data will be updated whenever a new block is linked. Here, "your server" is called the blockchain node (or Endpoint Node, EN, to be precise). An EN is required to send data (transactions) to the Klaytn blockchain or load blockchain data, and high-performance hardware is needed for quick data synchronization with the blockchain network.

Why Should I Use Klaytn Node API?

The Klaytn Node API provides functions for connecting to the blockchain network, recording data (sending transactions), and loading blockchain information without any blockchain node. Essentially, such functions were available only when the user is a member of the blockchain network, as a blockchain node by running a high-performance server and continuously synchronizing blockchain data. With the Klaytn Node API, however, the user may interact with the blockchain by merely calling APIs without operating the blockchain node to save on server installation, configuration, and maintenance costs.

For details about Klaytn Node API, please visit here. For inquires about this document or KAS, please visit Developer forum.

Token History API

What is Token History API?

Token History API has functions for searching and extracting information and transaction records of tokens issued with KIP-7, KIP-17, ERC-20, and ERC-721, as well as KLAY. In general, a separate monitoring system and database (DB) have to be built on understanding the changes of KLAY/token information in individual Klaytn accounts. Constructing these may cost time and money and add a huge burden of monitoring all token transactions.

With Token History API, however, the API can be called to understand when and how many KLAY/tokens were transferred by individual Klaytn accounts to save time and money.

Token

A token refers to the general cryptocurrency or virtual asset in the blockchain and is frequently used for blockchain applications managed using smart contracts (issue, send, or remove tokens). It is used as a transfer medium or evidence of contract execution in many applications.

Points, mileages, certificates, gift cards, and coupons implemented with tokens are guaranteed unfalsifiable based on the blockchain's transparency and immutability. The token is fundamentally different from those implemented with central systems recorded and controlled by a specific host. It also brings new business opportunities to overcome current business limitations in issuance, transfer, and distribution.

However, it is more difficult to use the token effectively than expected as it must be possible to track when and to whom a token is transferred to give it value. All records are securely stored in the blockchain, but retrieving and reading them in the desired format is a different story. To this end, the Token History API provides APIs for checking transfer details in terms of account or token by processing blockchain data.

Why Should I Use Token History API?

The Token History API is a tool for tracking the token transaction history and provides functions to search for the information and history of KLAY, FT (KIP-7, ERC-20), and NFT (KIP-17, ERC-721) tokens. KAS tracks transaction histories of KIP-7 and KIP-17 tokens automatically, while ERC-20 and ERC-721 tokens are tracked through Labeling. Users can search for a token's transaction history to check the KLAY transmission history of a specific account or its NFT information.

FT and NFT are implemented by contracts that follow KIP-7 and KIP-17, respectively, and their contract must be deployed to Klaytn before using Token History API.

With the Token History API, considerable time and money can be saved for developing blockchain applications. Many blockchain applications currently consume several valuable resources for recording and managing token transaction histories. The Token History API also stores all accounts' token transactions in the database (DB) and returns DB records whenever a request for token transaction history is available. Users can use the "Preset" search filter to find the required information from the entire transaction history and process other application requests.

Therefore, users can search for the KLAY/FT transaction history and NFT ownership by merely calling APIs and provide more useful blockchain-based services using these functions.

For details about Token History API, please visit here. For inquires about this document or KAS, please visit Developer Forum.

Wallet API

What is Wallet API?

Wallet API is a set of APIs to store and manage Klaytn account keys and to send various transactions to Klaytn. With Wallet API, users do not need to build wallets directly or manage their private keys by themselves when developing a blockchain application. They can simply send transactions through API calls without having to explicitly sign them.

Wallet API stores account's private keys safely, precluding any possible structural compromise, and supports multisig keys. Following its security, the transaction fee is delegated through an API call, and fee-payer accounts can be created and managed on the KAS Console to save development time. KAS can also pay for the transaction fees first (using the GlobalFeePayer mechanism) and charge it to your KAS account.

Transaction, Signature, Key, Wallet

One of the main reasons of using the blockchain is to store everlasting records in the blockchain. This "everlasting record" is the so-called transaction, and the blockchain stores the transaction in a "block" when a user sends the transaction to the blockchain.

At this point, the "record" is then validated to have been sent or hijacked and falsified by someone during the process and recorded in the block.

Validating if the user has sent the transaction requires the signature to prove that the transaction was sent by the user. With this, the user must append his/her signature to the transaction before sending it to the blockchain.

The user's blockchain AccountKey is required for a user to sign a transaction as if a seal is needed when signing a real estate contract.

Moreover, the user's account key is the only blockchain authentication method. As such, the registered account key must be stored carefully and kept in a separate location in what is called the "wallet."

Therefore, if a user wants to record some data in the blockchain, he/she must 1) prepare a blockchain node (server) to join the blockchain network; 2) connect from the blockchain node to the blockchain, and create an account; 3) make a transaction containing the data; 4) sign the transaction with the Klaytn account key; 5) send the signed transaction to the blockchain; and then, 6) keep the account key in a secure digital wallet.

Why Should I Use Wallet API?

The Wallet API provides all functions mentioned above. Instead of going through six steps of utilizing high-performance hardware resources and implementing complicated software, a user can quickly join KAS and call the Wallet API.

With the Wallet API, a user can interact with the blockchain without directly operating a blockchain node, i.e., can send transactions, load recorded data, deploy smart contracts, or execute the depolyed smart contract by simply calling APIs (the Wallet API internally uses the Klaytn Node API). In addition, this API signs transactions automatically when sending regular transactions and secures the account key.

The Wallet API offers robust functions to send transactions to Klaytn with a few lines of the API call code and secures the Klaytn account key to facilitate easy and quick blockchain application developments.

For Multiple Signing, call the Sign API directly.

In summary, the Wallet API offers the Create and Manage Account and Send Transaction functions. For inquires about this document or KAS, please visit Developer Forum.

Anchor API

What is Anchor API?

Anchor API executes anchoring private chain (including service chain) data to Klaytn's main chain through a simple API call. When users operate service chains, they need to send service chain information to the main chain to prove that the service chain data are not falsified. The process requires understanding complicated settings and adequate management to perform data anchoring, which sends and records the service chain data to the main chain.

With Anchor API, data anchoring transactions can be sent directly by calling the API without undergoing those challenges. Similar to the Wallet API's function, the Anchor API allows KAS to pay the transaction fees for users first, and they can pay the fees at a later time without creating a fee-payer account and without handling KLAY. With Anchor API, users can also anchor Klaytn service chain data and other types of private chains to the Klaytn main chain.

Data Anchoring

One of the most significant features of the blockchain is the immutability of data. This does not mean that the data is unchangeable. Instead, "even a small change" of data is "recognized" by the blockchain system as it stores all data in a hashed manner. Every blockchain data is stored in the form of hash tree, so even partial data changes can be identified by searching for a data hash value. In a public blockchain, such as Klaytn, anyone can search hash value so that any data recorded in the blockchain becomes invariable.

However, private blockchains operate differently. Unlike the public blockchain, only specific users can access blockchain information and search for hash values in a private blockchain. Therefore, users may find it difficult to recognize any data falsification by other individuals who can access the blockchain data through services or applications operated on the private blockchain. As such, data anchoring was introduced to address this issue. It sends a block hash of private chain frequently to the main chain to supplement the reduced security because of limited access to or a small number of blockchain nodes. Private chain data is often sent to the public chain, e.g., Klaytn's main chain, so that private chain users can find private chain data hash values to see if the data is falsified.

It is considered an "anchoring transaction" to send a private chain block hash to the main chain to check the private chain's data integrity, and this transaction can be used to store the private chain data automatically in the main chain. Then, private chain users can confirm that the private chain data remains unchanged with data anchoring.

Why Should I Use Anchor API?

The Anchor API sends the data anchoring transaction using a few lines of API calls. However, the process for sending anchoring transactions is complicated in the existing Klaytn environment. As such, the Anchor API makes the entire process simpler and more convenient, from creating an "operator" account that prepares the anchoring transaction to sending them. The anchoring transaction can be readily executed by quickly creating the operator on the KAS Console and entering the operator information for calling APIs. Then, the private or service chain operator can save time and money for data anchoring while strengthening data integrity.

For details about Anchor API, please visit here. For inquires about this document or KAS, please visit Developer Forum.

About KAS Developer Document

This developer guide provides information for developing a blockchain application (BApp) using KAS.

This documentation contains preliminary information about APIs or technology for development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

For inquires about this document or KAS, please visit Developer Forum.

Last updated