Ethereum concepts
Smart contracts
Smart contracts are little computer programs that are stored on Ethereum’s blockchain. They can be activated, or run, by funding them with some ETH. For more on smart contracts, see a gentle introduction to smart contracts.
Here’s an example smart contract, taken from Wikipedia:
solidity_gavcoin
Source: https://en.wikipedia.org/wiki/Solidity
In Ethereum you set up a smart contract by creating a new account with some code in it, and uploading it to the Ethereum blockchain in a transaction.
Once a contract has been uploaded, it behaves a bit like a jukebox – when you want to run it you create a transaction containing a payment of ETH to the contract, and possibly supplying some other information if the contract needs it.
Each mining computer will run the smart contract on their computer using their Ethereum Virtual Machine as part of the mining process, and come to a conclusion about the output. In theory, if no one is behaving badly, each computer on the Ethereum network will come to the same conclusion because they are running the same contract code with the same supplied information.
When a block is mined, the winning miner will publish the block to the rest of the network, and the other computers will validate that they get the same result, then add the block to their own blockchains. This is how the state of Ethereum’s blockchain gets updated.
Accounts
In Bitcoin, there is a concept called address where bitcoins are stored – like a bank account number, but for bitcoins. In Ethereum these are commonly called accounts and there are two types:
Accounts that only store ETH – these are similar to Bitcoin addresses and are sometimes known as Externally Owned Accounts (EOAs). You make payments from these accounts by signing transactions with the appropriate private key.
Here’s an example of an account that stores ETH:
https://etherscan.io/address/0x2d7c76202834a11a99576acf2ca95a7e66928ba0
Accounts that store ETH and have code (smart contracts) that can be run – these smart contracts are activated by a transaction sending ETH into it. Once the smart contract has been uploaded, it sits there waiting to be activated.
Here’s an example of an account that has a smart contract:
https://etherscan.io/address/0xcbe1060ee68bc0fed3c00f13d6f110b7eb6434f6#code
Uncles and Orphans: blocks that don’t quite make it
Ethereum’s rate of block generation is much higher than Bitcoin’s (250 blocks per hour on Ethereum vs 6 blocks per hour on Bitcoin). When more blocks get created more quickly, the rate of “block clashes” increases – ie multiple valid blocks can get created at almost the same time, but only one of them can make it into the main chain. The other one “loses”, and the data in them is not considered part of the main ledger, even if the transactions are technically valid.
In Bitcoin these non-mainchain blocks are called orphans or orphaned blocks and they do not form part of the main chain in any way and are never referenced again by any subsequent blocks.
In Ethereum they are called uncles. Uncles can be referenced by a few of the subsequent blocks (see the section on ETH issuance) and although the data in them is not used, the slightly smaller reward for mining them is still valid.
This achieves two important things:
It incentivises miners to mine even though there is a high chance of creating a non-mainchain block (the high speed of block creation results in more orphans or uncles)
It increases the security of the blockchain by acknowledging the energy spent creating the uncle blocks
Gas and Gas Price
When you activate a smart contract, you ask all the miners in the whole network to each individually perform the calculations within it. This costs them time and energy, and Gas is the mechanism by which you pay them for that service.
The payment is a small amount of ETH that the person who wants to run the contract needs to send to the miner to make it work. This is similar to putting a coin in a jukebox.
Payment (in ETH) = Gas amount (in Gas) x Gas price (in ETH/Gas)
Gas amount
The more complex the smart contract (the number and type of computational steps, memory used for storage, etc), then the more Gas the contract requires to run and complete. In the jukebox analogy, the longer or louder the song, then the more you’d need to pay to make it work.
Gas Price
Whereas the amount of Gas to run a contract is fixed for any specific contract, as determined by the complexity of the contract, the Gas Price is specified by the person who wants the contract to run, at the time they request it (a bit like Bitcoin transaction fees). Each miner will look at how generous the gas price is, and will determine whether they want to run the contract as part of the block. If you want miners to run your contract, you offer a high Gas Price. In this way it’s a competitive auction driven by how much someone is willing to pay to have a contract run.
Why Gas?
Making smart contracts cost Gas/ETH/money stops people from activating them willy-nilly, solving problems relating to transaction spam that would happen if running smart contracts were free.
ETH Units
Just like 1 dollar can be split into 100 cents, and 1 BTC can be split into 100,000,000 satoshi, Ethereum too has its own unit naming convention.
The smallest unit is a wei and there are 1,000,000,000,000,000,000 of them per ETH. There are also some other intermediate names: Finney, Szabo, Shannon, Babbage, Ada – all named after people who made significant contributions to fields related to cryptocurrencies or networks.
Wei and Ether are the two most common denominations.
ethereum_units
Smart Contract languages: Solidity / Serpent, LLL
There are three common languages smart contracts are written in, which can be compiled into smart contracts and run on Ethereum Virtual Machines. They are:
Solidity – similar to the language Javascript. This is currently the most popular and functional smart contract scripting language.
Serpent – similar to the language Python, and was popular in the early history of Ethereum.
LLL (Lisp Like Language) – similar to Lisp and was only really used in the very early days. It is probably the hardest to write in.
Ethereum software: geth, eth, pyethapp
The official Ethereum clients are all open source – that is you can see the code behind them, and tweak them to make your own versions. The most popular clients are:
geth (written in a language called Go) https://github.com/ethereum/go-ethereum
eth (written in C++) https://github.com/ethereum/*****p-ethereum
pyethapp (written in Python) https://github.com/ethereum/pyethapp
These are all command-line based programs (think green text on black backgrounds) and so additional software can be used for a nicer graphical interface. Currently the official and most popular graphical one is Mist (https://github.com/ethereum/mist), which runs on top of geth or eth.
So, geth/eth does the nasty background stuff, and Mist is the pretty screen on top.
bitcoin минфин робот bitcoin bitcoin land использование bitcoin криптовалют ethereum криптовалюты bitcoin bitcoin metatrader