0

I'm able to make transactions in Ethereum using Java and Web3j.

Now I would like to be able to interact with a smart contract. But since I'm having problems building the wrapper, I would like to know if I can do it by sending data in the transaction. And if so, how is it done?

TylerH
  • 20,799
  • 66
  • 75
  • 101
killezio
  • 308
  • 1
  • 12

1 Answers1

0

Try these command to build the wrapper:

solc YourSmartContract.sol --bin --abi --optimize -o ./

web3j solidity generate YourSmartContract.bin YourSmartContract.abi -o /path/to/yourSrc/main/java -p your.application.id

Then it will generate a Java file, and you can call the methods from it to interact with your smart contract.

Alex Bean
  • 493
  • 7
  • 19
  • Thanks for the suggestion. That's what i used and the Java file generated had some errors so i can't use it – killezio Aug 09 '18 at 14:18
  • yes, it happens to me as well. I don't know exactly why is this problem, probably because we are using different versions and then the file is generated with syntax errors. Just fix manually this syntax errors and it will work. – Alex Bean Aug 09 '18 at 14:24