Ethereum
Ethereum
Q.1} State the different terms used in Ethereum statistics.
- Best Block is the heaviest block regarding the cummultative difficulty, or in simple words: the highest block number of the longest valid chain.
- Uncles are orphaned blocks, but in oposite to other blockchain systems, uncles are rewarded and included in the blockchain. Shows current bloc's uncle count and uncle count of last 50 blocks.
- Last Block shows the time since the last block was mined, usually in seconds.
- Average Block Time is, well, the average time between two blocks, excluding uncles, in seconds. Should be something around 15 seconds
- Average Network Hashrate is the number of hashes bruteforced by the network miners to find a new block. 5 TH/s means the network power is at five trillion hashes per second.
- Difficulty is the current mining difficulty to find a new block which basicly means how hard it is to find a matching hash.
- Active Nodes is the number of connected nodes to the Ethstats dashboard, (not the whole ethereum network!)
- Gas Price is the price miners accept for gas. While gas is used to calculate fees. 20 gwei is the current default, which stands for 20 Giga-Wei which are twenty billion wei that is 0.00000002 ETH.
- Gas Limit is the block gas limit. It defaults to 1.5 pi million gas (4,712,388) and miner can only include transactions until the gas limit is met (and the block is full). The gas limit is the analogy to bitcoin's block size limit, but not fixed in size.
- Page Latency and Uptime are specific stats for the dashboard.
- Block Time Chart shows the actual time between the last blocks
- Difficulty Chart shows the actual difficulty of the last blocks
- Block Propagation Chart shows how fast blocks are shared among the nodes connected to the dashboard.
- Last Block Miners are the public keys of the miners who found most of the last blocks.
- Uncle Count Chart shows numbers of uncles per 25 blocks per bar.
- Transactions Chart shows numbers of transactions included in last blocks
- Gas Spending Chart shows how much gas was spent on transactions in each block, note the correlation to the transactions chart.
- Gas Limit Chart shows the dynamicly adjusted block gas limit for each block.
Q.2} What is gas? Why and how much gas need to paid?
Gas is the fee you pay to submit transactions to the Ethereum network. Whether you’re
transferring ETH, sending tokens, or interacting with a smart contract, you owe gas in the form
of Ether (ETH), the native currency of the Ethereum network. Think of gas fees as fueling the
network. Gas is a unit of cost for a particular operation a computer needs to execute, and it
executes this instruction when we broadcast a transaction which contains an Ethereum program
in order to run a dapp. For example, summing two numbers costs 3 gas. Multiplying them costs 5
gas. Storing a 256bit word into the blockchain costs 20000 gas, which means storing 1kb of data
costs 640000 gas.
Why
First, let’s dig into what it actually means to submit a transaction to the Ethereum blockchain.
When you submit a transaction, nodes on the network check to see if its valid. And if it is, your
transaction is added to the pending pool of transactions. Then, miners validate and execute your
transaction using their copy of the blockchain.
Validating your transaction, mining the block, and eventually storing the data requires the miner to purchase and maintain hardware. You pay gas to the miner as a form of compensation for
putting in the computational work necessary to complete your transaction. The cost of
transactions also serves as a deterrent against spamming the network with low value or junk
transactions.
How
There are two parts that determine the cost of your transaction: your gas limit and gas price.
Your gas limit is how many units of gas you’re willing to spend on this transaction. And, you’re
gas price is the amount of ETH you’d pay for each unit of gas. In other words: gas price * gas
limit = total cost. GWEI is the unit of ETH typically used to denominate gas prices.
While gas limits are fairly standardized and require little attention, gas prices constantly
fluctuate. As we mentioned before, your gas fees are paid to the miner which mines the block
including your transaction. Only so many transactions fit into each block which means that
miners are incentivized to choose the transactions paying the highest fees. And so, prices will
fluctuate depending on how congested the network is.
Generally, the more gas fees you pay, the faster the transaction will be completed. That being
said, we highly recommend you check the standard gas price at ETH Gas Station before sending
a transaction. Otherwise, your transaction might get stuck for a while.
Q.3} Explain mist.
Mist is a program which connects to Geth in the background, and also serves as an interface for the wallet. The Mist browser is an integral part of the Ethereum network's dApps ecosystem and offers a one-stop shop for running and executing various Ethereum applications and projects. When Geth is running, it synchronizes with the public blockchain by downloading all its data. Mist is just a human-friendly interface for talking to Geth. In other words, Geth is both your node and your wallet, but instead of talking to it through obscure commands (such as web3.fromWei(eth.getBalance(eth.coinbase)) to get an account’s balance), Mist will provide that same information in the UI without you even having to ask for it.
A standard web browser like Chrome, Firefox or Internet Explorer allows users to access websites such as Yahoo, Facebook and Google. A similar comparison can be made to various mobile apps available through Google Play. Similarly, Mist browser also allows users to access decentralized apps available on the Ethereum network. However, the word “browser” doesn't fully capture the Mist browser's capabilities. It doesn't only display existing apps, it is a workbench, a collection of decentralized blockchain tools for the Ethereum network. It is a tool specifically designed for non-technical users who can build, copy, utilize, configure and run any existing or new decentralized apps right from the browser.
Q.4} What are the features of Truffle?
The features that make Truffle Etheruem one of the most widely used IDEs for Ethereum Blockchain are:
- It has built-in support for compiling, deploying and linking Smart Contracts
- It allows for automated contract testing with Mocha and Chai
- The Truffle Console allows you to work with your compiled contracts in a hassle-free manner.
- It has a configurable build pipeline that supports both console apps and web apps
- It comes with built-in support for JavaScript, CoffeeScript, SASS, ES6, and JSX.
- It has generators that help in the creation of new contracts and tests (for example, rails generate).
- It has a script runner that allows you to run JS/Coffee files, including your Smart Contracts
- It allows for the instant rebuilding of assets during the development stage
- It enables contract compilation and deployment using your preferred choice of RPC client
- It supports both network and package management.
Truffle is a “world-class development environment, testing framework, and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier.
Truffle is a development environment, testing framework, and asset pipeline all rolled into one. It is based on Ethereum Blockchain and is designed to facilitate the smooth and seamless development of DApps (Distributed Applications). With Truffle, you can compile and deploy Smart Contracts, inject them into web apps, and also develop front-end for DApps.
different sub-folders
1.Contracts folder
The Contracts folder is one where all your Smart Contracts are stored. In this folder, there’s also a special file known as the Migrations.sol file. Usually, when Truffle compiles your project, it will browse through the Contracts folder to compile all the compatible files
2.Migrations folder
Truffle Migration refers to a script that defines how your Smart Contracts will be deployed to the Ethereum Blockchain. Migrations are essential because as your project keeps becoming more complex, the complexity of your deployments also increases. Thanks to Truffle Migrations, you can automate the process of the deployment of Smart Contracts in a sequential manner. If you look back at the Truffle folder structure, you will see a file called 1_initial_migration.js. This file deploys the Migrations.sol contract to the Ethereum Blockchain.
Migrations allow you to:
· Set the maximum gas limit for deployments
· Modify or change the from the address of deployments.
· Call arbitrary contract functions.
· Deploy libraries
3.Test folder
When it comes to Smart Contracts, testing is a must! Thankfully, Truffle has a built-in testing framework that allows you to write tests in Solidity or JavaScript. If you write your tests in Solidity, you have to import the Smart Contracts into the tests with the Solidity import directive, like so
Q.6} State and explain different modules in web3.js.
web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.
The web3.js library is a collection of modules that contain functionality for the ethereum ecosystem.
- web3-eth is for the ethereum blockchain and smart contracts
- The web3.eth.subscribe function lets you subscribe to specific events in the blockchain.
- The web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain. When you create a new contract object you give it the json interface of the respective smart contract and web3 will auto convert all calls into low level ABI calls over RPC for you.
- The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.
- The web3-eth-personal package allows you to interact with the Ethereum node’s accounts.
- The web3.eth.ens functions let you interact with Ethereum Name Service (ENS).
- The web3.eth.Iban function converts Ethereum addresses from and to (International Bank Account Number) IBAN and (Basic Bank Account Number) BBAN.
- The web3.eth.abi functions let you encode and decode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).
- The web3-net package allows you to interact with an Ethereum node’s network properties
- web3-shh is for the whisper protocol, to communicate p2p and broadcast
- web3-bzz is for the swarm protocol, the decentralized file storage.
- web3-utils contains useful helper functions for Dapp developers
Q.7}State and explain different types of mining.
The Different Types of Mining
- CPU Mining: This is the most basic form of mining. The idea behind CPU mining is simple. Anyone, anywhere can use their computer to mine. While this method is not that applicable anymore, it’s a good entry point.
- GPU Mining: Up next, we have GPU mining. The GPU, or graphics processing unit, is a part of the video rendering system of a computer. The typical function of a GPU is to assist with the rendering of 3D graphics and visual effects so that the CPU doesn’t have to. The GPUs offer a far stronger system for mining than the CPU.
- FPGA Mining: FPGA or Field-Programmable Gate Array Mining is the next step from GPU mining. FPGA “is a device that has a series of gate arrays (obviously) that create truth tables to calculate inputs from a data stream, and output a desired result. In industry you can use this to optimize an industry process, such as cutting 2x4s from a log, provide machine learning or even to perform DNA sequencing. FPGA’s excel at any task that can be done in a parallel process, such as a mining hash to create an output resulting in a successful hash, and if you’re lucky a successful block.”
- · ASIC Mining: ASIC stands for Application-Specific Integrated Circuit and it was created for the specific purpose of mining Bitcoin and Litecoin. The idea of having machinery specifically designed for mining was ahead of its time, so much so that when KNCMiner launched their pre-orders for ASICs they received $25 million in orders in the first 5 hours. Bitcoin and Litecoin is now exclusively mined through ASICs. Bitmain recently released ASICs for Ethereum.
Comments
Post a Comment