【问题标题】:Etherscan has no support for network sepolia with chain id 11155111Etherscan 不支持链 ID 为 11155111 的网络 sepolia
【发布时间】:2022-11-11 01:30:16
【问题描述】:

我正在尝试从 truffle 验证我部署的合约,并收到“Etherscan 不支持链 ID 为 11155111 的网络 sepolia”错误。所以我正在与 Etherscan 合作,并将我的合同部署在 sepolia 测试网上。

我怎么解决这个问题?

我的松露-config.js


const apikeys = require("./chains/apikeys");
const keys = require("./keys.json");

module.exports = { 
  
  plugins: ["truffle-plugin-verify"],
  api_keys:{
    etherscan: "myApiEtherScan"
  },
  contracts_build_directory: "./public/contracts",
  networks: {
    
     development: {
      host: "127.0.0.1",    
      port: 7545,            
     network_id: "*",     
     },
    sepolia: {
      provider: () => 
      new HDWalletProvider(
        keys.PRIVATE_KEY,
        keys.INFURA_SEPOLIA_URL,       
      ),
      network_id: 11155111,
      gas:5221975,
      gasPrice:20000000000,
      confirmations: 3,
      timeoutBlocks:200,
      skipDryRun: true
    }
  },

  compilers: {
    solc: {
      version: "0.8.16",
      settings: {
        optimizer: {
        enabled: true, // Default: false
        runs: 1000 // Default: 200
        }
        }       
    }
  },

 
};

【问题讨论】:

    标签: solidity smartcontracts api-key truffle etherscan


    【解决方案1】:

    插件 truffle-plugin-verify 不支持 Sepolia 链

    我将 sepolia api url 和 etherscan url 添加到常量中,它可以工作

    const API_URLS = {
    ...
    11155111: 'https://api-sepolia.etherscan.io/api',
    ...
    }
    
    const EXPLORER_URLS = {
    ...
    11155111: 'https://sepolia.etherscan.io/address',
    ...
    }
    

    https://github.com/tafonina/truffle-plugin-verify

    【讨论】:

      猜你喜欢
      • 2022-08-15
      • 2019-08-13
      • 1970-01-01
      • 2011-06-15
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 2020-09-09
      • 2014-07-12
      相关资源
      最近更新 更多