This project is inspired from https://github.com/lfrKain/eth-messaging
- Solidity as the language for the smart contract. Smart contract is based on this EIP.
- Solidity-coverage for checking smart contract coverage and Solium for analizing code style and security issues.
- Truffle and ganache-cli for smart contract testing and deployment.
- Swarm node for storing message data.
- Npm as package and project manager.
- Lite-server as development server.
- Metamask for interacting with DLT from web browser.
- Front-end libraries:
Run npm install
.
Run a local swarm node with docker docker run -p 8500:8500 -e PASSWORD=password123 -t ethdevops/swarm --httpaddr 0.0.0.0
.
Execute npm run dev
. This will start ganache-cli, deploy smart contract wih truffle and deploy and run the application with lite-server on port 3000.
Ganache-cli is started with 4 predefined ethereum private keys you can use to test the dapp:
- Alice ->
9b3b72cc4b29b4e7d0c39962ca3a7db11e1e60a1353e39705d82b36012694caf
- Bob ->
eeb80a1e35c9db4dabd237edb5fd2827312ac2ce32723f163d067169c870eff1
- Frank ->
b5a3091a455b493dab6f53825b92301f2f77ea9bbe2ff4bb5e65486e97126b39
e5a90dceea42ad2ec7360f08185089ba6187f3422d974872cff5219801f8c84b
for sending anonymous messages.
For testing how messages are sent from one account to another, you should import at least 2 of these accounts into Metamask in differenct browser instances.
In Chrome, each instance should have a different profile. For opening Chrome with a different profile than default in linux, execute google-chrome --profile-directory=Temp
.
Also CORS should be enabled to be able to interact with swarm, i suggest to use this chrome plugin.
Execute contract tests:
npm run truffle test
Execute contract tests with coverage:
./node_modules/.bin/solidity-coverage
Execute Solium:
npm run solium