【问题标题】:Error: Method eth_compileSolidity not supported错误:不支持方法 eth_compileSolidity
【发布时间】:2017-07-25 08:01:19
【问题描述】:

环境: 测试-RPC 松露

代码: let source = "pragma solidity ^0.4.11;contract Calc{ uint count; function add(uint a, uint b) 返回(uint){ count++; return a + b; } function getCount() 返回 (uint){ return count ; }}";

让 calc = web3.eth.compile.solidity(source);

终端告诉我: 松露(开发)> 错误:错误:不支持方法 eth_compileSolidity。 在 GethApiDouble.handleRequest (/Users/user/.nvm/versions/node/v6.10.3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:101870:16) ......

【问题讨论】:

  • 我不确定它是否已被弃用.. 请查看下面的链接 github.com/ethereum/EIPs/issues/209 。如果你想获得合约的 ABI / 二进制文件,你可以使用 remix。

标签: ethereum smartcontracts


【解决方案1】:

我猜你想获取你的合约的 ABI 和/或字节码。 Web3 库(您在 truffle 控制台中需要,然后实例化 web3 提供程序)自 1.6.0 版以来没有 web3.eth.compile.solidity()

这里描述了使用 Remix 和 solc 编译器的编译方式:https://ethereum.stackexchange.com/questions/15435/how-to-compile-solidity-contracts-with-geth-v1-6

当 truffle 编译您的代码时,它会使用一些固定版本的 solc(取决于 truffle 版本)。对于 truffle 3.2.5 solc 0.4.11+commit.68ef5810.Emscripten.clang 使用。以下是获取当前版本 truffle's solc 的方法(必须知道您何时在 Etherscan 上 verifying code):https://ethereum.stackexchange.com/questions/18133/how-do-i-find-the-exact-solidity-compiler-version-used-by-truffle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-12
    • 2021-06-17
    • 2020-05-15
    • 2021-12-23
    相关资源
    最近更新 更多