Kaia 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 34쪽

rowser. You can start MetaMask by clicking on the icon in the upper right-hand corner of your chrome browser. Step 2. Generate a MetaMask Wallet ​ Click on [Create a Wallet]. Set a password. You will be given a 12 word seed phrase; back it up somewhere secure. Note: You can only restore your wallet with the seed phrase. Sharing your seed phrase with others may result in losing all of your funds. Therefore, it is recommended that you either write it down manually or store it in an offline device. Step 3. Connect to Kaia Network ​ A. Quick Configuration ​ Kaia Mainnet Kaia Kairos Testnet Use ChainList for a one-click configuration and follow the instructions. Use ChainList for a one-click configuration and follow the instructions. B. Manual Configuration ​ Click on the upper Networks tab, which is on Ethereum Mainnet as default, and select [Add network]. Enter the following Kaia network details in the Add a network manually page and click Save Kaia Mainnet Kaia Kairos Testnet Name Kaia Mainnet RPC https://public-en.node.kaia.io ID 8217 Symbol KAIA Explorer https://kaiascan.io Name Kaia Kairos Testnet RPC https://public-en-kairos.node.kaia.io ID 1001 Symbol KAIA Explorer https://kairos.kaiascan.io Step 4. Send KAIA ​ Note: The following steps require KAIA. For this guide, we will be using Kairos Testnet. You can obtain Test KAIA in Kaia Faucet . Click [Send] on the main page and enter the recipient address and the amount of KAIA. NOTE: Sending KAIA is a payment transaction, for which you need KAIA. Since Kaia v1.9.0, a dynamic gas fee mechanism has replaced the existing fixed price policy. So you don't have to set the fixed gas fee manually. Check the amount to send and the transaction fee and click [Confirm] to complete the KAIA transfer, after which you will be redirected to the main page. Click [Activity] on the main page to confirm the transaction history. Step 1. Install MetaMask Step 2. Generate a MetaMask Wallet Step 3. Connect to Kaia Network A. Quick Configuration B. Manual Configuration Step 4. Send KAIA ## /misc/operation/chaindata-snapshot On this page You can start a node from an already-synced database called a chaindata snapshot. A chaindata snapshot is a compressed Kaia data directory. note This saves time to Full Sync the whole blockchain, allowing you to relatively quickly start a new node or recover from corrupt database. Prepare Data Directory ​ Before start, prepare enough disk space to accommodate both compressed file and uncompressed directory. If you're going to start from an empty machine, simply create a datadir. sudo mkdir /var/kend If you're going to swap the existing directory, create a temporary directory. Option 1. Mount a new disk (Recommended for optimal disk utilization) $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme2n1 259:0 0 3500G 0 disk /var/kend2 # New disk at temporary path nvme1n1 259:0 0 4000G 0 disk /var/kcnd # Old disk at production path nvme0n1 259:2 0 8G 0 disk ├─nvme0n1p1 259:3 0 8G 0 part / └─nvme0n1p128 259:4 0 1M 0 part Option 2. Use existing disk sudo mkdir /var/kend2/data Download the File ​ Every published snapshot is listed at snapshots.node.kaia.io , and each network publishes the newest one's URL as a one-line latest.txt . Read it into a variable and the commands below need no editing when a new snapshot is published. # mainnet; for Kairos, replace mainnet with kairos URL=$(curl -s https://snapshots.node.kaia.io/mainnet/pruning-chaindata/latest.txt) echo "$URL" Option 1. curl curl -O "$URL" Option 2. wget wget "$URL" Option 3. axel # Amazon Linux installation example sudo amazon-linux-extras install epel sudo yum install axel # Multi-threaded download and print status bar axel -n8 "$URL" | awk -W interactive '$0~/\[/{printf "%s'$'\r''", $0}' Option 4. aria2 # Rocky Linux installation example sudo yum install epel-release aria2 # Lightweight, multi-connection download aria2c "$URL" Decompress the File ​ Snapshots are compressed with zstd and named .tar.zst . The archive holds a klay/chaindata directory, so extract it into the data directory itself. Option 1. tar tar --zstd -xvf kaia-mainnet-pruning-chaindata-xxxxxxxxxxxxxx.tar.zst -C /var/kend/data Option 2. zstd, then tar # For a tar built without --zstd. Amazon Linux & Rocky Linux installation example sudo yum install zstd zstd -d kaia-mainnet-pruning-chaindata-xxxxxxxxxxxxxx.tar.zst -o out.tar tar -xf out.tar -C /var/kend/data Option 3. Download and extract in one pass # No room for both the archive and the directory it expands into curl -s "$URL" | tar --zstd -xf - -C /var/kend/data Swap the data directory ​ First, stop the node. IMPORTANT : If you are running a consensus node (CN), make sure to remove the node from the Council. Option 1. Swap the content at the same path If you mounted new disk, change the mount. umount /var/kend # Old disk umount /var/kend2 # New disk at temporary path mount /dev/nvme2n1 /var/kend # New disk at production path If you used existing disk, rename the directory. mv /var/kend /var/kend_old # Old data mv /var/kend2 /var/kend # New data Option 2. Change the path in the node configuration Change DATA_DIR value in the kend.conf file. Optionally delete old data and the .tar.zst file. Finally, start the node. Downloads ​ Snapshots are published at snapshots.node.kaia.io , which lists every snapshot with its size and checksum. Alongside the page, each network publishes two files for scripts: latest.txt , the newest snapshot's URL on one line, and manifest.json , every snapshot with its size, checksum and creation time. network sync options download for scripts mainnet live pruning https://snapshots.node.kaia.io/#mainnet-pruning latest.txt · manifest.json kairos live pruning https://snapshots.node.kaia.io/#kairos-pruning latest.txt · manifest.json Only live-pruned databases are published. Read Storage Optimization for the concept. Batch-pruned (state migrated) snapshots are no longer produced, and neither are full or archive databases: for those, perform a fresh full sync from genesis, or write to devops@kaia.io . note The https://packages.kaia.io/<network>/chaindata/ and .../pruning-chaindata/ URLs this page used to list are no longer updated. Anything reading latest.txt or manifest.json under them should read the URLs in the table above instead. Prepare Data Directory Download the File Decompress the File Swap the data directory Downloads ## /build/tools/block-explorers This blockchain tool enables users and enthusiasts to search for real-time and historical information about the blockchain. Block explorers on Kaia contain information about Kaia, and as such, users can search for blocks, transactions, balances, addresses, and contracts on Kaia. The list of explorers supported by Kaia is provided below: Kaiascan OKX Kaia Explorer ## /build/tools/wallets DApp Developers Want to start building on Kaia? Node Operators Instructions on running Kaia's nodes API References APIs and libraries Kaia Overview Want to know about Kaia? What's New Explore our latest updates and additions to the docs. NEW CONTENT Nov 17, 2025 Searcher's Guide to Kaia v2.1 MEV Auction SDK Use the Kaia v2.1 MEV Auction SDK to deposit funds, submit sealed bids, and participate in MEV opportunity auctions on the Kaia network. NEW CONTENT Nov 13, 2025 Node Storage Optimization in Kaia v2.1 Explore data compression and FlatTrie features to effectively optimize node storage introduced in Kaia v2.1. NEW FEATURE Oct 15, 2025 New AI-Powered Search is Live on Kaia Docs! Integrate an AI search tool for documentation to provide automatically trained answers and built-in analytics. View All Updates → Popular Guides Getting Started Learn the basics of Kaia and how to get started. MetaMask Guide Connect MetaMask to Kaia. Node Snapshot Guide Use Chaindata Snapshots. View More Guides → Popular Resources Public JSON RPC Endpoints Build and test your products without running your own node. Block Explorers Search for real-time and historical information about Kaia. Wallets Integrate and secure digital assets seamlessly. View More Resources → SDK Documentation Build freely with tools tailored for your language. Seamlessly integrate with Kaia Network using our enhanced SDKs for JavaScript, Java, Python and more. Built on trusted foundations like Ethers, Web3.js, Web3j, and Web3.py, our libraries give you the power to submit transactions, read smart contracts, and develop complex applications with extended functionality - all in your preferred programming language. Ethers.js Extension Web3.js Extension Web3j Extension Web3.py Extension View More SDKs → JSON-RPC API Reference Discover and Engage with Kaia's JSON-RPC APIs Unlock Kaia's full potential with our interactive API documentation. Test API calls directly in the docs, explore detailed request and response examples, and generate code snippets in curl, Python, Node.js, and Java. Whether developing new applications or integrating with existing systems, our comprehensive API reference provides the tools for efficient development on the Kaia platform. Get started with Kaia's JSON RPC APIs → ## /references/sdk/ethers-ext/getting-started On this page Ethers.js Extension for Kaia offers: Drop-in replacement to ethers.Wallet that handles both Ethereum and Kaia transaction types involving AccountKey and TxTypes. Drop-in replacement to ethers.providers.JsonRpcProvider that provides accesses to both Ethereum RPCs and Kaia-specific RPCs. Drop-in replacement to ethers.Web3Provider to work with both MetaMask ( window.ethereum ) and Kaikas ( window.klaytn ) Note for ethers v6 ​ @kaiachain/ethers-ext supports both ethers v5 and v6. However, you need to use the right packages which are specified for each ethers version. So ethers v5 must be used with packages from @kaiachain/ethers-ext/v5 and ethers v6 is only compatible with @kaiachain/ethers-ext/v6 . NOTE: If the import path has no version sub-path ( @kaiachain/ethers-ext ), ethers v5 will be used by default. NOTE: @kaiachain/ethers-ext@^1.2.0 recommends node 22 or later if you have issues with ES Module resolution. Don't : Mixing ethers v6 and ethers-ext for ethers v5 const ethers = require("ethers"); // ethers v6 const { Wallet } = require("@kaiachain/ethers-ext/v5"); const provider = new ethers.JsonRpcProvider( "https://public-en-kairos.node.kaia.io" ); const wallet = new Wallet("<private key>", provider); Do : Using with ethers v5 const ethers = require("ethers"); // ethers v5 const { Wallet } = require("@kaiachain/ethers-ext/v5"); const provider = new ethers.providers.JsonRpcProvider( "https://public-en-kairos.node.kaia.io" ); const wallet = new Wallet("<private key>", provider); Do : Using with ethers v6 const ethers = require("ethers"); // ethers v6 const { Wallet } = require("@kaiachain/ethers-ext/v6"); const provider = new ethers.JsonRpcProvider( "https://public-en-kairos.node.kaia.io" ); const wallet = new Wallet("<private key>", provider); Do : Using ethers-ext only const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext/v5"); // or const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext/v6"); const provider = new JsonRpcProvider("https://public-en-kairos.node.kaia.io"); const wallet = new Wallet("<private key>", provider); Install ​ Node.js ​ Install npm install --save @kaiachain/ethers-ext ethers@5 # or ethers@6 ESM or TypeScript import { Wallet, JsonRpcProvider } from "@kaiachain/ethers-ext"; // esm // v5 import { v5 } from "@kaiachain/ethers-ext"; const { Wallet, JsonRpcProvider } = v5; // v6 import { v6 } from "@kaiachain/ethers-ext"; const { Wallet, JsonRpcProvider } = v6; // esm subpath import. If using typescript, add "moduleResolution": "nodenext" to tsconfig.json // v5 import { Wallet, JsonRpcProvider } from "@kaiachain/ethers-ext/v5"; // v6 import { Wallet, JsonRpcProvider } from "@kaiachain/ethers-ext/v6"; const provider = new JsonRpcProvider("https://public-en-kairos.node.kaia.io"); const wallet = new Wallet("<private key>", provider); CommonJS // v5 const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext"); const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext").v5; const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext/v5"); // v6 const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext").v6; const { Wallet, JsonRpcProvider } = require("@kaiachain/ethers-ext/v6"); const provider = new JsonRpcProvider("https://public-en-kairos.node.kaia.io"); const wallet = new Wallet("<private key>", provider); Browser ​ It is not recommended to use CDNs in production, But you can use below for quick prototyping. using ethers-ext.buldle.js for ethers v5 and ethers-ext.v6.bundle.js for ethers v6 <script src="https://cdn.jsdelivr.net/npm/@kaiachain/ethers-ext@latest/dist/ethers-ext.bundle.js"></script> <script> const provider = new ethers_ext.providers.Web3Provider(window.klaytn); </script> Usage ​ See example and test . Note for ethers v6 Install Node.js Browser Usage ## /references/sdk/web3js-ext/getting-started On this page Web3.js Extension for kaia offers: Drop-in replacement to new Web3(...) that supports both Ethereum and kaia transaction types involving AccountKey and TxTypes. See Modifications to the Web3 object section for details Install ​ NOTE: @kaiachain/web3js-ext@^1.2.0 recommends node 22 or later if you have issues with ES Module resolution. Node.js ​ Install npm install --save @kaiachain/web3js-ext ESM or TypeScript import { Web3 } from "@kaiachain/web3js-ext"; const web3 = new Web3("https://public-en-kairos.node.kaia.io"); CommonJS const { Web3 } = require("@kaiachain/web3js-ext"); const web3 = new Web3("https://public-en-kairos.node.kaia.io"); Browser ​ It is not recommended to use CDNs in production, But you can use below for quick prototyping. <script src="https://cdn.jsdelivr.net/npm/@kaiachain/web3js-ext@latest/dist/web3js-ext.bundle.js"></script> <script> const web3 = new web3_ext.Web3(window.klaytn); </script> Usage ​ See example and test . Modifications to the Web3 object ​ See DESIGN for source code organization. Accounts ​ Following functions can handle Klaytn TxTypes. See src/accounts/index.ts // account independent functions web3.eth.accounts.recoverTransaction(rlp) web3.eth.accounts.signTransaction(obj or rlp) web3.eth.accounts.signTransactionAsFeePayer(obj or rlp) // account-bound functions var account = web3.eth.accounts.create() var account = web3.eth.accounts.privateKeyToAccount(priv) var account = web3.eth.accounts.decrypt(keystore) account.signTransaction(obj or rlp) account.signTransactionAsFeePayer(obj or rlp) Following functions can handle the KIP-3 Klaytn keystore format v4 web3.eth.accounts.decrypt(keystore) web3.eth.accounts.decryptList(keystore) Eth RPC wrappers ​ Following functions calls different RPC, and handle Klaytn TxTypes. See src/eth/index.ts // Try klay_protocolVersion, falls back to eth_protocolVersion web3.eth.getProtocolVersion() // klay_sendTransaction if Klaytn TxType, otherwise eth_sendTransaction // Additional treatment for Kaikas compatibility web3.eth.sendTransaction(obj) // klay_sendRawTransaction if Klaytn TxType, otherwise eth_sendRawTransaction web3.eth.sendSignedTransaction(rlp) // klay_signTransaction if Klaytn TxType, otherwise eth_signTransaction // Additional treatment for Kaikas compatibility web3.eth.signTransaction(obj) Klaytn RPCs ​ Following functions calls Klaytn RPCs. See src/web3.ts web3.klay.blockNumber() // klay_blockNumber web3.net.networkID() // net_networkID Install Node.js Browser Usage Modifications to the Web3 object Accounts Eth RPC wrappers Klaytn RPCs ## /references/sdk/web3j-ext/getting-started On this page Requirements ​ Setting Java ​ Use java version: 11 <= v <= 18 Visit https://adoptopenjdk.net site Download OpenJDK Install Web3j kaia extension ​ To add the Gradle Library to your project: repositories { mavenCentral() } dependencies { implementation "io.kaia:web3j-ext:v1.0.0" implementation "io.kaia:web3rpc-java:v1.0.0" implementation "org.web3j:core:4.9.8" } Usage ​ See example . Quickstart ​ For basic web3j usage, you can learn through Web3j tutorial . Send Fee Delegated Transaction on Kairos Testnet ​ If you want to know more about the concept of fee delegated transaction supported by kaia network, please refer to kaiadocs . Check FeeDelegatedValueTransferExample.java file in web3j-ext examples . package org.web3j.example; import java.io.IOException; import java.math.BigInteger; import org.web3j.crypto.KlayCredentials; import org.web3j.crypto.KlayRawTransaction; import org.web3j.crypto.KlayTransactionEncoder; import org.web3j.crypto.transaction.type.TxType; import org.web3j.crypto.transaction.type.TxTypeValueTransfer; import org.web3j.crypto.transaction.type.TxType.Type; import org.web3j.protocol.core.DefaultBlockParameterName; import org.web3j.protocol.core.methods.response.EthChainId; import org.web3j.protocol.core.methods.response.EthSendTransaction; import org.web3j.protocol.http.HttpService; import org.web3j.protocol.kaia.Web3j; import org.web3j.utils.Numeric; import org.web3j.protocol.kaia.core.method.response.TransactionReceipt; public class FeeDelegatedValueTransferExample implements keySample { public static void run() throws Exception { Web3j web3j = Web3j.build(new HttpService(keySample.BAOBAB_URL)); KlayCredentials credentials = KlayCredentials.create(keySample.LEGACY_KEY_privkey); KlayCredentials credentials_feepayer = KlayCredentials.create(keySample.LEGACY_KEY_FEEPAYER_privkey); BigInteger GAS_PRICE = BigInteger.valueOf(50000000000L); BigInteger GAS_LIMIT = BigInteger.valueOf(6721950); String from = credentials.getAddress(); EthChainId EthchainId = web3j.ethChainId().send(); long chainId = EthchainId.getChainId().longValue(); String to = "0x000000000000000000000000000000000000dead"; BigInteger nonce = web3j.ethGetTransactionCount(from, DefaultBlockParameterName.LATEST).send() .getTransactionCount(); BigInteger value = BigInteger.valueOf(100); TxType.Type type = Type.FEE_DELEGATED_VALUE_TRANSFER; KlayRawTransaction raw = KlayRawTransaction.createTransaction( type, nonce, GAS_PRICE, GAS_LIMIT, to, value, from); // Sign as sender byte[] signedMessage = KlayTransactionEncoder.signMessage(raw, chainId, credentials); // Sign same message as Fee payer signedMessage = KlayTransactionEncoder.signMessageAsFeePayer(raw, chainId, credentials_feepayer); String hexValue = Numeric.toHexString(signedMessage); EthSendTransaction transactionResponse = web3j.ethSendRawTransaction(hexValue).send(); System.out.println("TxHash : \n " + transactionResponse.getResult()); String txHash = transactionResponse.getResult(); int DEFAULT_POLLING_ATTEMPTS_PER_TX_HASH = 40; int DEFAULT_BLOCK_TIME = 1 * 1000; long DEFAULT_POLLING_FREQUENCY = DEFAULT_BLOCK_TIME; TransactionReceiptProcessor transactionReceiptProcessor = new PollingTransactionReceiptProcessor(web3j, DEFAULT_POLLING_FREQUENCY, DEFAULT_POLLING_ATTEMPTS_PER_TX_HASH); org.web3j.protocol.core.methods.response.TransactionReceipt ethReceipt = transactionReceiptProcessor .waitForTransactionReceipt(txHash); System.out.println("Receipt from eth_getTransactionReceipt : \n" + ethReceipt); TransactionReceipt receipt = web3j.klayGetTransactionReceipt(txHash).send().getResult(); System.out.println("Receipt from klay_getTransactionReceipt : \n" + receipt); web3j.shutdown(); TxTypeFeeDelegatedValueTransfer rawTransaction = TxTypeFeeDelegatedValueTransfer .decodeFromRawTransaction(hexValue); System.out.println("TxType : " + rawTransaction.getKlayType()); } } Run examples import org.web3j.example.FeeDelegatedValueTransferExample; public class quickstart { public static void main(String[] args) throws Exception { FeeDelegatedValueTra
프로젝트로 돌아가기