Skip to content
Snippets Groups Projects
Name Last commit Last update
sample-project-gradle-master
README.md

MSc Project

  • Marinos Iliadis
  • University of Southampton 2017-2018
  • MSc Data Science

Project Title

Maintaining Privacy in Database and Data exchange using Blockchain Mechanisms and Smart Contract

How to import the project into Eclipse

  • Open Eclipse -> Go to File -> Open Project From File System -> Show other specialised import wizard-> Gradle -> Existing Gradle -> sample-project-gradle-master
  • Import this project to Eclipse (I use Eclipse Oxygen 3A) as an existing Gradle project.
  • Our eclipse project uses the web3j library. Java library to interact with Ethereum blockchain and solidity smart contracts
  • Run the "Application.java"

Functionality

This decentralised application shows an Access control mechanism in order to increase the privacy in data exchange using smart contract and blockchain technology

  • Communicate and Interact from Java dapp
  • Connecting to nodes on the Ethereum network
  • Load our Ethereum wallet file
  • Send Wei(ether) from our address to another address (based functionality).
  • Deploy our smart contract to the blockchain netwrok
  • Creating Access Control List for authorised user (add, delete users) using their Ethereum adresses
  • Validate user using the ACL (isUser)
  • Insert, get, update, delete, count users in the data storage of our smart contract
  • Updating a value in our smart contract
  • Viewing events logged in the smart contract

Ethereum wallet

OR

Manage account

OR

Request some Ether from Faucet

  • Import the wallet file into the MetaMask account.
  • Change from Main Netwotk to Ropsten Network and click the Buy button.
  • Then, click Ropsten test Faucet.
  • Request Ether several times.
  • Ether are required for the deployment and the interaction with the functions of our smart contract

Smart contracts

  • There are several smart contracts in this dapp, the most updated one is the "Acladv.java".
  • You can find all smart contracts of my project in the folder src/main/resources insolidity type (.sol)
  • You can test them in https://remix.ethereum.org/ as well

Infura

Testnet

In this prototype java dapp we deploy our contract on the Ropsten Test Network

Solidity compiler and Java wrappers

A. Compiling Solidity source code - 1. npm install -g solc - 2. solc or solcjs .sol --bin --abi --optimize -o /

B. Auto generated Java wrapper for solidity smart contract - Need first to save your solidity code into a Notepad++ file with extention .sol

C. Solidity smart contract wrappers - 3. web3j solidity generate [--javaTypes|--solidityTypes] /path/to/.bin /path/to/.abi -o /path/to/src/main/java -p com.your.organisation.name

Viewing logs on blockchain

  • Logback configuration is provided in the project dependencies giving the opportunity to logging of protocol messages.
  • To enable this need to change the following line in the logback config:
<logger name="org.web3j.protocol" level="DEBUG"/>

Extra Dependencies for the project (check build.grandle)

  • Assert java 3.10.0
  • Javatuples 1.2
  • JUnit 4.12 for testing