I've created a smart contract in solidity which I've compiled with solc into a .bin & a .abi file. However, when I run the generator on the .abi and .bin files it returns a JSONParseException citing an unexpected character. io This is my smart contract:

    pragma solidity ^0.4.9;

    contract Contract {

      address public creator;


      event Log(uint256 id);


      function Contract() {
        creator = msg.sender;
      }

      function kill() {
        selfdestruct(creator);
      }

      function add(uint256 id) {
        Log(id);
    }
   }

Try to use https://remix.ethereum.org/ as IDE. It will tell you exactly where the problem is (curly bracket is missing)

Just tried your contract. It seems correct and I was able to create a wrapper successfully. Here is what I did:

Put a ContractName.sol file wilth you source into d:\tmp> then in that directory executed the following from the command line:

d:\tmp>solc ContractName.sol --bin --abi --optimize -o .

Which generated .abi and .sol files in that same directory. Then:

d:\tmp>web3j solidity generate Contract.bin Contract.abi -o . -p org.your.package.name

Generated me a wrapper under the folloring directoty (according to the package structure provided in command line):

d:\tmp\org\your\package\name\Contract.java

Everything seems fine, you should be able to create yours. I installed colc and web3j tools like described here: solc, web3j

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.