Posts

EDUCoin - ERC20 Tocken by Dr B P Sharma

pragma solidity >=0.4.22 <0.7.0; abstract contract ERC20Interface {    function totalSupply() virtual public view returns (uint);     function balanceOf(address tokenOwner) virtual public view returns (uint balance);   function allowance (address tokenOwner, address spender) virtual public view returns (uint remaining);     function transfer(address to, uint tokens) virtual public returns (bool success);   function approve(address spender, uint tokens) virtual public returns (bool success);     function transferFrom (address from, address to, uint tokens) virtual public returns (bool success);     event Transfer(address indexed from, address indexed to, uint tokens);     event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract EDUCoin is ERC20Interface {     string public name;     string public symbol;     uint8 publi...

Sample Solidity Smart Constract Code for University Certificates

pragma solidity >=0.4.22 <0.7.0; contract UniversityCertificate{     //Smart Contract to manage the university degrees     uint256 public year;     string public course;     address public owner;     string public universityId;     string public universityName;             struct Certificate{         string data;         bool isValid;         string enrollmentId;     }         event response(address from, string msg, string methodName);     bytes32[] public allCertificates;     mapping(bytes32=>Certificate) public certificateById;         modifier onlyOwner{         require(msg.sender == owner);         _;     }         //"B.Tech.",2017,"123456","AKTU"     ...

Using Node Version Manager (NVM)

Install the node version manager in your machine then issue the following commands to install different version of node in your machine nvm install 8.9.0 nvm install 12.13.0 Now define the current version of node to be used nvm use <version> Example nvm use 8.9.0

How to install Ethereum Blockchain Tools on UBuntu

Ganache https://www.trufflesuite.com/ganache Installing NodeJS -- Goto Terminal (Ctrl+Alt+T) Issue the following commands sudo apt update sudo apt install nodejs sudo apt install npm nodejs -v Installing Ganache -- Download the software -- Goto to Downloads folder on the Terminal Issue the following command sudo chmod 777 ganache-1.3.0-x86_64.AppImage sudo ./ganache-1.3.0-x86_64.AppImage Installing Anaconda on Ubuntu -- Download the software -- Goto Downloads folder Issue the following command sudo chmod 777 Anaconda3-2019.07-Linux-x86_64.sh sudo ./Anaconda3-2019.07-Linux-x86_64.sh

How to setup Hyperledger Fabric Host?

sudo apt-get update sudo apt install curl sudo apt-get -y install docker-compose sudo usermod -aG docker $USER docker -v docker-compose -v wget https://golang.org/dl/go1.11.11.linux-amd64.tar.gz sudo tar -xvf go1.11.11.linux-amd64.tar.gz export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin add the path to .bashrc file export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin curl -sL https://deb.nodesource.com/setup_8.x | sudo bash - sudo apt install nodejs curl -sSL http://bit.ly/2ysbOFE | bash -s 1.4.1 cd fabric-samples/first-network ./byfn.sh up ./byfn.sh down References https://medium.com/@kctheservant/setup-a-hyperledger-fabric-host-and-create-a-machine-image-682859fd58ba https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

How to get the information of latest block in Ethereum Blockchain?

Attach with the ethereum node using following command geth attach Now issue the following command eth.getBlock('latest')

Why to create a full node?

Here are some of the benefits to have your own ethereum full node You’re solo mining or running a mining pool, if this is the case then you need a node in order to talk to the network. You want to make sure your transactions to the network yourself. Remote nodes are generally reliable but are controlled by 3rd parties and typically throttle heavy usage. You want to help secure the network; the more independent nodes running the more copies there are of the blockchain and the more resilient it is. You want to make the network faster and secure; the more nodes the lower the latency in sharing blocks and the more copies of the blockchain that exist.