diff --git a/docs/build/get-started/before-you-start.md b/docs/build/get-started/before-you-start.md index d97bdc0f698..bee952c22c8 100644 --- a/docs/build/get-started/before-you-start.md +++ b/docs/build/get-started/before-you-start.md @@ -8,7 +8,7 @@ **Endpoint Node** * Your [Endpoint Node](../../nodes/endpoint-node/endpoint-node.md) is needed to connect to the Klaytn network and to issue an API call or send a transaction. -* `ken` is a Klaytn Endpoint Node binary. `ken` exposes two interfaces, a [command-line interface](../../nodes/references/klaytn-command.md) and the [JSON-RPC APIs](../../references/json-rpc/json-rpc.md). `ken` runs on Linux and MacOS. +* `ken` is a Klaytn Endpoint Node binary. `ken` exposes two interfaces, a [command-line interface](../../nodes/endpoint-node/ken-cli-commands.md) and the [JSON-RPC APIs](../../references/json-rpc/json-rpc.md). `ken` runs on Linux and MacOS. * `ken` CLI comes with several utility and node management functions. **Smart Contract Development** @@ -17,6 +17,7 @@ * [Truffle](https://github.com/trufflesuite/truffle) - An open-source tool for developing smart contracts in Solidity. * [Hardhat](https://hardhat.org/hardhat-runner/docs/getting-started) - A development environment for smart contracts and dApps. * [Foundry](https://book.getfoundry.sh/) - Foundry is a smart contract development toolchain. +* [Thirdweb](https://portal.thirdweb.com/) - Thirdweb is a complete web3 development framework that provides services to build, manage, and analyze web3 applications. **Klaytn SDKs** diff --git a/docs/build/smart-contracts/deploy/ken.md b/docs/build/smart-contracts/deploy/ken.md index 5643f3d3062..2d1d1ec21d4 100644 --- a/docs/build/smart-contracts/deploy/ken.md +++ b/docs/build/smart-contracts/deploy/ken.md @@ -44,7 +44,7 @@ $ mkdir -p ~/kend_home ### Configuring the EN -The configuration file, `kend.conf`, is located under `ken-xxxxx-amd64/conf/`. For the details of configurable parameters, you can refer to the [EN Configuration Guide](../../../nodes/references/configuration-files.md). To launch an EN of Baobab testnet, please update the `kend.conf` file accordingly as follows. +The configuration file, `kend.conf`, is located under `ken-xxxxx-amd64/conf/`. For the details of configurable parameters, you can refer to the [EN Configuration Guide](../../../misc/operation/configuration.md). To launch an EN of Baobab testnet, please update the `kend.conf` file accordingly as follows. ``` # cypress, baobab is only available if you don't specify NETWORK_ID. @@ -88,7 +88,7 @@ INFO[03/26,15:37:49 +09] [5] Imported new chain segment blocks=1 ### Troubleshooting -Please refer to the [Troubleshooting](../../../nodes/references/troubleshooting.md) if you have trouble in launching the Klaytn Endpoint Node. +Please refer to the [Troubleshooting](../../../misc/operation/troubleshooting.md) if you have trouble in launching the Klaytn Endpoint Node. ## Top up your Account diff --git a/docs/build/smart-contracts/deploy/thirdweb.md b/docs/build/smart-contracts/deploy/thirdweb.md new file mode 100644 index 00000000000..262d2a81938 --- /dev/null +++ b/docs/build/smart-contracts/deploy/thirdweb.md @@ -0,0 +1,168 @@ +# Deploying Smart Contract Using Thirdweb + +![](/img/build/get-started/klaytnXthirdweb.png) + +## Introduction + +This section will guide you through deploying a Marketplace contract and a corresponding NFT collection contract to Klaytn Network using [ThirdWeb](https://portal.thirdweb.com/). Thirdweb is a complete web3 development framework that provides everything you need to connect your apps and games to decentralized networks. + +Marketplace contract allows users to list NFTs for direct sale or auction, thus enhancing the buying and selling of NFTs, just like it’s done on OpenSea. + +By the end of this guide, you will be able to: + +* create and customize contracts using thirdweb. +* compile, deploy, and interact with your smart contract using thirdweb. + +## Getting Started + +In this article, we will explore the different means to create, customize, and deploy contracts using thirdweb, viz. +* Using the thirdweb dashboard +* Using the thirdweb CLI + +For this guide, we will be demonstrating how to deploy a MarketPlace contract using the thirdweb dashboard and also deploying a corresponding nft collection to be listed on the marketplace using the thirdweb CLI. + +> Note: We will not be explaining the mechanics of the marketplace contract as our focus is to explore thirdweb dashboard and CLI for creating, deploying, and interacting with smart contracts. + +## Creating and deploying marketplace contract using thirdweb dashboard + +In this section, we will create and deploy a marketplace contract using thirdweb dashboard. To do this, follow the steps below: + +1. Head over to [thirdweb dashboard](https://thirdweb.com/dashboard?ref=blog.thirdweb.com) and select the **MarketPlace** contract from the list of contracts. + +![](/img/build/get-started/marketplace-explore.png) + +2. Click **Deploy Now** in the contract overview dashboard. + +![](/img/build/get-started/marketplace-deploy.png) + +3. Configure the marketplace contract to include the following parameters: the **name** of the marketplace, its **description**, and **image**. + +![](/img/build/get-started/marketplace-contract-details.png) + +4. Click **Deploy Now** as seen in the image above and wait for the transaction to complete. + +![](/img/build/get-started/marketplace-deployed.png) + +Once the transaction has been successfully executed, you can verify your deployment by pasting the contract address in the search bar of [Klaytnscope](https://klaytnscope.com/). + +## Creating and deploying an NFT collection contract using thirdweb CLI + +In this section, we will create and deploy the NFT collection to be listed in our Marketplace using [thirdweb CLI](https://portal.thirdweb.com/cli?ref=blog.thirdweb.com). To do this, follow the steps below: + +### Creating the contract + +1. Run this command in your terminal to create your contract: + +```bash +npx thirdweb create --contract +``` + +2. Enter your preferred values for the command-line prompts: + + i. Give your project a name. + + ii. Choose your preferred framework: **Hardhat** or **Foundry**. + + iii. Name your smart contract. + + iv. Choose the type of base contract: **Empty**, **ERC20**, **ERC721**, or **ERC1155**. Add any desired **extensions**. For this tutorial, we will select ERC721 and setting the extension to none. + +![](/img/build/get-started/thirdweb-cli-info.png) + +3. Once created, navigate to your project’s root directory and open your project in your preferred code editor. + +4. If you open the contracts folder, your contract should look like this: + +```js +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import "@thirdweb-dev/contracts/base/ERC721Base.sol"; +contract nftcollection is ERC721Base { + constructor( + address _defaultAdmin, + string memory _name, + string memory _symbol, + address _royaltyRecipient, + uint128 _royaltyBps + ) + ERC721Base( + _defaultAdmin, + _name, + _symbol, + _royaltyRecipient, + _royaltyBps + ) + {} +} +``` + +The contract above demonstrates basic [ERC721Base](https://github.com/thirdweb-dev/contracts/blob/main/contracts/base/ERC721Base.sol) functionality. It imports and inherits the **ERC721Base** contract, and it also implements the required methods, including the constructor and its dependent parameters. + +You can modify the contract to your desired custom logic, and once done, your contract is ready for deployment. + +### Deploying the contract + +1. Navigate to your project root folder and run the command in your terminal: + +```bash +npx thirdweb deploy +``` + +Executing this command will trigger the following actions: + * detects the framework (hardhat, foundry) + * compiles all the contracts in the current directory. + * allows you to select which contract(s) you wish to deploy. + * upload your compiled smart contract code (in the form of an Application Binary Interface, or ABI) to IPFS. + +2. When deployment is complete, a dashboard interface will open to fill out the remaining parameters. + * **_name**: contract name + * **_symbol**: symbol or "ticker" + * **_royaltyRecipient**: wallet address to receive royalties from secondary sales + * **_royaltyBps**: basis points (bps) that will be given to the royalty recipient for each secondary sale, e.g., 500 = 5% + +3. Select `Klaytn Mainnet Cypress` as the network to deploy the contract to. + +![](/img/build/get-started/nft-collection-deploy.png) + +4. Once your smart contract is deployed, you can manage additional settings and functionalities through its dashboard. For example, you can upload NFTs, configure permissions and access control, and add new features. + +You can learn more about thirdweb deploy command in this [deploy guide](https://portal.thirdweb.com/deploy/getting-started). + +## Interacting with deployed contracts + +In this section, we will mint an NFT and also transferring it to another account using the **mint** and **transferfrom** function respectively. Let's go over it in the following steps: + +### Minting the NFT + +1. Navigate to the newly deployed contract (**puppyKlan-NC**) dashboard. +2. Click on the **mint** function in the **NFTs** tab under the contract dashboard. + +![](/img/build/get-started/puppy-mint-btn.png) + +3. Fill in the parameters needed for minting the NFT: **name**, **media**, **description**, and **properties**. + +![](/img/build/get-started/puppy-mint-details.png) + +4. Verify your input and click the **Mint NFT** button. +5. Confirm the transaction and wait for it to complete. Once done, you should see your NFT added to the dashboard, like below: + +![](/img/build/get-started/puppy-minted.png) + +### Transferring the NFT to a new owner + +1. Head to the Explorer tab in the contract (**puppyKlan-NC**) dashboard. +2. Select the **transferFrom** function under the Write tab, as shown below. +3. Fill in the necessary function arguments: from (address), to (address), and id (uint256). + +![](/img/build/get-started/puppy-transferfrom.png) + +4. Confirm the transaction and wait for it to complete. + +## Conclusion + +Congratulations! if you made it to the end of this guide. If you have any questions, visit the [Klaytn Forum](https://forum.klaytn.foundation/) or reach out to the [official thirdweb support](https://support.thirdweb.com/). However, below is a list of useful resources you might need while further building with Thirdweb on Klaytn. + +* [Thirdweb Docs](https://portal.thirdweb.com/) +* [How to build a dApp using Thirdweb](https://blog.thirdweb.com/guides/how-to-build-a-dapp/) +* [Create your own NFT marketplace with NextJS and TypeScript](https://blog.thirdweb.com/guides/nft-marketplace-with-typescript-next/) + diff --git a/docs/build/tools/wallets/wallet-libraries/particle.md b/docs/build/tools/wallets/wallet-libraries/particle.md new file mode 100644 index 00000000000..7671832941e --- /dev/null +++ b/docs/build/tools/wallets/wallet-libraries/particle.md @@ -0,0 +1,529 @@ +--- +sidebar_label: Particle Network +--- + +# Integrate Particle Network into a dApp + +![](/img/build/tools/particle.png) + +## Introduction + +[Particle Network](https://particle.network) is the intent-centric, modular access layer of Web3. With Particle's Smart Wallet-as-a-Service, developers can curate a seamless user experience through modular and customizable EOA/AA embedded wallet components. Using MPC-TSS for key management, Particle can streamline user onboarding via their Web2 accounts –such as Google accounts, email addresses, and phone numbers. + +Through APIs and SDKs available on both mobile and desktop platforms, developers can integrate Particle’s Wallet-as-a-Service across a variety of scenarios, with the capacity to be customized and implemented in a way that matches the specific needs of a given application. + +To leverage Particle Network on alternative platforms, such as Android, iOS, React Native, Flutter, & Unity, kindly refer to Particle’s [documentation](https://docs.particle.network). + +## Prerequisites + +* A working react project (by executing `npx create-react-app project-name`) +* A project ID, client key, and app ID from the [Particle dashboard](https://dashboard.particle.network). +* A WalletConnect project ID from the [WalletConnect dashboard](https://cloud.walletconnect.com/). + +## Installation + +To leverage Particle Network, specifically Particle Connect, within your dApp, you'll need to first install the required libraries. In addition to this, if you'd like to use a standard Web3 library, such as [ethers.js](https://docs.ethers.org/v6/) or [web3.js](https://web3js.readthedocs.io/en/v1.2.8/getting-started.html), then you'll need to install theme too. For this guide, we'll be using ethers.js. + +```bash +npm install --save @particle-network/connectkit +npm install --save @particle-network/chains +npm install --save @particle-network/connectors +npm install --save ethers +``` + +## Initializing Particle Connect + +After successfully installing the aforementioned libraries, you'll need to head into your `index.js` (or `.ts`) file to configure Particle Connect. This specifically entails wrapping your `App` component with `ModalProvider` (imported from `@particle-network/connectkit`) and passing in `options`, which contains the parameters detailed below. + +```js +import { ModalProvider } from '@particle-network/connectkit'; +import { Klaytn } from '@particle-network/chains'; +import { evmWallets } from '@particle-network/connectors'; + +const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); +root.render( + + + + + +); +``` + +## Connecting Wallet + +With your `index.js` file setup, you can move onto connecting your users through a central "Connect Wallet" button. To do this, you can import `ConnectButton` from `@particle-network/connectkit` alongside its corresponding css. Upon using `ConnectButton` within your `App` component, a standard "Connect Wallet" button will appear to facilitate connection. + +```js +import '@particle-network/connectkit/dist/index.css'; +import { ConnectButton } from '@particle-network/connectkit'; + +export const App = () => { + return ; +}; +``` + + +## Getting Account and Balance + +With a wallet now successfully connected through `ConnectButton`, you can retrieve the users associated Klaytn address. Additionally, you can retrieve its current balance (in KLAY) through ethers.js, passing in the corresponding EIP-1193 provider object retrieved from `useParticleProvider` within `@particle-network/connectkit`. + +```js +import { useParticleProvider } from '@particle-network/connectkit'; + +const provider = useParticleProvider(); + +const [address, setAddress] = useState(""); +const [balance, setBalance] = useState(""); + +const connectWallet = async() => { + // this guide uses ethers version 6.3.0. + const ethersProvider = new ethers.BrowserProvider(provider); + // for ethers version below 6.3.0. + // const provider = new ethers.providers.Web3Provider(web3authProvider); + const ethersProvider = new ethers.BrowserProvider(provider); + + const signer = await ethersProvider.getSigner(); + + // Get user's Ethereum public address + const address = signer.address; + + // Get user's balance in ether + const balance = ethers.formatEther( + await ethersProvider.getBalance(address) // balance is in wei + ); + + setAddress(address); + setBalance(balance); + +return ( +
+ +
Wallet Address: ${address} Balance: ${balance}
+
+ ); +} +``` + +## Disconnecting Wallet + +Once a user has logged in, you can programmatically force a logout through `disconnect` derived from `useParticleConnect`. This will disconnect the current active session from your dApp, returning the user to their initial state. + +```js +import { useParticleConnect } from '@particle-network/connectkit'; + +const { disconnect } = useParticleConnect(); + +function App() { + +const disconnectUser = async () => { + await disconnect(); + refreshState(); +} + +// refresh state +const refreshState = () => { + setAddress(); + setBalance(); +// make sure to add every other useState modifier function declared here. +} + +return ( +
+ +
+ ); +} +``` + +## Getting User Info + +While traditional Web3 wallets are offered as connection mechanisms through Particle Connect, social logins through social accounts such as your email address, Google account, phone number, etc. are also available. If a user decides to log in with a Web2 account, you'll have the ability to call `getUserInfo` from `@particle-network/auth-core`, which will return an object containing key details such as their name, email, wallet addresses, etc. + +```js +import { getUserInfo } from '@particle-network/auth-core'; + +const [userData, setUserData] = useState({}); + +const getUserInfo = async () => { + const user = getUserInfo(); + setUserData(user); +}; + +return ( +
+ +
{ userData ? `User Email: ${userData.email}, User Name: ${userData.name}` : ""}
+
+ ); +``` + +## Signing Messages + +With a provider initialized (through `useParticleProvider`) and passed into your ethers.js instance, message signing can be initiated as usual through `signer.signMessage`.This will directly display a signature popup for the user to confirm. Its specific nature will depend on which connection mechanism the user chose. + +```js + // add to the existing useState hook. +const [signedMessage, setSignedMessage] = useState(""); + +const signMessage = async(e) => { + e.preventDefault(); + if (!provider) { + console.log("provider not initialized yet"); + return; + } + + // this guide uses ethers version 6.3.0. + const ethersProvider = new ethers.BrowserProvider(provider); + // for ethers version below 6.3.0. + // const provider = new ethers.providers.Web3Provider(provider); + + const signer = await ethersProvider.getSigner(); + + const originalMessage = e.target.message.value; + const result = await signer.signMessage(originalMessage); + setSignedMessage(result) +} + + +return ( +
+
+ + +
+
SignedMessage: ${signedMessage}
+
+ ); + +``` + +## Sending Native Transaction + +Similar to `signer.signMessage`, you can use the same provider mechanism to send a native transaction, with KLAY in this case. This can be done through `signer.sendTransaction`, passing in standard fields such as `to`, `value`, and so on. + +```js + // add to the existing useState hook. + const [txHash, setTxHash] = useState(); + + const sendKlay = async () => { + + if (!provider) { + console.log("provider not initialized yet"); + return; + } + const destination = "paste recipient address"; + + // this guide uses ethers version 6.3.0. + const ethersProvider = new ethers.BrowserProvider(provider); + // for ethers version below 6.3.0. + // const provider = new ethers.providers.Web3Provider(provider); + + const signer = await ethersProvider.getSigner(); + + // Submit transaction to the blockchain and wait for it to be mined + const tx = await signer.sendTransaction({ + to: destination, + value: ethers.parseEther("0.1"), + maxPriorityFeePerGas: "5000000000", // Max priority fee per gas + maxFeePerGas: "6000000000000", // Max fee per gas + }) + + + const receipt = await tx.wait(); + setTxHash(receipt.hash) +} + +return ( +
+ +
Send-Klay Tx Hash : {txHash ? Klaytnscope : ' ' }
+
+); + +``` + +## Working with a Smart Contract + +1. **Deploying a Contract** + +More complex transactions, such as contract deployments, are also possible through Particle, whether you're using an external Web3 wallet or the included social login embedded wallet. An example of this is shown below. + +```js +// add to the existing useState hook. +const [contractAddress, setContractAddress] = useState(null); + +const deployContract = async () => { + if (!provider) { + console.log("provider not initialized yet"); + return; + } +// this guide uses ethers version 6.3.0. +const ethersProvider = new ethers.BrowserProvider(provider); +// for ethers version below 6.3.0. +// const provider = new ethers.providers.Web3Provider(provider); + +const signer = await ethersProvider.getSigner(); + +// paste your contractABI +const contractABI = [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_initNum", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "retrieve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "num", + "type": "uint256" + } + ], + "name": "store", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + + // Paste your contract byte code + const contractBytecode = '608060405234801561001057600080fd5b506040516102063803806102068339818101604052810190610032919061007a565b80600081905550506100a7565b600080fd5b6000819050919050565b61005781610044565b811461006257600080fd5b50565b6000815190506100748161004e565b92915050565b6000602082840312156100905761008f61003f565b5b600061009e84828501610065565b91505092915050565b610150806100b66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea26469706673582212200370e757ac1c15a024febfa9bf6999504ac6616672ad66bd654e87765f74813e64736f6c63430008120033' + + const contractFactory = new ContractFactory(contractABI, contractBytecode, signer); + + const contract = await contractFactory.deploy(400); + + // get contract address + setContractAddress(contract.target) +} + + +return ( +
+ +
Contract Address: {contractAddress ? contractAddress : ''}
+
+ ); +``` + +Similarly, you can send write transactions directly to an existing (deployed) contract using the same ethers.js instance leveraging the Particle Connect provider derived from `useParticleProvider`. On the frontend, this functionality will mimic that of a contract deployment, message signature, or transaction request. + +2. **Writing to a Contract** + +```js + // add to existing useState hook + const [contractTx, setContractTx] = useState(); + + const writeToContract = async (e) => { + e.preventDefault(); + if (!provider) { + console.log("provider not initialized yet"); + return; + } + + // this guide uses ethers version 6.3.0. + const ethersProvider = new ethers.BrowserProvider(provider); + // for ethers version below 6.3.0. + // const provider = new ethers.providers.Web3Provider(provider); + + const signer = await ethersProvider.getSigner(); + + // Paste your contractABI + const contractABI = [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_initNum", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "retrieve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "num", + "type": "uint256" + } + ], + "name": "store", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + + // Paste your contract address + const contractAddress = "0x3b01E4025B428fFad9481a500BAc36396719092C"; + + const contract = new ethers.Contract(contractAddress, contractABI, signer); + + const value = e.target.store_value.value; + + // Send a transaction to smart contract to update the value + const tx = await contract.store(value); + + // Wait for the transaction to finish + const receipt = await tx.wait(); + const result = receipt.hash; + + setContractTx(result) + } + +return ( +
+
+ + +
+
Write-to-contract Tx Hash: ${contractTx}
+
+); +``` + +3. **Reading from a Contract** + +Without using the wallet itself, purely the provider, read-only methods can be called on contracts through a standard ethers.js instance. This mechanism won't deviate from the typical structure associated with such an action, the primary difference here is the usage of the integrated `provider` object. + +```js +// add to existing useState hook + const [contractMessage, setContractMessage] = useState(); + + const readFromContract = async () => { + if (!provider) { + console.log("provider not initialized yet"); + return; + } + + + // this guide uses ethers version 6.3.0. + const ethersProvider = new ethers.BrowserProvider(provider); + // for ethers version below 6.3.0. + // const provider = new ethers.providers.Web3Provider(provider); + + // paste your contract ABI + const contractABI = [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_initNum", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "retrieve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "num", + "type": "uint256" + } + ], + "name": "store", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + + // paste your contract address + const contractAddress = "0x3b01E4025B428fFad9481a500BAc36396719092C"; + + const contract = new ethers.Contract(contractAddress, contractABI, ethersProvider) + + // Reading a message from the smart contract + const contractMessage = await contract.retrieve(); + setContractMessage(contractMessage.toString()) + } + + + return ( + +
Read-from-contract Message: ${contractMessage}
+ ) +``` + +## Next Steps + +For additional guides regarding Particle Network (Particle Connect, Particle Auth, and other SDKs), please refer to the [Particle Network docs](https://docs.particle.network) and the [Particle Network GitHub account](https://github.com/Particle-Network). Additionally, you may want to visit the [Particle Network blog](https://blog.particle.network) for additional information on Particle Network's services, upcoming releases, and tech stack. Also, you can find the full implementation of the code for this guide on [GitHub](https://github.com/klaytn/examples/tree/main/wallet-libraries/particle-sample). diff --git a/docs/learn/kni.md b/docs/learn/kni.md index a2fe39f905a..148bdbfebe4 100644 --- a/docs/learn/kni.md +++ b/docs/learn/kni.md @@ -34,4 +34,4 @@ kni://a979...163c@10.0.0.1:32323?subport=32324&discport=30301 # multi-channel ``` If you want to know how to generate a KNI of a node, please refer to [Node Key & Node URI Creation](../nodes/core-cell/install/before-you-install.md#node-key-node-uri-creation). -The KNI scheme is used in node discovery protocol, [setting `static-nodes.json` file](../nodes/core-cell/install/install-proxy-nodes.md#install-static-nodes-json), [addPeer API](../references/json-rpc/admin.md#admin_addpeer), [bootnodes option](../nodes/references/configuration-files.md#properties) and etc. +The KNI scheme is used in node discovery protocol, [setting `static-nodes.json` file](../nodes/core-cell/install/install-proxy-nodes.md#install-static-nodes-json), [addPeer API](../references/json-rpc/admin.md#admin_addpeer), [bootnodes option](../misc/operation/configuration.md#properties) and etc. diff --git a/docs/learn/storage/live-pruning.md b/docs/learn/storage/live-pruning.md index 4e83bc3bb55..562a8e34935 100644 --- a/docs/learn/storage/live-pruning.md +++ b/docs/learn/storage/live-pruning.md @@ -24,4 +24,4 @@ To use StateDB Live Pruning, the following environment should be set up: 1. Use a binary of klaytn v1.11.0 or higher. 2. Please download the pruned DB snapshot from this [link](https://packages.klaytn.net/cypress/pruning-chaindata/) if you don't want to synchronize all blocks from the genesis block. 3. (Optional) Add the flag `--state.live-pruning-retention ` for how long recent states are retained. Default value is 172800 (48 hours) -4. Refer to the following link to set the DB location and restart the node with `--state.live-pruning` added [chaindata-change](../../nodes/node-migration.md#disk-management-1) section. \ No newline at end of file +4. Refer to the following link to set the DB location and restart the node with `--state.live-pruning` added [chaindata-change](../../misc/operation/chaindata-change.md) section. \ No newline at end of file diff --git a/docs/learn/storage/state-migration.md b/docs/learn/storage/state-migration.md index 3fe48181618..ca2563ff45d 100644 --- a/docs/learn/storage/state-migration.md +++ b/docs/learn/storage/state-migration.md @@ -10,4 +10,4 @@ More details on the mechanism of State Migration can be found below: [Klaytn v1.5.0 State Migration: Saving Node Storage](https://medium.com/klaytn/klaytn-v1-5-0-state-migration-saving-node-storage-1358d87e4a7a) [Klaytn State Migration: An Efficient Way to Reduce Blockchain Data](https://medium.com/klaytn/klaytn-state-migration-an-efficient-way-to-reduce-blockchain-data-6615a3b36523) -To use State Migration, please refer to [`Chaindata Migration`](../../nodes/node-migration.md#disk-management-2) page of Operation Guide. \ No newline at end of file +To use State Migration, please refer to [`Chaindata Migration`](../../misc/operation/chaindata-migration.md) page of Operation Guide. \ No newline at end of file diff --git a/docs/nodes/node-migration.md b/docs/misc/operation/chaindata-change.md similarity index 68% rename from docs/nodes/node-migration.md rename to docs/misc/operation/chaindata-change.md index 88c9b1c3557..2c598f0290d 100644 --- a/docs/nodes/node-migration.md +++ b/docs/misc/operation/chaindata-change.md @@ -1,15 +1,13 @@ -# Node Migration - -## Change Chaindata +# Change Chaindata -### CN Node Migration STEP +## CN Node **Migration STEP** -#### Create new disk +### Create new disk 1. Preparing new disk (3,500GB disk) or creating new path on the current disk (It must have 3,500GB available.) @@ -18,7 +16,7 @@ -##### Option 1 - New disk (more than 2500GB) +#### Option 1 - New disk (more than 2500GB) 1. Attach the disk to EC2 and run the command below @@ -43,7 +41,7 @@ $ sudo mkdir /var/kcnd2/data $ sudo mkdir /var/kcnd2/log ``` -##### Option 2 - Current Disk (not recommended) +#### Option 2 - Current Disk (not recommended) 1. Create New Folder @@ -52,7 +50,7 @@ $ sudo mkdir /var/kcnd2/data $ sudo mkdir /var/kcnd2/log ``` -#### Download the latest chaindata +### Download the latest chaindata Download Chain Data to the data of the new Klaytn Data DIR. (You can check the details on Chain Data in [https://packages.klaytn.net/cypress/chaindata/](https://packages.klaytn.net/cypress/chaindata/)) @@ -81,9 +79,11 @@ $ tar -xvf klaytn-cypress-chaindata-2021???????????.tar.gz $ tar -I pigz -xvf klaytn-cypress-chaindata-2021???????????.tar.gz ``` -### Configure DATA_DIR & LOG_DIR -#### Option 1 - Swap the old & new path + +## Configure DATA_DIR & LOG_DIR + +### Option 1 - Swap the old & new path -##### 옵션 1 - 새 디스크(2500GB 이상) +#### 옵션 1 - 새 디스크(2500GB 이상) 1. 디스크를 EC2에 연결하고 아래 명령을 실행합니다. @@ -43,7 +41,7 @@ $ sudo mkdir /var/kcnd2/data $ sudo mkdir /var/kcnd2/log ``` -##### 옵션 2 - 현재 디스크(권장하지 않음) +#### 옵션 2 - 현재 디스크(권장하지 않음) 1. 새 폴더 만들기 @@ -52,7 +50,7 @@ $ sudo mkdir /var/kcnd2/data $ sudo mkdir /var/kcnd2/log ``` -#### 최신 체인 데이터 다운로드 +### 최신 체인 데이터 다운로드 새로운 클레이튼 데이터 DIR의 데이터에 체인 데이터를 다운로드합니다. (체인 데이터에 대한 자세한 내용은 [https://packages.klaytn.net/cypress/chaindata/](https://packages.klaytn.net/cypress/chaindata/)에서 확인할 수 있습니다.) @@ -81,9 +79,9 @@ $ tar -xvf klaytn-cypress-chaindata-2021???????????.tar.gz $ tar -I pigz -xvf klaytn-cypress-chaindata-2021???????????.tar.gz ``` -### DATA_DIR & LOG_DIR 구성하기 +## DATA_DIR & LOG_DIR 구성하기 -#### 옵션 1 - 이전 경로와 새 경로 바꾸기 +### 옵션 1 - 이전 경로와 새 경로 바꾸기