Storing and reading document hashes on the Ethereum blockchain from Java.
This project demonstrate document hash storing on the Ethereum blockchain from Java.
This is a Java Spring Boot application with a ZK frontend, that use an embedded H2 database for demonstration purpose.
To run this project in a local environment, you need :
- A local Ethereum blockchain running on
localhost
on port7545
- A
Diploma
smart contract deployed to handle document hash read and write
See the eth-hash-chain project for setting up a local blockchain with all the required capabilities.
- Clone the repository :
git clone https://github.com/Yann39/eth-hash-app
- Replace
application.account-address
andapplication.contract-address
values in application.properties to match your account and smart contract addresses according to your running blockchain - Build the JAR file using Maven :
mvn package
- Start your local blockchain (Ganache)
- Execute application from Intellij or run the JAR file, with the right profile :
java -Dspring.profiles.active=local -jar /target/eth-hash-app.jar
- Reach http://localhost:8080/
Simply reach the application home page at http://localhost:8080/ to display the home page.
Navigate to the Documents menu, or direct access : http://localhost:8080/diplomas
Connect to the Ethereum network (you should see a "connected" message) :
Then simply add documents and try to save hashes to the Ethereum blockchain.
You can then view documents :
General Public License (GPL) v3
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.