Plume 백서

Plume

원문

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

content-ref %} {% content-ref url="/pages/uNhNFfwfQDuuw8Bvah3s" %} [How to Deploy Smart Contracts](/plume/developers/how-to-guides/how-to-deploy-smart-contracts) {% endcontent-ref %} {% content-ref url="/pages/tnsEl9QOTzlwOZStIbAR" %} [How to Verify Smart Contracts](/plume/developers/how-to-guides/how-to-verify-smart-contracts) {% endcontent-ref %} {% content-ref url="/pages/6BPAmQkLGQcFABHJKjWF" %} [How to Run a Node](/plume/developers/how-to-guides/how-to-run-a-node) {% endcontent-ref %} # How to Connect to Network {% hint style="warning" %} To interact with Plume Testnet, you'll need a wallet and test tokens. {% endhint %} {% content-ref url="/pages/6YTYhg7qXzjfLIdlNYnN" %} [Install and Configure Wallet](/plume/developers/how-to-guides/how-to-connect-to-network/install-and-configure-wallet) {% endcontent-ref %} {% content-ref url="/pages/53gUOEiTF8d1HOCH09Ti" %} [Claim test tokens](/plume/developers/how-to-guides/how-to-connect-to-network/claim-test-tokens) {% endcontent-ref %} # Install and Configure Wallet ## Install a Wallet You need to install a wallet in order to interact with the Plume Mainnet and Plume Testnet. **Plume supports all EVM-compatible wallets, including:** * [MetaMask](https://metamask.io/) * [Trust Wallet](https://trustwallet.com/) * [Bitget Wallet](https://web3.bitget.com/) * [OKX Wallet](https://www.okx.com/web3) * [Coinbase Wallet](https://www.coinbase.com/wallet) * [FoxWallet](https://foxwallet.com/) * [Binance Web3 Wallet](https://www.binance.com/en/web3wallet) * [Reown](https://reown.com/) * [Rainbow](https://rainbow.me/) * [Phantom](https://phantom.app/) ## Configure Wallet Each wallet has its own process for adding Plume as a supported network. For example, below are the steps for **MetaMask**: {% stepper %} {% step %} Open the MetaMask extension in **"Expand View"** mode <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FHF5mOm5oy7gd9pd6Fchf%2Fimage.png?alt=media&amp;token=7ca0019b-beb1-4564-9257-cf4cc4a9e950" alt="" width="335"><figcaption></figcaption></figure> {% endstep %} {% step %} Click the network selection button in the top left of the expanded view/extension <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FNc1FetUf6Q1b0UekqXyZ%2Fimage.png?alt=media&amp;token=6bdb6d87-d250-4f3e-8488-3e100e29f4f0" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} Select **"Add a Custom Network"** <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FVrq86Se2uizlAkMmiTiC%2Fimage.png?alt=media&amp;token=a80a8c04-966e-4102-9b79-972fd3118b24" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} Fill in the details from below for Plume Mainnet and Testnet, and press **"Save"** {% tabs %} {% tab title="Plume Mainnet" %} <table data-header-hidden><thead><tr><th width="311"></th><th></th></tr></thead><tbody><tr><td>Network Name</td><td>Plume Mainnet</td></tr><tr><td>RPC URL</td><td><a href="http://rpc.plume.org/">http://rpc.plume.org</a></td></tr><tr><td>Chain ID</td><td>98866</td></tr><tr><td>Currency Symbol</td><td>PLUME</td></tr><tr><td>Block Explorer URL</td><td><a href="https://explorer.plume.org/">https://explorer.plume.org</a></td></tr></tbody></table> {% endtab %} {% tab title="Plume Testnet" %} <table data-header-hidden><thead><tr><th width="311"></th><th></th></tr></thead><tbody><tr><td>Network Name</td><td>Plume Testnet</td></tr><tr><td>RPC URL</td><td><a href="https://testnet-rpc.plume.org">https://testnet-rpc.plume.org</a></td></tr><tr><td>Chain ID</td><td>98867</td></tr><tr><td>Currency Symbol</td><td>PLUME</td></tr><tr><td>Block Explorer URL</td><td><a href="https://testnet-explorer.plume.org">https://testnet-explorer.plume.org</a></td></tr></tbody></table> {% endtab %} {% endtabs %} Here's a screenshot for testnet details: <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FgQxFxap0n7blXAAuBe1H%2Fimage.png?alt=media&amp;token=3d52560a-dbbb-45ac-a27b-53cc14f86d24" alt="" width="307"><figcaption></figcaption></figure> {% endstep %} {% step %} Switch to desired network now {% endstep %} {% endstepper %} # Claim test tokens To interact and make transactions on Plume Testnet you'll require `$PLUME` for making transactions and `$pUSD` for performing any financial operations but not limited. ## Before you Begin * Check if you are using the right [network configuration](/plume/developers/network-information#network-details) ## Claiming tokens {% stepper %} {% step %} ### Go to [Plume Faucet](https://faucet.plumenetwork.xyz) {% endstep %} {% step %} ### Connect Wallet Use the "Connect wallet" button on the faucet page to connect to your desired wallet in which you want the test tokens <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2F4YA7qfyzBE3SAmFl5qw2%2Fimage.png?alt=media&amp;token=f243e0e1-4ff3-4cf4-93ba-8335caf2cc1c" alt="" width="527"><figcaption></figcaption></figure> {% endstep %} {% step %} ### Select the token **PLUME** - The native gas token to make transactions on Plume Testnet **pUSD** - Plume USD or pUSD is the premier stablecoin of the Plume ecosystem. [Know more](/plume/tokens/plume-usd) **WPLUME** - Wrapped Plume or WPLUME is the ERC-20 compatible and tradable version of PLUME and can be used to interact with other ERC-20 assets. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FF6BVTlGx0wFxlXwUBkYQ%2Fimage.png?alt=media&amp;token=3e557b3c-303d-4f22-99bf-734fa40ec6eb" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} ### Pass the verification challenge You'll need to pass the cloudflare challenge in order to claim test tokens from the faucet. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FKfuLOxu2ZG8vxBRruQ0V%2Fimage.png?alt=media&amp;token=53f65559-6d50-4669-a26f-b5b051396c0f" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} ### Claim tokens After you have passed the verification challenge you'll be able to claim the testnet tokens in your wallet. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2F7Ramy2yFwW1BXpqPAPhD%2Fimage.png?alt=media&amp;token=54ccefe6-df70-49d7-82cc-2b749d31fb8b" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} ### Tokens are on the way <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FoXHLTZTxCdg2k2XeOw31%2FScreenshot%202025-04-25%20181459.png?alt=media&amp;token=a72534eb-59bc-476c-b756-8612e207363d" alt=""><figcaption></figcaption></figure> {% endstep %} {% endstepper %} # How to Deploy Smart Contracts {% content-ref url="/pages/Z6JcXaIlPs2mPgfUvnvu" %} [Deploy using Remix IDE](/plume/developers/how-to-guides/how-to-deploy-smart-contracts/deploy-using-remix-ide) {% endcontent-ref %} {% content-ref url="/pages/tOUJHUgcq8IMErtZKkk4" %} [Deploy using Foundry](/plume/developers/how-to-guides/how-to-deploy-smart-contracts/deploy-using-foundry) {% endcontent-ref %} {% content-ref url="/pages/bmK1Fnzlka5F0x8nYs82" %} [Deploy using Hardhat](/plume/developers/how-to-guides/how-to-deploy-smart-contracts/deploy-using-hardhat) {% endcontent-ref %} # Deploy using Remix IDE [Remix IDE](https://remix.ethereum.org/) is an online no-setup platform maintained by the Ethereum Foundation with a GUI for developing smart contracts. You can check the [Remix IDE docs](https://remix-ide.readthedocs.io/en/latest/run.html) to learn more about deployment. ## Before you Begin * Check if you are using the right [network configuration](/plume/developers/network-information) * Have enough test tokens in your wallet {% hint style="info" %} Learn more about claiming test tokens from [here](/plume/developers/how-to-guides/how-to-connect-to-network/claim-test-tokens). {% endhint %} ## Deploying your Contract Let's write a simple one-of-one NFT contract based on [OpenZeppelin's open-source ERC-721](https://docs.openzeppelin.com/contracts/4.x/erc721) implementation to tokenize our CBO's prized Rolex watch on Plume Testnet for instance. {% stepper %} {% step %} ### Create a file on Remix IDE Go to [Remix IDE](https://remix.ethereum.org) and create a new file. We are using a sample file named `RolexYachtMaster40.sol`. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FK1FoGtUyfo0XhpGh5Ocu%2Fimage.png?alt=media&amp;token=92ce0433-0dca-44ac-8229-dd284f15ae47" alt=""><figcaption></figcaption></figure> {% endstep %} {% step %} ### Add your code to the file To demonstrate we are using this sample smart contract code, you can add your own code. {% code title="RolexYachtMaster40.sol" overflow="wrap" fullWidth="false" %} ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract RolexYachtMaster40 is Ownable, ERC721 { error NFTAlreadyMinted(); bool private _minted; constructor() Ownable(msg.sender) ERC721("Rolex Yacht-Master 40", "") {} function mint() public onlyOwner returns (uint256) { if (_minted) { revert NFTAlreadyMinted(); } _safeMint(owner(), 0); _minted = true; return 0; } } ``` {% endcode %} {% endstep %} {% step %} ### Compile the Contract Go to the **Solidity Compiler** tab on the IDE, choose the compiler version if you wish to and click on the blue `Compile <file_name>` button. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FuqF136WGHqcGTecXrQs7%2Fimage.png?alt=media&amp;token=5f6b56b3-ef98-4c25-84ad-81bf3207619f" alt=""><figcaption></figcaption></figure> {% hint style="success" %} A green tick :white\_check\_mark: will appear on the Compiler tab if the compilation is successful. {% endhint %} {% endstep %} {% step %} ### Deploying the contract using MetaMask Make sure you are on Plume Testnet network in MetaMask. <img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FItJkmveyhKObQAptoYaQ%2Fimage.png?alt=media&amp;token=08467db9-7e23-4110-a086-25781a9b2af3" alt="" data-size="original"> Select **Injected Provider - MetaMask** in the Environment dropdown and select the account which has sufficient ETH to pay to gas fees. As for our sample contract, no need to change other fields and click on **Deploy** button <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2F7FKIFtXy68FFCgkFG2bZ%2Fimage.png?alt=media&amp;token=5382bcb3-f426-4949-bc4a-3910f1ce8a8e" alt=""><figcaption></figcaption></figure> There will be a pop-up on MetaMask to confirm the transaction (asking for gas fees), on confirming the contract will be deployed. {% endstep %} {% step %} ### Contract Deployed Check the console for the transaction info and deployed contract on the left-side panel. <figure><img src="https://4283780171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcaO8bqNQ5CJfDyLKmEZF%2Fuploads%2FEwnTBGMAClW1xCNelLEQ%2Fimage.png?alt=media&amp;token=9ff8c82e-3c95-4ddd-b842-2e84650741ca" alt=""><figcaption></figcaption></figure> {% endstep %} {% endstepper %} # Deploy using Foundry [Foundry](https://getfoundry.sh/) is a Solidity framework for deploying smart contracts, built by [Paradigm](https://paradigm.xyz/) and written in Rust to be blazingly fast. ## Before you Begin * Check if you are using the right [network configuration](/plume/developers/network-information) * Have enough test tokens in your wallet {% hint style="info" %} Learn more about claiming test tokens from [here](/plume/developers/how-to-guides/how-to-connect-to-network/claim-test-tokens). {% endhint %} ## Foundry Setup Simply follow their ["Getting Started" documentation](https://book.getfoundry.sh/getting-started/installation) to install and run Foundry, then follow their ["Projects" documentation](https://book.getfoundry.sh/projects/creating-a-new-project) to create a new project.&#x20; Run the following commands in your terminal: ```sh curl -L https://foundry.paradigm.xyz | bash foundryup ``` ## Setup your project To start a new project with Foundry, use [`forge init`](https://book.getfoundry.sh/reference/forge/forge-init.html): ```sh forge init plume ``` Let's install the OpenZeppelin dependency required for our sample smart contract. ```sh forge install openzeppelin/openzeppelin-contracts ``` <details> <summary>Sample Smart Contract Code</summary> This is a sample NFT contract based on [OpenZeppelin's open-source ERC-721](https://docs.openzeppelin.com/contracts/4.x/erc721) implementation to tokenize our CBO's prized Rolex watch on Plume. {% code title="src/RolexYachtMaster40.sol" %} ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract RolexYachtMaster40 is Ownable, ERC721 { error NFTAlreadyMinted(); bool private _minted; constructor() Ownable(msg.sender) ERC721("Rolex Yacht-Master 40", "") {} function mint() public onlyOwner returns (uint256) { if (_minted) { revert NFTAlreadyMinted(); } _safeMint(owner(), 0); _minted = true; return 0; } } ``` {% endcode %} </details> Then, compile the project using [`forge build`](https://book.getfoundry.sh/reference/forge/forge-build.html): <pre class="language-sh"><code class="lang-sh"><strong>forge build </strong> [⠰] Compiling... [⠔] Compiling 38 files with Solc 0.8.27 [⠒] Solc 0.8.27 finished in 1.01s Compiler run successful! </code></pre> ## Deploy your Contract Follow the instructions on in the ["Deploying" documentation](https://book.getfoundry.sh/forge/deploying) and set your `PLUME_RPC_URL` environment variable similar to the ETH RPC URL. The below command will deploy the sample smart contract provided above on **Plume Testnet** for instance (switch the RPC and verifier URL to Mainnet to deploy on Plume Mainnet). {% code overflow="wrap" %} ```sh export PLUME_RPC_URL=https://testnet-rpc.plume.org export CONTRACT_PATH=<contract_file>:<contract_name> forge create $CONTRACT_PATH \ --rpc-url $PLUME_RPC_URL \ --broadcast \ --legacy --interactive ``` {% endcode %} {% hint style="info" %} To verify the contract while deploying, use `--verify` flag, more details [here](https://book.getfoundry.sh/forge/deploying). {% endhint %} The below command will verify the contract and deploy it simultaneously. ```sh export PLUME_RPC_URL=https://testnet-rpc.plume.org export VERIFIER_URL=https://testnet-explorer.plume.org/api/ export CONTRACT_PATH=<contract_file>:<contract_name> forge create $CONTRACT_PATH \ --rpc-url $PLUME_RPC_URL \ --verify \ --verifier blockscout \ --verifier-url $VERIFIER_URL \ --broadcast \ --legacy --interactive ``` {% hint style="warning" %} Make sure to replace the details in the `<contract_file>:<contract_name>` with your contract details. {% endhint %} ### Sample Output ```sh No files changed, compilation skipped Enter private key: Deployer: 0x32820DE739394C1ee69264ef3C0193E4B5C0122c Deployed to: 0xa43a88ccfec87295aa0c5017a7ddcc5cdfcacdd0 Transaction hash: 0x1441297a9288fc37820a09e2e9b1d14d62b5d6341fd1e14159eabcedb7dfe115 ``` You can view the deployed contract on the [Plume Testnet Explorer](https://testnet-explorer.plumenetwork.xyz/). # Deploy using Hardhat [Hardhat](https://hardhat.org) is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment. ## Before you Begin * Check if you are using the right [network configuration](/plume/developers/network-information#network-details) * Have enough test tokens in your wallet {% hint style="info" %} Learn more about claiming test tokens from [here](/plume/developers/how-to-guides/how-to-connect-to-network/claim-test-tokens). {% endhint %} ## Hardhat Setup Start by creating a folder `plume-hardhat`. Open a terminal pointing to this folder and run the below command to initialize a node.js project. ```sh npm init -y ``` Followed by installing hardhat and other necessary libraries using the below command. ```sh npm install --save-dev hardhat @openzeppelin/contracts @nomicfoundation/hardhat-ignition-ethers dotenv ``` Let's create a hardhat project using `npx hardhat init` now. We are using a JavaScript template from the list of options to facilitate the deployment and choosing the configuration for the project as shown below. ``` √ What do you want to do? · Create a JavaScript project √ Hardhat project root: · \Users\...\plume-hardhat √ Do you want to add a .gitignore? (Y/n) · y √ Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox)? (Y/n) · y ``` {% hint style="info" %} Learn more about setting up hardhat project [here](https://hardhat.org/hardhat-runner/docs/guides/project-setup). {% endhint %} ## Configure and prepping to deploy Let's create a `.env` file to store the private key inside it safely. ```sh touch .env echo "PRIVATE_KEY=<your-wallet-private-key>" >> .env ``` Make the following adjustments to the auto-generated `hardhat.config.js` file to prepare to deploy to the **Plume Testnet** for instance (switch the RPC and verifier URL to Mainnet to deploy on Plume Mainnet): * Import the `hardhat-toolbox` and `hardhat-ignition-ethers` plugin into the Hardhat Runtime Environment. * Add the Plume Testnet [network details](/plume/developers/network-information#testnet-details). {% code title="hardhat.config.js" overflow="wrap" %} ```javascript require("@nomicfoundation/hardhat-toolbox"); require("@nomicfoundation/hardhat-ignition-ethers"); require('dotenv').config(); /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { solidity: "0.8.28", settings: { evmVersion: "cancun" }, networks: { hardhat: {}, "plume-testnet": { url: "https://testnet-rpc.plume.org", chainId: 98867, accounts: [process.env.PRIVATE_KEY] } }, etherscan: { apiKey: { "plume-testnet": "testnet" }, customChains: [ { network: "plume-testnet", chainId: 98867, urls: { apiURL: "https://testnet-explorer.plume.org/api", browserURL: "https://testnet-explorer.plume.org" } } ] } }; ``` {% endcode %} ## Compile and Deploy We'll be using a sample contract, you can replace this with your own codebase. Make sure you place the contract in **"Contracts"** directory within your Hardhat project. <details> <summary>Sample Smart Contract Code</summary> This is a sample NFT contract based on [OpenZeppelin's open-source ERC-721](https://docs.openzeppelin.com/contracts/4.x/erc721) implementation to tokenize our CBO's prized Rolex watch on Plume. {% code title="Contracts/RolexYachtMaster40.sol" %} ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract RolexYachtMaster40 is Ownable, ERC721 { error NFTAlreadyMinted(); bool private _minted; constructor() Own
프로젝트로 돌아가기