它的端点在这里,地址在 .env 文件中也是正确的
这是我的松露 configjs,我在 infura 上创建了帐户并添加了
松露 config.js
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*",
},
kovan: {
provider: function (){
return new HDWalletProvider(
//private key
privateKeys.split(','),
`https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`
//url to an ethereum node
)
},
gas: 5000000,
gasPrice: 50,
network_id: 42,
}
},
contracts_build_directory: './src/abis',
contracts_directory: './src/contracts',
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: "0.5.0", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: true,
runs: 200
},
// evmVersion: "byzantium"
// }
},
},
};
终端
编译你的合同...
一切都是最新的,没有什么要编译的。
迁移试运行(模拟)
网络名称:'kovan-fork' 网络 ID:42 区块气体限制:30000000 (0x1c9c380)
1_initial_migration.js
部署“迁移”
块编号:28637313块Timestamp:1638707525帐户:0x35D7114937EFAFD489D0229E06A5A13777777779余额:0.0400000000000000000000000000000000000000007362518使用:149175(149175)QUERTY:149175 000000 000000000000000000000000000000000000000000000000000000000000000000000000000000个
总成本:0.00000000000745875 ETH
2_deploy_contracts.js
部署“令牌”
块编号:28637315块Timestamp:1638707557帐户:0x35D7114937EFAFD489D0229E06A5A1377EF84D89余额:0.0400000000000000000000000000000000000000000000000000000018 QUALS使用:725937 gas:725937 ges:725937 gesir:72593 gwwei 000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Y000000000000来
部署“交换”
块编号:28637316块Timestamp:1638707584帐户:0x35D711493714937EFAFD489D0229E06A5A13777777F84D89余额:0.0400000000000000000000000000008668 QUALS AS GAS使用:1705799(1705799)(0x1A000000000000000000000000000000000000000000000000000000000个)
总成本:0.0000000001215868 ETH
概括
总部署:3 最终成本:0.00000000012904555 ETH
开始迁移...
网络名称:'kovan' 网络 ID:42 区块气体限制:30000000 (0x1c9c380)
initial_migration.js
部署“迁移”
交易哈希:0x3c182c3af2b617cd00ee42e7079562a53b8b39dec3d9a0ba1395c05f4e8e47ca
错误:*** 部署失败 ***
“迁移”——交易在 750 秒内没有被挖掘,请确保您的交易已正确发送。请注意,它可能仍被开采!
at /home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Migration._deploy (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:70:1)
at Migration._load (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:56:1)
at Migration.run (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
at Object.runMigrations (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.run (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
at runMigrations (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
at Object.run (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:221:1)
at Command.run (/home/dhruv/.nvm/versions/node/v16.2.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:183:1)
Truffle v5.4.22(核心:5.4.22)节点 v16.2.0
我在尝试部署我的智能合约时遇到这些错误,我在我的种子中使用了两个账户,一个账户有 0.02 以太币,另一个账户有 0.01 以太币,这个错误是由于更少的以太币还是其他错误,有开发应用程序在我的 ganache 上运行良好,没有错误,非常感谢任何帮助