Intermediate

 

Klaytn native coin – KLAY

Welcome to our tutorial on KLAY, the native coin of the Klaytn blockchain network. KLAY is the cryptocurrency that is used to pay for the computational resources required to validate and execute transactions on the Klaytn network. In this tutorial, we will explore KLAY in detail, including its use cases, its issuance, and its impact on the Klaytn ecosystem. Whether you are a developer, researcher, or simply a blockchain enthusiast, this tutorial will provide valuable insights into the inner workings of KLAY and how it plays a role in the functioning of the Klaytn network.

KLAY is the native coin of the Klaytn blockchain network and it serves as the cryptocurrency that is used to pay for the computational resources required to validate and execute transactions on the Klaytn network.

KLAY is used to pay for the computational resources required to execute smart contracts and transactions on the Klaytn network. The cost of executing a smart contract or transaction on the Klaytn network is measured in gas, and the gas price is paid in KLAY. This ensures that the network has sufficient resources to process all the transactions and prevent spamming and denial-of-service attacks.

KLAY is also used as a means of value transfer between users on the Klaytn network. Users can send KLAY to other users or smart contracts, and smart contracts can also send KLAY to other smart contracts or users.

KLAY is issued through a process called “token issuance.” This process is used to distribute KLAY to users in exchange for their participation in the Klaytn network. The token issuance process can include a variety of methods such as mining, staking, and airdrops.

KLAY plays a crucial role in the Klaytn ecosystem, as it is used to pay for the computational resources required to validate and execute transactions and smart contracts. Additionally, it serves as a means of value transfer between users on the network. The value of KLAY is determined by the market, which is in turn influenced by the usage and adoption of the Klaytn network.

In summary, KLAY is the native coin of the Klaytn network and is used to pay for the computational resources required to validate and execute transactions, it also serves as a means of value transfer between users on the network. KLAY is issued through token issuance and its value is determined by the market and the adoption of the network.

Units of KLAY

Klaytn uses the following unit system for KLAY.

  • peb is the smallest currency unit.

  • ston is an alias for Gpeb and was introduced for convenience.

  • A KLAY is 10^18 peb.

Unit

 

peb value

 

peb

 
 

Unit

 

peb value

 

peb

 

peb

1 peb

1

kpeb

10^3 peb

1,000

Mpeb

10^6 peb

1,000,000

Gpeb

10^9 peb

1,000,000,000

ston

10^9 peb

1,000,000,000

uKLAY

10^12 peb

1,000,000,000,000

mKLAY

10^15 peb

1,000,000,000,000,000

KLAY

10^18 peb

1,000,000,000,000,000,000

kKLAY

10^21 peb

1,000,000,000,000,000,000,000

MKLAY

10^24 peb

1,000,000,000,000,000,000,000,000

GKLAY

10^27 peb

1,000,000,000,000,000,000,000,000,000

TKLAY

10^30 peb

1,000,000,000,000,000,000,000,000,000,000

klay.toPeb and klay.fromPeb are convenient APIs for converting between KLAY units.

$ ./klay attach data/dd/klay.ipc
...
> klay.fromPeb(25, "peb")
"25"
> klay.fromPeb(25, "Gpeb")
"0.000000025"
> klay.fromPeb(25, "ston")
"0.000000025"
> klay.fromPeb(25, "KLAY")
"0.000000000000000025"
> klay.toPeb(25, "peb")
"25"
> klay.toPeb(25, "ston")
"25000000000"
> klay.toPeb(25, "KLAY")
"25000000000000000000"

You can get the list of all units supported by klay.toPeb and klay.fromPeb by sending an invalid unit string such as the one below.

> klay.toPeb(1, "something-does-not-exist")
Error: This unit doesn't exist, please use one of the following units
"noKLAY": "0"
"peb": "1"
"kpeb": "1000"
"Mpeb": "1000000"
"Gpeb": "1000000000"
"ston": "1000000000"
"uKLAY": "1000000000000"
"mKLAY": "1000000000000000"
"KLAY": "1000000000000000000"
"kKLAY": "1000000000000000000000"
"MKLAY": "1000000000000000000000000"
"GKLAY": "1000000000000000000000000000"
"TKLAY": "1000000000000000000000000000000"

    at web3.js:2170:19
    at web3.js:2255:49
    at <anonymous>:1:1
With this, you complete this workshop successfully!!