我一直遇到标题中指定的。
我开发了一个智能合约并成功编译并部署到网络如下: 1. 运行 testrpc 2. truffle compile 3. truffle migrate
但是,仍然显示上述错误。然后我尝试删除构建文件并按照以下步骤操作: 1. 运行 testrpc 2. truffle compile 3. truffle migrate --network rinkeby
错误仍然显示。
下面是 truffle.js 文件
module.exports = {
migrations_directory: "./migrations",
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
rinkeby: {
host: "localhost", // Connect to geth on the specified
port: 8545,
network_id: "*",
}
Run Code Online (Sandbox Code Playgroud)
} };
如果有人遇到任何类似的问题并已解决,如果您能分享您是如何解决的,我将不胜感激。
提前致谢
为什么使用 Truffle 部署到主网如此困难?
这是尝试部署到主网的概述......
110000000000 wei让我们插上它..
mainnet: {
provider: () =>
new HDWalletProvider({
mnemonic: { phrase: process.env.MNEMONIC },
providerOrUrl: process.env.RPC_URL_1_WSS,
}),
network_id: 1,
from: process.env.DEPLOYERS_ADDRESS,
gasPrice: 110000000000, /* GAS PRICE!! */
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: false, public nets )
},
},
Run Code Online (Sandbox Code Playgroud)
gas参数中设置truffle-config。NODE_ENV=production truffle migrate --network mainnet --dry-run
Summary
=======
> Total deployments: 2
> Final cost: 0.001403824 ETH
Run Code Online (Sandbox Code Playgroud)
0.001403824 ETH 是 2.04 美元。
所以这很可能是错误的。
??失败?? …
我正在使用 truffle@2.1.2 针对 rpc 部署智能合约,使用已在 geth 控制台上localhost:8545 geth@1.5.9-stable解锁的 Ether 资助的帐户。personal.unlockAccount
我还通过 RPC 对远程 Parity 节点进行了相同的尝试,但这是我相当坚持的最新版本。
\n\n松露.js
\n\nmodule.exports = {\n build: {\n "index.html": "index.html",\n "app.js": [\n "javascripts/app.js"\n ],\n "app.css": [\n "stylesheets/app.css"\n ],\n "images/": "images/"\n },\n rpc: {\n host: "localhost",\n port: 8545\n },\n networks: {\n "ropsten": {\n network_id: 3,\n port: 8548, // ssh tunnelled to AWS geth/parity node localhost:8545\n from: "0x4f000Bcf4641E2fDcE85BF26A694b053996850D4"\n },\n "live": {\n network_id: 1,\n port: 8545,\n from: "0x00269400181f1B379784BD8cDF786bb20e91Bdef",\n gas: 4612388,\n gasPrice: 2776297000 // taken …Run Code Online (Sandbox Code Playgroud) 我truffle migrate在 main 上运行。也使用geth。我最初在 truffle.js 中将 Gas Price 和 Gas 留空,但现在看起来像这样:
live: {
network_id: 1,
host: "127.0.0.1",
port: 8545,
from: "3984bc76cb775d7866d1cd55c4f49e3d13d411d4",
gas: 40000,
gasPrice: 22000000000 // Specified in Wei
}
Run Code Online (Sandbox Code Playgroud)
我似乎遇到了一种情况,要么汽油太多,要么汽油不足,不可能获得适量的汽油。
< {
< "jsonrpc": "2.0",
< "id": 2,
< "error": {
< "code": -32000,
< "message": "insufficient funds for gas * price + value"
< }
< }
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value …Run Code Online (Sandbox Code Playgroud) ethereum truffle consensys-truffle go-ethereum cryptocurrency
我正在尝试在我的 mac M1 上安装 Truffle。
我首先按照 Pet Shop 教程中 truffle 网站上的说明操作,成功安装了节点,但随后出现此错误...
sudo npm install -g truffle
...
npm ERR! xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
Run Code Online (Sandbox Code Playgroud)
我做了一些研究,并被指出在自制软件中尝试它。由于我的 M1 芯片,我必须先更新自制程序,我成功地做到了。但我仍然得到看似相同或相似的错误......
/opt/homebrew/bin/brew install truffle
...
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
truffle: The x86_64 architecture …Run Code Online (Sandbox Code Playgroud)