Mantle 백서

Mantle

원문

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

ocks, you may encounter the 'Timeout' issue, that's because the output of certain calls may be a large amount of data(due to big size blocks or large amount of logs) which may needs more time to be synced. So under such situations if the call lacks of timeout parameter or the default timeout settings is too low, it may result in an error of timeout. So it is recommended that you should add a timeout parameter with the call or set higher timeout parameter accordingly to solve the timeout issue. * **Error: intrinsic gas too low** This is due to your `gaslimit` being set too low. The `gaslimit` setting needs to be taken seriously, and we explain why you need the right `gaslimit` [here](/network/system-information/fee-mechanism/estimate-fees#estimate-fees-in-mantle-v2-tectonic)! * **Error: replacement transaction underpriced** This error usually occurs when you need to replace a transaction with the same nonce. Note that if you need to replace an old transaction with a new transaction with the same nonce, you need to set the `gasprice` by **1.1x**! ## Smart Contracts[​](https://docs-v2.mantle.xyz/devs/dev-guides/troubleshooting#smart-contracts) <a href="#smart-contracts" id="smart-contracts"></a> ### Deployment Issues[​](https://docs-v2.mantle.xyz/devs/dev-guides/troubleshooting#deployment-issues) <a href="#deployment-issues" id="deployment-issues"></a> {% tabs %} {% tab title="Hardhat" %} * **Contract deploy error: "max code size exceeded."** Set `optimizer` bigger. Such as: ```javascript module.exports = { solidity: { version: '0.8.4', settings: { optimizer: { enabled: true, runs: 10000, }, }, }, }; ``` {% endtab %} {% tab title="Foundry" %} * **"insufficient gas for l1Cost. Please use estimateGas to get gasLimit."** The reason for this error is that Mantle's gas model is different from Ethereum, and the `forge script` command broadcasts the transaction without estimating the gas using the provided mantle rpc. You can fix this error by these 2 ways: 1. Upgrade your Foundry tools version to the latest. 2. Add `--skip-simulation` to the `forge script` command. {% endtab %} {% endtabs %} ### Verification Issues[​](https://docs-v2.mantle.xyz/devs/dev-guides/troubleshooting#verification-issues) <a href="#verification-issues" id="verification-issues"></a> {% tabs %} {% tab title="Hardhat" %} * **Contract verification error: Hardhat found multiple contracts in the project (your MyTokenContract and the imported @openzeppelin/contracts/token/ERC20/IERC20.sol), and it doesn't know against which one you want to verify the bytecode** If you see this error, try verifying the contract again by specifying the name of the contract that you're looking to verify. You can do this using the --contract option. Here's an example: ```sh npx hardhat verify --contract "contracts/MyTokenContract.sol:MyToken" --network mantleTest 0x3A2b26... ``` {% endtab %} {% endtabs %} ### Contracts Call Issues <a href="#contracts-call-issues" id="contracts-call-issues"></a> {% tabs %} {% tab title="Foundry" %} * **Error: Failed to send transaction. Context: (code: -32000, message: failed to forward tx to sequencer, please try again. Error message: 'intrinsic gas too low', data: None)** The reason for this error is that Mantle's gas model is different from Ethereum, and the `forge script` command broadcasts the transaction without estimating the gas using the provided mantle rpc. Two things should be noted when using it: 1. Set the `priority-gas-price` to 0. 2. Upgrade your Foundry tools version to the latest or add `--skip-simulation` to the `forge script` command. {% endtab %} {% endtabs %} ## Standard Bridge[​](https://docs-v2.mantle.xyz/devs/dev-guides/troubleshooting#standard-bridge) <a href="#standard-bridge" id="standard-bridge"></a> * **Error when withdrawing: no bridge found for token pair** Try switching to a different [RPC provider](/network/for-developers/resources-and-tooling/node-endpoints-and-providers). ## Explorer[​](https://docs-v2.mantle.xyz/devs/dev-guides/troubleshooting#explorer) <a href="#explorer" id="explorer"></a> * **Error: Awaiting internal transactions for reason** You may encounter this error if you there are multiple internal transaction calls in the contract being invoked. This does not necessarily mean the transaction has failed, just that the explorer is yet to receive acknowledgements for all the internal transactions. <br> # FAQs ## General[​](https://docs-v2.mantle.xyz/devs/dev-guides/faqs#general) <a href="#general" id="general"></a> * **Does Mantle Network support EIP-1559?** **Mantle Network supports EIP-1559.** EIP-1559 is a new transaction method that will be introduced after the Bedrock upgrade of the OP Stack, and will allow transactions on Mantle Network to be executed in a more stable and controlled manner. See [here](/network/system-information/fee-mechanism/eip-1559-support) for more information. * **Why is the gas fee very high for my transaction?** Mantle v2 Tectonic introduces EIP-1559 type transactions and also to further reduce gas fees, the FIFO transaction ordering method is chosen to minimize the impact of the `priorityfee`, so you will need additional settings to optimize your handling fees, for more information check [here](/network/for-developers/optimize-your-transaction-fees). * **Why is the gas usage so high for my transaction?** Unlike most OP Stack-based chains, Mantle chooses to use the MNT native token as the fee for L2 transactions and covers the whole transaction cost (L1 + L2) when calculating the gas usage. Mantle introduces the [tokenRatio](/network/system-information/fee-mechanism#control-of-tokenratio) parameter which helps regulate the price fluctuations between ETH and MNT, when calculating the gas fee, Mantle will multiply with the `tokenRatio` compared to the other L2s' gasUsed (based on ETH). For example, if `tokenRatio` is `3000`, the gas usage will be calculated as `L2GasUsed * 3000 + L1GasUsed * 3000 * scalar`. Meanwhile, the gas usage can't reflect the level of gas fees, Mantle still has one of the [cheapest fees](/network/system-information/fee-mechanism#mantle-v2-tectonic-fee-showcase) compared to other L2s. * **Why did I get an error when I tried to send a transaction on Mantle Network?** There are various possibilities for transaction failures. Here, we kindly ask you to ensure that your transaction construction has not been affected by any modifications to fees in Mantle v2 Tectonic. For more details, please refer to [this page](/network/system-information/fee-mechanism/estimate-fees). * **Why is the value I get by calling the contract's `getL1fee` method so much smaller than the actual L1 fee?** This is due to the fact that `MNT` is used as the native gas fee token in Mantle, and you need to use the `tokenRatio` parameter to convert between `MNT` and `ETH` when calculating the L1 fee, for more information, please check [here](/network/system-information/fee-mechanism#understanding-fees-on-mantle-v2-tectonic)! ## Dev Tools[​](https://docs-v2.mantle.xyz/devs/dev-guides/faqs#dev-tools) <a href="#dev-tools" id="dev-tools"></a> * **Can I use Truffle, Hardhat, and Remix to deploy contracts on Mantle Network?** Yes. All the EVM-compatible Web3 libraries, IDEs, development 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/) You can check more tutorials [here](/network/for-node-operators/deployment-guides). * **Can I fetch DA transaction details with an API?** Currently, the only way to see DA transaction history is via the Explorer frontend. Here's the link for Mantle DA data storage: <https://mantlescan.xyz/batches> * **Does the RPC rate limit affect Explorer API usage too?** Yes. Once the RPC rate limit is reached, access to Explorer API will also be limited. * **Are there any limits set for batch transaction size?** The maximum batch transaction size is derived from the target gas configuration. Mantle Network is the same as other OP Stack-based chains in this regard. * **Are there any limits set on return log size for `eth_getLogs` RPC call?** Yes, it's best practice to limit the range of blocks you are querying in a single request to prevent issues such as timeout errors or overly large responses, in Mantle Network — 10,000 blocks. * **Does Mantle explorer support proxy contracts?** If the contract is detected as a proxy implementation, it can be supported. * **How to set the token image on Mantlescan?** You can submit token update via `https://mantlescan.xyz/tokenupdate/` or `https://mantlescan.xyz/tokenupdate/<address>` (append token contract address). * **How to add tokens on Mantle's official bridge?** You'll need to make a pull request against the Mantle token list repository. After PR is approved, you need to wait a few minutes before you can check the tokens on the bridge. Check more details [here](/network/for-developers/quick-access#adding-a-token-to-the-list). * **Does OpenZeppelin defender support EIP1559 transactions?** Yes, OpenZeppelin defender support sending EIP1559 transactions now. * **Why do I get the error "0x5e not defined" when compiling contracts?** This error occurs because Mantle's op-geth is not up to date, which doesn't support the `MCOPY(0x5e)` bytecode. To resolve this, specify the compiler version as **0.8.23** or below. And refer [this](/network/for-developers/the-differences-between-mantle-op-stack-and-ethereum#unsupported-opcodes) to get more unsupported opcodes. * **Why do I get the error "Missing etherscan key for chain 5000/5003" when verifying contracts on Mantlescan by using Foundry?** This error occurs because Foundry had [some bugs](https://github.com/foundry-rs/foundry/issues/7466) on this, we encourage developers to verify contracts via Mantlescan explorer rather than using forge, check [this](/network/for-developers/how-to-guides/how-to-verify-smart-contracts/use-explorer-to-verify-smart-contracts#compiled-using-foundry) for more details. * **Is the Opcode `PUSH0` supported in Mantle?** Yes, the `PUSH0` opcode is supported in Mantle. # How-to Guides # Connecting Wallet to Mantle Network You can connect your wallet to the Mantle Network in different ways, here we present you the following two ways: ## Add by Using Chainlist[​](https://docs-v2.mantle.xyz/users/how-to/wallet#add-by-using-chainlist) <a href="#add-by-using-chainlist" id="add-by-using-chainlist"></a> You can automatically add Mantle Network to your wallet with one click using **Chainlist** by navigating to the following pages: * [Add Mantle v2 Tectonic Mainnet](https://chainlist.org/chain/5000) * [Add Mantle V2 Tectonic Sepolia Testnet](https://chainlist.org/chain/5003) 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[​](https://docs-v2.mantle.xyz/users/how-to/wallet#add-network-manually) <a href="#add-network-manually" id="add-network-manually"></a> {% stepper %} {% step %} ### Launch Metamask Launch [MetaMask](https://metamask.io/download/) and login to your wallet. {% endstep %} {% step %} ### Add Network 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. <img src="https://docs-v2.mantle.xyz/assets/images/metamask-1-4c343f717ee5c76ceb3174cff4ff2daf.png" alt="" data-size="original"> {% endstep %} {% step %} ### Choose Manually 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 <img src="https://docs-v2.mantle.xyz/assets/images/metamask-2-58c012d71feff3ce45912a680768ec70.png" alt="" data-size="original"> {% endstep %} {% step %} ### Configure Network Infomation 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. <img src="https://docs-v2.mantle.xyz/assets/images/add-network-79b0d03f9e1209fd05311a364f12c958.png" alt="" data-size="original"> {% tabs %} {% tab title="Mainnet" %} | Name | Description | | ---------------------- | ------------------------- | | **Network name** | Mantle | | **New RPC URL** | <https://rpc.mantle.xyz/> | | **Chain ID** | 5000 | | **Currency symbol** | MNT | | **Block explorer URL** | <https://mantlescan.xyz/> | | {% endtab %} | | {% tab title="Testnet (Sepolia)" %} | Name | Description | | ---------------------- | --------------------------------------------------------------------- | | **Network name** | Mantle Testnet | | **New RPC URL** | [https://rpc.sepolia.mantle.xyz/](< https://rpc.sepolia.mantle.xyz/>) | | **Chain ID** | 5003 | | **Currency symbol** | MNT | | **Block explorer URL** | <https://sepolia.mantlescan.xyz/> | | {% endtab %} | | | {% endtabs %} | | | {% endstep %} | | | {% endstepper %} | | ## Add $MNT to Your Wallet[​](https://docs-v2.mantle.xyz/users/how-to/wallet#add-mnt-to-your-wallet) <a href="#add-mnt-to-your-wallet" id="add-mnt-to-your-wallet"></a> {% stepper %} {% step %} ### Prepare To Import Tokens Navigate to your wallet, switch to the **Sepolia Testnet** and click on the '**Import tokens**' button at the bottom to bring up a form. <img src="https://3885809119-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQliZlRNwHhmzesDU1Ksq%2Fuploads%2FF4rJSqHzv9WZ0FJUUReJ%2Fimage.png?alt=media&amp;token=4602cd23-72ac-4a62-9aef-60f57f5159a4" alt="" data-size="original"> {% endstep %} {% step %} ### Enter the Token Address Enter the `$MNT` token contract address `0x65e37B558F64E2Be5768DB46DF22F93d85741A9E` , and as you do that the other two fields will get populated automatically. <img src="https://docs-v2.mantle.xyz/assets/images/add-custom-token-73776306b75c79729773510acad6d39a.png" alt="" data-size="original"> {% endstep %} {% step %} ### Finish Importing Next, click on the '**Next**' button at the bottom, and then click '**Import**' in the next window to finish. You should be able to see your current balance. {% endstep %} {% endstepper %} ## Configure Your wallet[​](https://docs-v2.mantle.xyz/users/how-to/wallet#configure-your-wallet) <a href="#configure-your-wallet" id="configure-your-wallet"></a> Mantle v2 Tectonic has the ultimate user experience by optimizing the fee mechanism. Users can set up `basefee` and `priorityfee` in MetaMask to greatly reduce the fee for transfers. Here is a detailed guide on how to configure your wallet. {% stepper %} {% step %} ### Create a Transaction When you are ready to send a transaction using MetaMask, construct the transaction first, at which point we can see that the `Estimated fee` before it is set is a higher value. <img src="https://docs-v2.mantle.xyz/assets/images/metamask-5-307e0865a654cff6b32d0e0cbdf1f048.png" alt="" data-size="original"> {% endstep %} {% step %} ### Prepare Your Transaction Configuration Click the `Next` button, and then click the red box to enter the setting interface. <img src="https://docs-v2.mantle.xyz/assets/images/metamask-6-c23111cc33bb16d7b70595aa341f73b7.png" alt="" data-size="original"> {% endstep %} {% step %} ### Configure the Gas Fee Select the `Advanced` button and we can see that we can set the `Max base fee` and `Priority Fee`, see [here](/network/system-information/fee-mechanism/eip-1559-support#application-of-eip-1559-in-mantle-v2-tectonic) for the meaning of these two items. Here we set them to the lowest values, i.e. `Max base fee` is 0.02 gwei and `Priority Fee` is 0. Check the box below "Save these values as my default for the Mantle sepolia network. ", and then click the ❌ button in the upper right corner. <img src="https://docs-v2.mantle.xyz/assets/images/metamask-7-fa653c4a460d25d11d9fca15501c1452.png" alt="" data-size="original"> {% endstep %} {% step %} ### Confirm thr Transaction Once the settings are complete, when you reconstruct the transaction, you will see that the `Estimated fee` will be very low, click `Confirm` to send the transaction. <img src="https://docs-v2.mantle.xyz/assets/images/metamask-8-c9fe29570f11a7151d1c723fb1a90919.png" alt="" data-size="original"> {% endstep %} {% endstepper %} With this setup, you will enjoy extreamely high speed and low cost transaction processing in Mantle v2 Tectonic. # Fetching Test Tokens ## Faucets[​](https://docs-v2.mantle.xyz/users/how-to/faucet#faucets) <a href="#faucets" id="faucets"></a> To begin transacting on Mantle v2 Tectonic Testnet, you must acquire Sepolia `$ETH` and testnet `$MNT` and bridge it across. You can obtain Sepolia `$ETH` from the following faucets: * [Alchemy Faucet](https://sepoliafaucet.com/) **Please get Sepolia `$ETH` at first, the following steps need it to be the gas for the transactions.** You can receive testnet `$MNT` tokens from the [Mantle faucet](https://faucet.sepolia.mantle.xyz/). {% hint style="info" %} Make sure to import the `$MNT` token to your Sepolia wallet to see the current balance. The contract address is `0x65e37B558F64E2Be5768DB46DF22F93d85741A9E`. How to import tokens can be found [here](/network/for-users/how-to-guides/connecting-wallet-to-mantle-network#add-mnt-to-your-wallet). {% endhint %} ## Mint $MNT on Sepolia via Etherscan[​](https://docs-v2.mantle.xyz/users/how-to/faucet#mint-mnt-on-sepolia-via-etherscan) <a href="#mint-mnt-on-sepolia-via-etherscan" id="mint-mnt-on-sepolia-via-etherscan"></a> {% hint style="danger" %} This guide is not available on the Mantle v2 Tectonic Testnet right now. If you want to fetch test tokens, please check our [faucet](https://faucet.sepolia.mantle.xyz/). {% endhint %} {% hint style="info" %} Make sure your wallet has enough Sepolia ETH to perform the mint action before moving forward. {% endhint %} {% stepper %} {% step %} ### Navigate to the Contract First, you'll need to look up the test `$MNT` contract on Etherscan and navigate to the '**Write as Proxy**' section under the '**contract**' tab. You can follow [this link](https://sepolia.etherscan.io/address/0x65e37B558F64E2Be5768DB46DF22F93d85741A9E#writeProxyContract) to get there directly. {% endstep %} {% step %} ### Import MNT Token Next, switch your wallet network to Sepolia, and [import](/network/for-users/how-to-guides/connecting-wallet-to-mantle-network#add-mnt-to-your-wallet) (if you haven't already) the `$MNT` token. {% endstep %} {% step %} ### Connect Your Wallet Now connect your wallet to Etherscan using the '**Connect to Web3**' button. {% endstep %} {% step %} ### Choose the Mint Function Find and click on the `mint()` function in the list on the Etherscan page. It's on no.9. <img src="https://docs-v2.mantle.xyz/assets/images/faucet-4-b426051a807fa7c86c020634b043434f.png" alt="" data-size="original"> {% endstep %} {% step %} ### Enter Your Address and Value Enter the address of your wallet in the `address` field. Click on the '**+**' 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 '**Add**' button. That'll automatically enter 10^18 (1 followed by 18 zeroes) in the amount field. <img src="https://docs-v2.mantle.xyz/assets/images/faucet-2-97cba3a14570abc851f81c0068f6e8a3.png" alt="" data-size="original"> {% endstep %} {% step %} ### Mint 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 o
프로젝트로 돌아가기