Skip to content

pram/spring-eth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-Eth

Sample project to illustrate connecting Java to Ethereum

Installation

First install Ganache

npm install -g ganache-cli

Run ganache-cli. The account information should display and the connection details should be displayed.

Or install Ganache

http:https://truffleframework.com/ganache/

Default connection is http:https://localhost:8545

Now add web3j as a dependency

<dependency>
    <groupId>org.web3j</groupId>
    <artifactId>web3j-spring-boot-starter</artifactId>
    <version>1.5.0</version>
</dependency>

Running the application and navigating to clientversion should now display client version details

Solidity

Go to remix. Paste the following into the editor.

Follow the guide for more details on how to deploy a smart contract.

Navigate to

src/main/solidity

and run the following command

solcjs counter.sol --bin --abi --optimize -o target/

You should now have two files in the target directory - counter_sol_Counter.abi and counter_sol_Counter.bin

After having installed web3j command line tools

Then run the wrapper generation command

web3j solidity generate /path/to/counter_sol_Counter.bin /path/to/counter_sol_Counter.abi -o /path/to/src/main/java -p com.naughtyzombie.eth.springeth.wrapper

About

Example Ethereum Spring example app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published