Hello Ethereum
It is the simplest implementation of Smart Contract to get a quick hands-on with the intricacies of ethereum development.
- Build and interact with a smart contract
- Test the smart contract
- Visualise everything using Ganache
How to begin?
- Install truffle
$> npm install -g truffle - Download ganache from (https://truffleframework.com/ganache)
- Run
Ganache - Clone this repo
$> git clone https://github.com/shubhamoy/HelloEthereum $> truffle migrate --network ganache- After completion of the above command, switch to
Ganacheand it should show the contract creation and contract calls.
Interact with the Smart Contract
- Open Truffle Console and connect it to
Ganache$> truffle console --network ganache - Create instance of the smart contract
truffle(ganache)> Election.deployed().then((instance) => { app=instance }) - Get the vote count
truffle(ganache)> app.count() - Call the upvote method
truffle(ganache)> app.upvote({from: web3.eth.accounts[1]}) - Call the upvote method
truffle(ganache)> app.upvote({from: web3.eth.accounts[2]}) - Finally, check the vote count value
truffle(ganache)> app.count()
Testing the Smart Contract
- Test Cases
./test/Election_Test.js - Test the contract
$>truffle test --network ganache
Troubleshoot
- If you are unable to connect to Ganache, then after running Ganache check for the host and port. In case, it isn't running on
http://localhost:7545then update thetruffle.jsfile with the new host and port details. - For any other problem, please raise an issue.
Contact
me[at]shubhamoy[dot]com

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
