blockchain - 迁移耗尽气体
问题描述
我正在使用甘纳许。我有开箱的宠物店。然后在contracts文件夹中,我创建了一个包含Election.sol
代码的文件,
pragma solidity ^0.5.8;
contract Election{
string public candidate;
constructor() public{
candidate = "candidate 1"; //state var
}
}
然后在迁移文件夹中,我制作2_deploy_contract.js
了代码
var Election = artifacts.require("./Election.sol");
module.exports = function(deployer) {
deployer.deploy(Election );
};
当我使用命令进行松露迁移时-truffle migrate
,我收到此错误。
Compiling your contracts...
Everything is up to date, there is nothing to compile.
Migrations dry-run (simulation)
Network name: 'development-fork' Network id: 1 Block gas limit: 0x1388
1_initial_migration.js
Deploying 'Migrations'
Error: Error: Error: * Deployment Failed *
"Migrations" ran out of gas (using Truffle's estimate.) * Block limit: 0x50e7c * Gas sent: undefined * Try: + Setting a higher gas estimate multiplier for this contract + Using the solc optimizer settings in 'truffle-config.js' + Making your contract smaller + Making your contract constructor more efficient + Setting a higher network block limit if you are on a private network or test client (like ganache).
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
我已经看到一些解决方案发布到与此类似的问题,但它无法解决我的问题。
解决方案
推荐阅读
- c# - 哪个流程与 Identity Server 4 for Nativescript 应用程序一起使用,它是如何保护的?
- java - BufferedWriter 类型中的 write(int) 方法不适用于参数 (List)"
- python - 找不到加密模块(python3.7)
- python - 根据特征工具中的截止时间创建特征
- android - 约束布局文本视图未显示
- javascript - 为什么计算字段不显示在发送电子邮件的表单中?
- ios - 造型
- javascript - 如何在表格中实现 JavaScript 搜索过滤功能
- java - 使用 jenkins 插件检查 java 编码样式
- postgresql - QSqlQuery Postgres 多选