Ethereum 错误:不支持方法eth\u compileSolidity

Ethereum 错误:不支持方法eth\u compileSolidity,ethereum,smartcontracts,Ethereum,Smartcontracts,环境: 测试rpc 松露 代码: let source=“pragma solidity ^0.4.11;契约计算{uint count;函数add(uint a,uint b)返回(uint){count++;返回a+b;}函数getCount()返回(uint){return count;}” 让calc=web3.eth.compile.solidity(源代码) 航站楼告诉我: 块菌(开发)>错误:错误:不支持方法eth_compileSolidity。 在GethApiDouble.h

环境: 测试rpc 松露

代码: let source=“pragma solidity ^0.4.11;契约计算{uint count;函数add(uint a,uint b)返回(uint){count++;返回a+b;}函数getCount()返回(uint){return count;}”

让calc=web3.eth.compile.solidity(源代码)

航站楼告诉我: 块菌(开发)>错误:错误:不支持方法eth_compileSolidity。 在GethApiDouble.handleRequest(/Users/user/.nvm/versions/node/v6.10.3/lib/node\u modules/ethereumjs testrpc/build/cli.node.js:101870:16)
……我猜您是想获取合同的ABI和/或字节码。 Web3库(您需要在truffle控制台中使用它,然后实例化Web3提供程序)自版本1.6.0以来没有Web3.eth.compile.solidity()

这里介绍了使用Remix和solc编译器的编译方法:


当truffle编译代码时,它使用一些固定版本的solc(取决于truffle版本)。对于块菌3.2.5,使用solc 0.4.11+commit.68ef5810.Emscripten.clang。以下是获取当前版本的truffle的solc的方法(有必要知道您何时使用Etherscan):

我不确定它是否已被弃用。。请检查下面的链接。如果您想获得合同的ABI/二进制文件,可以使用remix。