- Bloc is a to-do application that runs on your local ethereum blockchain.
- Bloc uses smart-contracts and web3 js to talk to your local ethereum blockchain.
- Bootstrap 4.5.2
- Jquery 3.5.1
- Web3 1.2.11
- Solidity ^0.5.1
- Ganache 2.4.0.1317
- Download Ganache for local ethereum blockchain.
- Click on Quickstart Ethereum and after that note the address labeled under RPC Server
(should be something like this http://127.0.0.1:7545) and make sure to copy the same
address in
js/getAccount.js
file line 1.
- Click on Quickstart Ethereum and after that note the address labeled under RPC Server
(should be something like this http://127.0.0.1:7545) and make sure to copy the same
address in
- Go to Remix IDE click on the plus icon in the file explorers
located in the left panel and name the file as bloc.sol (Make sure to sure http site not https).
- Copy the code present in bloc.sol from this repo.
- Go to solidity compiler located in the left panel and click on compile bloc.sol.
down you'll find a button with copy icon and text as ABI click on it.Paste it in
js/config.js
line 1
let contractABI =
COPIED TEXT
;
The copied text will be enclosed in []. - Go to deploy and run transaction under environment select Web3 Provider.
- If you get the message
Not possible to connect to the Web3 provider. Make sure the provider is running, a connection is open (via IPC or RPC) or that the provider plugin is properly configured.
this is due to CORS policy in browsers. - The solution for chrome browser is go to
chrome://flags/#block-insecure-private-network-requests
and select disabled. Relaunch the browser. Disabling that flag does mean you're re-opening the security hole that Chrome's new behavior is meant to close.You can read more here. - Enter the address you copied from Ganache and paste it click on OK.
- Now a deploy button will be visible click on it.
- Down you'll find Deployed Contracts label now there will a copy icon button click on it
and paste injs/config.js
line 2let contractAddress =
'COPIED text'
;
The copied text might look like this 0xF3017acEDd45526aC6153FBBCfcA8096173D245a.
- Download VSCode for live server extension (any other server will also work)
- Go to Extensions on the left panel search for live server and install it.
- Open the folder containing this repo and down in the blue status bar and click on Go live.
- I subconsciously tend to write complex solution to simple problem so if you found a simpler way to a particular thing you can reach out to me on twitter and let me know.
- I would like to thank Ankit Gupta @ankitecd for reviewing the
js/app.js
file.
Bloc App is licensed under MIT LICENSE.