Skip to content

web3j example to get the latest block on Ethereum/Quorum node deployed with Chainstack

Notifications You must be signed in to change notification settings

chainstacklabs/web3j-getLatestBlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

web3j example to get the latest block on Ethereum or Quorum

An example web3j application to interact with your Ethereum or Quorum node deployed with Chainstack.

Running the application will:

  1. Connect to your Ethereum node or Quorum node with basic authentication.
  2. Run the function ethGetBlockByNumber.
  3. Print the latest block number.

Requirements

  1. Java 1.8+
  2. Maven

Steps

  1. In src/main/java/getLatestBlock/App.java, repace RPC_USERNAME, RPC_PASSWORD, and RPC_ENDPOINT with your access and credentials.
  2. In the root directory, run mvn package. This will build the app in the target directory.
  3. Change to the target directory and run java -jar web3j-getLatestBlock-1-jar-with-dependencies.jar.

About

web3j example to get the latest block on Ethereum/Quorum node deployed with Chainstack

Topics

Resources

Stars

Watchers

Forks

Languages