Blockchain Dev Setup
Install Ganache
https://github.com/trufflesuite/ganache-ui/releases/download/v2.5.4/Ganache-2.5.4-win-setup.exe
Install Metamask
https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn/related?hl=en
Install latest Node.js
https://nodejs.org/en/download/
Install Python
https://www.python.org/downloads/
Install Truffle
npm install truffle@5.0.2
Create a project
Check truffle version
truffle version
Create a new truffle project
truffle init
Add package.json file in the root directory of generated project.
Update project, download NPM dependencies
npm install
Update truffle-config.js file.
Create a new .sol file, under contracts folder
pragma solidity ^0.5.0;
contract TodoList{
uint public taskCount = 0;
}
Compile the project
truffle compile
Create a deploy contract JS file, under migrations folder
const TodoList = artifacts.require("TodoList");
module.exports = function(deployer) {
deployer.deploy(TodoList);
};
Note : The file name should start with incremental number.
Deploy the project/contract on locally running blockchain
truffle migrate
Once deployed, the default first account on Ganache interface will show the remaining ETH count
On the console, invoke/call the contract.
todoList = await TodoList.deployed()
Get the address of variable
todoList.address
Access the variables of contract
taskCount = todoList.taskCount()
taskCount.toNumber()
Etherium
Solidity is targeted at the Ethereum Virtual Machine, thereby calling for the attention of learners towards Ethereum. Basically, Ethereum is an open-source, decentralized platform that is based on the blockchain model and helps in execution of smart contracts. In the simplest terms, it is an open software platform that leverages blockchain for helping developers in building and deploying decentralized applications. The Ethereum blockchain is primarily focused on executing code for decentralized applications.
Comments
Post a Comment