eliafengar / ethereum-counter-web3j-sample

Sample Counter Ethereum Smart Contract Web3j API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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