Mantle 백서

Mantle

원문

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

ode receives the transaction and checks if the account balance is sufficient, including the L2 Transaction Fee and L1 Rollup Fee\*. 4. The transaction is executed successfully, recording your interaction with Mantle Network. {% hint style="warning" %} *\*Note that there is currently no RPC interface that provides accurate estimates of L1 Rollup Fee, please ensure that wallets have sufficient balance, even though the amount needed is generally very small.* {% endhint %} ## Keep in Mind ### **Sending Transactions**&#x20; Since Mantle supports Ethereum's JSON RPC interface, you can use the `eth_gasPrice` method to obtain recommended L2 gas price values. Similarly, you can use `eth_estimateGas` to estimate your L2 gas usage. ### **Gas Price Updates** Gas prices on L2 are set to **0.05 Gwei** by default, it will be updated every once in a while with reference to the recent blocks on Ethereum. ### EIP-1559 Support Currently, Mantle Network does **NOT** support EIP-1559, so we recommend using legacy structuring for your transactions. The order of transactions is FIFO, and it will be executed based on the sequence (time of receiving) they are received in. ### **Displaying Fees to Users** You can use the RPC method `eth_getTransactionReceipt` to obtain the fees for a particular transaction, where the L1 Rollup Fee portion is listed as the field `l1fee`. #### **Estimating the Total Fee**&#x20; You can estimate the total fee by combining your estimates for the L2 execution fee and L1 data fee. ## Common RPC Errors ### Insufficient Funds **Error code:** -32000 **Error message:** invalid transaction: insufficient funds for l1Fee + l2Fee + value&#x20; You'll get this error when the account's $MNT balance is not enough to cover the transaction fee and the transfer amount. Check the account balance to ensure that the minimum amount requirements are met. ### Gas Price Too Low **Error code:** -32000&#x20; **Error message:** gas price too low: X wei, use at least tx.gasPrice = Y wei&#x20; This is a custom RPC error that Mantle network returns when a transaction is rejected because the set gas price is too low. Currently, at least **0.05 Gwei** is required, which can be obtained from the `GasOracle` contract `0x420000000000000000000000000000000000000F` ### Gas Price Too High Error code: -32000&#x20; Error message: gas price too high: X wei, use at most tx.gasPrice = Y wei&#x20; This is a custom RPC error that Mantle network returns when a transaction is rejected because the set gas price is too high. Currently limit is set at **200 Gwei.** # How-to Guides # Connecting Wallet to Mantle Network Adding Mantle Network configuration and the $MNT token to your wallet {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! {% endhint %} ## Add Using Chainlist You can automatically add Mantle Network to your wallet with one click using **Chainlist** by navigating to the following pages: * [Add Mainnet](https://chainlist.org/chain/5000) * [Add Testnet](https://chainlist.org/chain/5001) <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FPHxDLSpNk8bBEmCjTEcj%2Fchainlist-1.png?alt=media&amp;token=1dc1a4a2-94df-47f6-bd35-56c6f8375d02" alt="" width="375"><figcaption></figcaption></figure> Simply connect your wallet to the web page, click on the **'Add to Metamask'** button that shows up, and approve the action in your wallet. ## Add Network Manually 1. Launch MetaMask and login to your wallet. 2. The default network setting for the wallet is generally '**Ethereum Mainnet**'. Click on the button in the top-left to bring up a dropdown menu. Click on '**Add Network**' at the bottom of the dropdown menu. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F5DA7J7vBtq6JvJj9Xvya%2Fadd-wallet-1.png?alt=media&amp;token=8713d001-0ee4-43e9-aada-dcf647d7ced5" alt="" width="352"><figcaption></figcaption></figure> 3. This will take you the '**Add a network**' page where you'll see multiple popular networks. Click on '**Add a network manually**' to bring up a form <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FMBCdUcRrWr4vkjkLRlXs%2Fadd-wallet-2.png?alt=media&amp;token=4df7e459-e9f0-4ced-961c-5020618994a8" alt="" width="563"><figcaption></figcaption></figure> 3. Fill in the following info and click '**Save**' to finish. The network option will appear in the network setting dropdown menu once you're done. <table><thead><tr><th width="198" align="center">Field</th><th>Mainnet Config</th><th width="308">Testnet Config</th></tr></thead><tbody><tr><td align="center"><strong>Network name</strong></td><td>Mantle</td><td>Mantle Testnet</td></tr><tr><td align="center"><strong>New RPC URL</strong></td><td><a href="https://rpc.mantle.xyz/">https://rpc.mantle.xyz/</a></td><td><a href="https://rpc.testnet.mantle.xyz/">https://rpc.testnet.mantle.xyz/</a></td></tr><tr><td align="center"><strong>Chain ID</strong></td><td>5000</td><td>5001</td></tr><tr><td align="center"><strong>Currency symbol</strong></td><td>MNT</td><td>MNT</td></tr><tr><td align="center"><strong>Block explorer URL</strong></td><td><a href="https://explorer.mantle.xyz/">https://explorer.mantle.xyz/</a></td><td><a href="https://explorer.testnet.mantle.xyz/">https://explorer.testnet.mantle.xyz/</a></td></tr></tbody></table> <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FW8eyZiJ3gszdi7oLdK47%2Fimage.png?alt=media&amp;token=44376a3a-edaf-4513-8e16-f26839d91250" alt="" width="375"><figcaption></figcaption></figure> ## Add $MNT to your Goerli wallet 1. Navigate to your wallet, and click on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FjTtp8wMn7PKxG355ylGR%2Fimage.png?alt=media&amp;token=e1c70793-4de1-42c1-8128-366266eb9ad4" alt="" data-size="line"> button at the bottom to bring up a form. 2. Enter the $MNT token contract address `0xc1dC2d65A2243c22344E725677A3E3BEBD26E604` , and as you do that the other two fields will get populated automatically. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FT3duUen0hu4XXPH33Bll%2Fimage.png?alt=media&amp;token=5debf1bf-3d39-461e-b6d3-8f100855801c" alt="" width="351"><figcaption></figcaption></figure> 3. Next, click on the "Add custom token" button at the bottom, and then click <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FF7Y8ZuMf5gv9zAnxOC2S%2Fimage.png?alt=media&amp;token=8b0e5423-a231-4adf-8e36-9d320821c433" alt="" data-size="line"> in the next window to finish. You should be able to see your current balance. # Fetching Test Tokens {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! {% endhint %} ## Faucets To begin transacting on Mantle Testnet, you must acquire Goerli $ETH and testnet $MNT and bridge it across. You can obtain Goerli $ETH from the following faucets:&#x20; * [Paradigm Multifaucet](https://faucet.paradigm.xyz/) * [Alchemy Faucet](https://goerlifaucet.com/) You can receive testnet $MNT tokens from the [Mantle faucet](https://faucet.testnet.mantle.xyz/).&#x20; {% hint style="info" %} Make sure to import the $MNT token to your Goerli wallet to see the current balance. The contract address is `0xc1dC2d65A2243c22344E725677A3E3BEBD26E604` {% endhint %} ## Discord Alternatively, you can also acquire test $MNT on Goerli from our [Discord server](https://discord.gg/0xmantle). Once you've joined the server, navigate to the **#faucet** channel and send the following message to receive your test $MNT.&#x20; ``` $faucet [your erc20 address] ``` {% hint style="info" %} You can make a claim to any ERC-20 address every 4 hours {% endhint %} ## Mint $MNT on Goerli via Etherscan {% hint style="info" %} Make sure your wallet has enough $gETH to perform the mint action before moving forward. {% endhint %} 1. First, you'll need to look up the test $MNT contract on Etherscan and navigate to the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F6Um3cHMxS2mKk7k0fGUD%2Fimage.png?alt=media&amp;token=40493aa9-5884-4cde-adcf-f773907dcf32" alt="" data-size="line"> section under the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FT8rkwVKWT8kYQF4g23XF%2Fimage.png?alt=media&amp;token=a732bf71-f24e-4f5b-bbf7-26b9e624c846" alt="" data-size="line"> tab. You can follow this link to get there directly: {% embed url="<https://goerli.etherscan.io/address/0xc1dC2d65A2243c22344E725677A3E3BEBD26E604#writeProxyContract>" %} 2. Next, switch your wallet network to Goerli, and import (if you haven't already) the $MNT token using this contract address: `0xc1dC2d65A2243c22344E725677A3E3BEBD26E604` 3. Now connect your wallet to Etherscan using the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2Fdpt5wqt9FUhVtrbwnfYy%2Fimage.png?alt=media&amp;token=e1564f26-140b-40b6-a68c-7ba7722a68f4" alt="" data-size="line"> button. 4. Find and click on the `mint()` function in the list on the Etherscan page. It's on no.9. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FCtAjJvjPxcRFkzmmgtwz%2Fimage.png?alt=media&amp;token=2fbae3fe-f033-4be5-86cc-f0cf6ecda4fe" alt="" width="375"><figcaption></figcaption></figure> 5. Click on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F4NCo26uMH6tOmTyvOmQn%2Fimage.png?alt=media&amp;token=61c336cd-6d76-4789-ba49-35ef168a42ce" alt="" data-size="line"> button next to the function name to input a value. The mint amount needs to be entered in *wei* units, so 1 $MNT token is represented as 10^18. Select 10^18 from the drop-down list, and click on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FamSKH61S4cS7PHQqMgnI%2Fimage.png?alt=media&amp;token=62874213-3632-45c0-9665-635ea574a565" alt="" data-size="line"> button. That'll automatically enter 10^18 (1 followed by 18 zeroes) in the amount field. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FUNi3uszyqx9JFGD5zLOK%2Fimage.png?alt=media&amp;token=602663b9-e5eb-4914-84db-4f50baf0fda3" alt="" width="371"><figcaption></figcaption></figure> 6. Now you can add a few zeroes at the back for a higher amount. For example, add three zeroes at the back to mint 1000 $MNT, and so on. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FfH0ILyxOvGIFLeTejWkq%2Fimage.png?alt=media&amp;token=1223ff1d-81e2-4a17-930f-b63b98ebcf7e" alt="" width="375"><figcaption></figcaption></figure> 7. Finally, click on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FP35Q7kyENkmOeDnlLBMd%2Fimage.png?alt=media&amp;token=7b980452-7750-4c66-aef1-4af439a31b70" alt="" data-size="line"> button to send a transaction. Confirm the action in your wallet, and after a few seconds your $MNT will show up there. # Using Mantle Bridge How to deposit and withdraw assets using official Mantle Bridge {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! {% endhint %} You can use the [testnet bridge](https://bridge.testnet.mantle.xyz) to get acquainted with the UI of the official Mantle bridge. The official [Mantle Bridge on Mainnet](https://bridge.mantle.xyz) operates in exactly the same way connecting to Ethereum Mainnet. ## Deposit $MNT Follow the steps below to deposit your tokens from Goerli to Mantle Testnet: 1. Navigate to the [testnet bridge](https://bridge.testnet.mantle.xyz) and connect your wallet by clicking on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F0ZTHcYXAX5nFLyVE9cYi%2Fimage.png?alt=media&amp;token=0111ef66-d6f4-4d25-8a2a-7d99a7d5a04e" alt="" data-size="line"> button in the top-right. 2. Select the "Deposit" tab and enter the amount of $MNT you want to bridge over to Mantle Testnet, and then click on the button at the bottom to proceed with token approval. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F7YM93MErtZwe2wzoRmRb%2Fimage.png?alt=media&amp;token=62d6210b-5f55-4c03-b80a-3a30de975899" alt="" width="375"><figcaption></figcaption></figure> 3. Enter an amount to approve to the contract. You can choose an amount you're comfortable with, but **make sure its equal to or greater than the amount you're depositing**. Then click on the "Next" button. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FlLTJoRxYqetHaWCukpSA%2Fimage.png?alt=media&amp;token=0ef9a4b9-8277-4af5-815e-cbd2fa85bcf4" alt="" width="375"><figcaption></figcaption></figure> 4. Click on the "Approve" button to approve the amount you entered. Approval may take some time, about 10 seconds or so. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F8D69JPFFKiPRQomRggUl%2Fimage.png?alt=media&amp;token=e1b20247-2d42-4da0-a062-8361634f32bc" alt="" width="375"><figcaption></figcaption></figure> 5. Once approval is successful, you'll see the "Deposit Tokens to L2" button. Click on it to proceed to confirmation. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F5vzB0afNtRgTC1ShXLec%2Fimage.png?alt=media&amp;token=6d0c250c-1248-4fc5-9d36-0a2b1bf2506a" alt="" width="375"><figcaption></figcaption></figure> 6. Here you'll be able to see the deposit amount and approximate time it'll take to complete the deposit operation. Finally, click on the "Confirm" button to send a deposit transaction. You'll need to confirm the transaction in your wallet too. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FtucYLHN4Cf3NmDMKBiM0%2Fimage.png?alt=media&amp;token=44ed0b88-7a3b-47fc-9d52-e885fd5fb38f" alt="" width="375"><figcaption></figcaption></figure> 7. Feel free to check the transaction status by click on the "Goerli Explorer" button. Once complete the balance will be reflected in your L2 testnet wallet. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FxgVBG4FPQdGwc3iFuaqn%2Fimage.png?alt=media&amp;token=8e6c6a8e-446d-4f77-8ee7-611ea3fe6bbe" alt="" width="375"><figcaption></figcaption></figure> ## Withdraw $MNT Follow the steps below to withdraw your tokens from Mantle Testnet to Goerli: 1. Navigate to the [testnet bridge](https://bridge.testnet.mantle.xyz) and connect your wallet by clicking on the <img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F0ZTHcYXAX5nFLyVE9cYi%2Fimage.png?alt=media&amp;token=0111ef66-d6f4-4d25-8a2a-7d99a7d5a04e" alt="" data-size="line"> button in the top-right. 2. Select the "Withdraw" tab and enter the amount of $MNT you want to bridge over to Goerli, and then click on the "Withdraw Tokens from L2" button at the bottom. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FTpE6nsV6NjrGagz7cdXk%2Fimage.png?alt=media&amp;token=c0c573be-2ca1-4286-ad99-027bd336a8ef" alt="" width="375"><figcaption></figcaption></figure> 3. You'll be able to see the withdraw amount and an approximation for the amount of time it will take for the token transfer. **Note that once complete, the amount still needs to be claimed on L1 for it to land in your wallet.** Check the checkboxes, and click on the "Confirm" button to send a withdraw transaction. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F2deHrzSOl0yBrisSw6Tq%2Fimage.png?alt=media&amp;token=632f10e2-e0f5-4619-9f4a-3b78ecbc727f" alt="" width="375"><figcaption></figcaption></figure> 4. Confirm the operation in your wallet. Feel free to check out the transaction status on the Explorer by clicking on the "Mantle Testnet Explorer" button. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FWvv3kF6LXCDxgVsCUZeV%2Fimage.png?alt=media&amp;token=ab673ad8-7b4f-451c-a37f-2bc32c0d6170" alt="" width="375"><figcaption></figcaption></figure> 5. You'll be able to claim the $MNT tokens on Goerli once available by sending a transaction from your wallet. Click on your wallet address in the top-right to see all your withdrawals and deposits. <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F4o7RO5tB8bP9Ltjau1Na%2Fimage.png?alt=media&amp;token=85d7be74-a5d2-4e2f-a2c9-073aa583a7bd" alt="" width="298"><figcaption></figcaption></figure> <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FkeZYXPHEyZUXsNkgr1FC%2Fimage.png?alt=media&amp;token=d78c7ffe-ef70-4bc0-8099-1cad90ad8a39" alt=""><figcaption></figcaption></figure> 6. Click on the "Claim" button and confirm the transaction in your wallet. The $MNT will show up in your Goerli wallet once the transaction is successfully sent. # FAQs {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! {% endhint %} ## General ### Q. Can I use Truffle, Hardhat, and Remix to deploy contracts on Mantle Network? Yes. All the EVM-compatible Web3 libraries, IDEs, developments frameworks can be used to deploy on and connect to Mantle Network. This includes, but isn't limited to, popular tools such as: * [Remix](https://remix.ethereum.org/) * [Truffle](https://trufflesuite.com/docs/) * [Hardhat](https://hardhat.org/docs) * [Foundry](https://github.com/foundry-rs/foundry) * [Web3.js](https://github.com/ethereum/web3.js/) * [Ethers.js](https://github.com/ethers-io/ethers.js/) ### Q. What signature algorithm does Mantle Network use? Mantle Network uses the same signature algorithm as Ethereum. (ECDSA on the secp256k1 curve) ### Q. What is the block gas limit on Mantle Network? The block gas limit is currently set to 30,000,000, or 30M units. ### Q. What's the average block time on Mantle Network? New blocks are generated on L2 every time a new transaction is received, and each block contains a single transaction. Thus, the block time on Mantle Network depends on the transaction volume at any given time. ### Q. How does transaction finality work on Mantle Network? * Transaction/block finality on L2 is instantaneous * Transaction/block finality on L1 connects to the challenge period, which is
프로젝트로 돌아가기