What is the compatibility between solidity and web3j. I don't find any resource about it. Suppose if I generate my java wrapper class of smart contract written in Solidity ^0.4.17 version and taking the help of web3j of version ^3.4.0 for wrapper class generation. Will it work perfectly?

1 Answer 1


Web3j doesn't directly depend from Solidity language but use the standard Application Binary Interface (ABI) and EVM Binary code (machine readable) to generate the Smart Contract Java wrapper.

That's why, you first have to compile your solidty code using solc

$ solc <contract>.sol --bin --abi --optimize -o <output-dir>/

The compatibility between Solidity version is handled by solc. If you try to compile a solidity 0.4.18 file with a very old solc, it will fail.

Then you can finally generate your Smart contract Java Wrapper using web3j which takes the ABI and Binary code as input

web3j solidity generate [--javaTypes|--solidityTypes] /path/to/<smart-contract>.bin /path/to/<smart-contract>.abi -o /path/to/src/main/java -p com.your.organisation.name

So Web3j Smart Contract Java Wrapper doesn't depends on Solidity directly but depends on the universal EVM language. That way, you could write the smart contract in another language (viper for instance) and it will still work like a charm (language abstraction).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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