Design and implementation of a blockchain architecture, located on the edge, to provide secure support, reliability, monitoring and malicious behavior control of IoT devices.
To see my bachelor thesis in my university official repository click here.
I strongly advise to read the disclaimer section before reading/using the code.
- The smart contract language utilized was Solidity with Solc as Solidity compiler.
- The IoT client was developed using [Java 11] (https://docs.oracle.com/en/java/javase/11/).
- The Ethereum-Java interface used on the project was web3j.
- Truffle was used as a contract migration tool and as a directory manager too.
- Ganache was used as a testing blockchain network for the developing phase.
- The final Blockchain network was created using GoEthereum.
- Solidity Remix was used too in the Smart Contract development.
- Maven was used as a depencency management tool.
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
sudo apt install openjdk-11-jre-headless
You can find the version of web3j I used in my github repository but you can find the newest one in the official Web3j repository. Remember to give the web3j executable file execution permissions. You can find that file in web3j-4.1.1/bin/web3j
sudo chmod 750 web3j
To install Geth I would advise to follow this link. Chances are that It is much more updated than the method I used in 2019.
In order to use a Smart Contract inside a Java class we need to create a Java Wrapper class from the .sol file first. To do so (Let's assume that our contract is called HelloWorld.sol) we need to:
- Create the .bin and .abi files from the .sol using the solidity compiler (solc):
solc contracts/HelloWorld.sol --bin --abi --optimize -o contracts/
- Use the previously mentioned web3j file (remember to give it executable permissions) to create the .java file from the .bin and .abi files:
~/<path>/web3j-4.1.1/bin/web3j solidity generate -b contracts/HelloWorld.bin -a contracts/HelloWorld.abi -o contracts/ -p com.edge.chain
- Currently the documentation is only in Spanish; an English version will be uploaded as soon as I finish one.
- Solidity is a young and rapidly changing technology so there are high chances of finding obsolete methods in my code.