【问题标题】:Invalid account: #0 for network: ropsten - private key too short, expected 32 bytes无效帐户:#0 网络:ropsten - 私钥太短,预期为 32 字节
【发布时间】:2022-06-16 08:33:51
【问题描述】:

error picture

require("@nomiclabs/hardhat-waffle");

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
  const accounts = await hre.ethers.getSigners();

  for (const account of accounts) {
    console.log(account.address);
  }
});

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more

/**
 * @type import('hardhat/config').HardhatUserConfig
 */


const INFURA_PROJECT_ID = "3dxxxx";
const ROPSTEN_PRIVATE_KEY = "e6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

module.exports = {
  networks: {
    ropsten: {
      url: `https://ropsten.infura.io/v3/${INFURA_PROJECT_ID}`,
      accounts: [`0x${ROPSTEN_PRIVATE_KEY}`]
    }
  }
};

我按照网站上的例子将合约部署到ropsten,但是报错。私钥大于 32 位

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: node.js ethereum web3js


【解决方案1】:

这是因为您将“0x”放在您的私钥之前。我有一个类似的错误。此外,您可以根据需要使用炼金术。在您的配置中,其他一切看起来都不错。

【讨论】:

    猜你喜欢
    • 2022-12-18
    • 2023-01-26
    • 2019-03-19
    • 2021-12-29
    • 1970-01-01
    • 1970-01-01
    • 2021-06-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多