Skip to main content

Klaytn native coin - KLAY

KLAY

KLAY is the main internal transferable cryptocurrency of Klaytn and is used to pay transaction fees when creating or executing smart contracts or when transferring KLAY.

KLAY is a necessary element--a fuel--for operating the Klaytn distributed application platform. It is a form of payment made by the clients of the platform to the consensus nodes (CNs) executing the requested operations. To put it another way, KLAY is an incentive; it ensures that developers write high-quality applications (wasteful code costs more) and that the network remains healthy (CNs are compensated for the resources they contribute).

Units of KLAY

Klaytn uses the following unit system for KLAY.

  • peb is the smallest currency unit.
  • ston is an alias for Gpeb and introduced for convenience.
  • A KLAY is 10^18 peb.
Unitpeb valuepeb
peb1 peb1
kpeb10^3 peb1,000
Mpeb10^6 peb1,000,000
Gpeb10^9 peb1,000,000,000
ston10^9 peb1,000,000,000
uKLAY10^12 peb1,000,000,000,000
mKLAY10^15 peb1,000,000,000,000,000
KLAY10^18 peb1,000,000,000,000,000,000
kKLAY10^21 peb1,000,000,000,000,000,000,000
MKLAY10^24 peb1,000,000,000,000,000,000,000,000
GKLAY10^27 peb1,000,000,000,000,000,000,000,000,000
TKLAY10^30 peb1,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

Make this page better