Working with Web3j

Web3j is a Java client library that can connect to an Ethereum node. Similar to Web3 JavaScript, it can be used to interact with a smart contract on the Ethereum node. It can generate a Java smart contract from Solidity contract files.

First, let's set up the Web3j environment, as shown in the following steps:

  1. Install the Solidity compiler, solc, and run the following command to install it:
npm install -g solc
  1. Install web3j using the run brew command (at the time of writing, we used web3j-4.2.0)
brew tap web3j/web3jbrew install web3j

Once solc and web3j have been installed, you will see the following screen:

We use ...

Get Learn Ethereum now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.