Skip to content

eliafengar/ethereum-counter-web3j-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ethereum-counter-web3j-sample

Sample Counter Ethereum Smart Contract Web3j API

Purpose and Motivation

The purpose of this project is to enable a Java server side REST API to interact with Ethereum Transaction node.
The project demonstrates a Counter Smart Contract which has the following methods: increment, decrement and counts.
The REST API exposes the above Smart Contract methods and also the following methods: deployContract and loadContract.

Build

Update the Wallet Private Key in CounterHandler.java class
In Case of Existing Smart Contract - Update the Contract Address in CounterHandler.java class


mvn clean
mvn package - this will start the embedded Apache Tomcat server.


Deploy Contract using: http://localhost:8080/network/deployContract
Load Existing Contract using: http://localhost:8080/network/loadContract


Interact with the Ethereum Smart Contract using:
http://localhost:8080/counter/increment
http://localhost:8080/counter/decrement
http://localhost:8080/counter/counts