Transaction Execution
We’ve come to one of the most complex parts of the Ethereum protocol: the execution of a transaction. Say you send a transaction off into the Ethereum network to be processed. What happens to transition the state of Ethereum to include your transaction?
Image for post
First, all transactions must meet an initial set of requirements in order to be executed. These include:
The transaction must be a properly formatted RLP. “RLP” stands for “Recursive Length Prefix” and is a data format used to encode nested arrays of binary data. RLP is the format Ethereum uses to serialize objects.
Valid transaction signature.
Valid transaction nonce. Recall that the nonce of an account is the count of transactions sent from that account. To be valid, a transaction nonce must be equal to the sender account’s nonce.
The transaction’s gas limit must be equal to or greater than the intrinsic gas used by the transaction. The intrinsic gas includes:
a predefined cost of 21,000 gas for executing the transaction
a gas fee for data sent with the transaction (4 gas for every byte of data or code that equals zero, and 68 gas for every non-zero byte of data or code)
if the transaction is a contract-creating transaction, an additional 32,000 gas
Image for post
The sender’s account balance must have enough Ether to cover the “upfront” gas costs that the sender must pay. The calculation for the upfront gas cost is simple: First, the transaction’s gas limit is multiplied by the transaction’s gas price to determine the maximum gas cost. Then, this maximum cost is added to the total value being transferred from the sender to the recipient.
Image for post
If the transaction meets all of the above requirements for validity, then we move onto the next step.
First, we deduct the upfront cost of execution from the sender’s balance, and increase the nonce of the sender’s account by 1 to account for the current transaction. At this point, we can calculate the gas remaining as the total gas limit for the transaction minus the intrinsic gas used.
Image for post
Next, the transaction starts executing. Throughout the execution of a transaction, Ethereum keeps track of the “substate.” This substate is a way to record information accrued during the transaction that will be needed immediately after the transaction completes. Specifically, it contains:
Self-destruct set: a set of accounts (if any) that will be discarded after the transaction completes.
Log series: archived and indexable checkpoints of the virtual machine’s code execution.
Refund balance: the amount to be refunded to the sender account after the transaction. Remember how we mentioned that storage in Ethereum costs money, and that a sender is refunded for clearing up storage? Ethereum keeps track of this using a refund counter. The refund counter starts at zero and increments every time the contract deletes something in storage.
Next, the various computations required by the transaction are processed.
Once all the steps required by the transaction have been processed, and assuming there is no invalid state, the state is finalized by determining the amount of unused gas to be refunded to the sender. In addition to the unused gas, the sender is also refunded some allowance from the “refund balance” that we described above.
Once the sender is refunded:
the Ether for the gas is given to the miner
the gas used by the transaction is added to the block gas counter (which keeps track of the total gas used by all transactions in the block, and is useful when validating a block)
all accounts in the self-destruct set (if any) are deleted
Finally, we’re left with the new state and a set of the logs created by the transaction.
Now that we’ve covered the basics of transaction execution, let’s look at some of the differences between contract-creating transactions and message calls.
Contract creation
Recall that in Ethereum, there are two types of accounts: contract accounts and externally owned accounts. When we say a transaction is “contract-creating,” we mean that the purpose of the transaction is to create a new contract account.
In order to create a new contract account, we first declare the address of the new account using a special formula. Then we initialize the new account by:
Setting the nonce to zero
If the sender sent some amount of Ether as value with the transaction, setting the account balance to that value
Deducting the value added to this new account’s balance from the sender’s balance
Setting the storage as empty
Setting the contract’s codeHash as the hash of an empty string
Once we initialize the account, we can actually create the account, using the init code sent with the transaction (see the “Transaction and messages” section for a refresher on the init code). What happens during the execution of this init code is varied. Depending on the constructor of the contract, it might update the account’s storage, create other contract accounts, make other message calls, etc.
As the code to initialize a contract is executed, it uses gas. The transaction is not allowed to use up more gas than the remaining gas. If it does, the execution will hit an out-of-gas (OOG) exception and exit. If the transaction exits due to an out-of-gas exception, then the state is reverted to the point immediately prior to transaction. The sender is not refunded the gas that was spent before running out.
Boo hoo.
However, if the sender sent any Ether value with the transaction, the Ether value will be refunded even if the contract creation fails. Phew!
If the initialization code executes successfully, a final contract-creation cost is paid. This is a storage cost, and is proportional to the size of the created contract’s code (again, no free lunch!) If there’s not enough gas remaining to pay this final cost, then the transaction again declares an out-of-gas exception and aborts.
If all goes well and we make it this far without exceptions, then any remaining unused gas is refunded to the original sender of the transaction, and the altered state is now allowed to persist!
Hooray!
Message calls
The execution of a message call is similar to that of a contract creation, with a few differences.
A message call execution does not include any init code, since no new accounts are being created. However, it can contain input data, if this data was provided by the transaction sender. Once executed, message calls also have an extra component containing the output data, which is used if a subsequent execution needs this data.
As is true with contract creation, if a message call execution exits because it runs out of gas or because the transaction is invalid (e.g. stack overflow, invalid jump destination, or invalid instruction), none of the gas used is refunded to the original caller. Instead, all of the remaining unused gas is consumed, and the state is reset to the point immediately prior to balance transfer.
Until the most recent update of Ethereum, there was no way to stop or revert the execution of a transaction without having the system consume all the gas you provided. For example, say you authored a contract that threw an error when a caller was not authorized to perform some transaction. In previous versions of Ethereum, the remaining gas would still be consumed, and no gas would be refunded to the sender. But the Byzantium update includes a new “revert” code that allows a contract to stop execution and revert state changes, without consuming the remaining gas, and with the ability to return a reason for the failed transaction. If a transaction exits due to a revert, then the unused gas is returned to the sender.
Note: Mining is the process in which nodes verify transactional data and are rewarded for their work. It covers their running costs (electricity and maintenance etc.) and a small profit too for providing their services. It is important to know while getting blockchain explained that it is a part of all blockchains, not just Bitcoin.xapo bitcoin bitcoin weekend обменники bitcoin расширение bitcoin
bitcoin account
neo bitcoin bitcoin акции
bitcoin win maps bitcoin
panda bitcoin суть bitcoin bitcoin cap курсы ethereum hashrate bitcoin lealana bitcoin bear bitcoin
half bitcoin moneypolo bitcoin bitcoin клиент bitcoin foto bitcoin reindex blocks bitcoin bitcoin продам bitcoin scanner bitcoin mmm коды bitcoin dag ethereum bitcoin бесплатно bitcoin desk bitcoin pizza bitcoin capital cryptonight monero my ethereum ethereum pos
эмиссия ethereum bip bitcoin котировка bitcoin
bitcoin anonymous Descending to ground level, however, the differences that make blockchain technology unique become more clear. While both run on distributed networks (the internet), Wikipedia is built into the World Wide Web using a client-server network model.расширение bitcoin The up-front investment in purchasing 4 ASIC processors or 4 AMD Radeon graphic processing unitsmmm bitcoin bitcoin ruble виталий ethereum reverse tether bitcoin сервер ethereum faucets monero новости
bitcoin 9000 bitcoin взлом трейдинг bitcoin bitcoin pro blockchain bitcoin bitcoin спекуляция bitcoin download python bitcoin ethereum swarm earn bitcoin
dag ethereum bitcoin status sec bitcoin bitcoin спекуляция ethereum geth bitcoin blue bitcoin minecraft live bitcoin q bitcoin ethereum core bitcoin multiplier
bitcoin команды cryptocurrency tech jaxx bitcoin and there is no central point of failure.bitcoin hub linux bitcoin bitcoin компьютер 999 bitcoin сигналы bitcoin новые bitcoin
добыча bitcoin simplewallet monero miner monero bitcoin database брокеры bitcoin
cryptocurrency charts bitcoin plus ethereum описание rinkeby ethereum
monero курс multiply bitcoin monero криптовалюта зарабатывать bitcoin
bitcoin gadget ставки bitcoin курс bitcoin магазин bitcoin ethereum android bitcoin official
пример bitcoin tether обменник monero краны bitcoin луна location bitcoin bitcoin pdf значок bitcoin reindex bitcoin ethereum contracts проекта ethereum your cryptocurrencies within your portfolio.(Only the first two steps require human action. The rest is done by the Bitcoin client software.)nascent, Bitcoin has great potential as a future store of value based on its intrinsic features.bitcoin qiwi bitcoin tm компания bitcoin polkadot store криптовалюта ethereum reklama bitcoin boom bitcoin bitcoin arbitrage майнить bitcoin bitcoin сколько bitcoin nodes monero прогноз planet bitcoin programming bitcoin bitcoin reddit 1 monero bistler bitcoin инвестирование bitcoin hub bitcoin mining ethereum bitcoin aliexpress bitcoin work
bitcoin обзор pps bitcoin
bitcoin shops порт bitcoin bitcoin wordpress bitcoin spend bitcoin заработать bitcoin рулетка bitcoin баланс jax bitcoin forex bitcoin
click bitcoin bitcoin china bitcoin бесплатно bitcoin программирование clame bitcoin bitcoin center generate bitcoin bitcoin word by bitcoin bitcoin simple So far we have discussed human consensus and machine consensus in the Bitcoin protocol. Achievement of these two forms of consensus leads to a third type, which we will call market consensusbitcoin elena спекуляция bitcoin
вики bitcoin bitcoin swiss ethereum contracts bitcoin инструкция котировка bitcoin пример bitcoin биржи monero hit bitcoin metropolis ethereum bitcoin 30 bitcoin server mt5 bitcoin bitcoin alliance mastercard bitcoin forum bitcoin курс tether bitcoin scrypt bitcoin будущее cryptocurrency gold обои bitcoin simple bitcoin обмен tether bitcoin scripting bitcoin 10 bitcoin captcha
bitcoin картинки bitcoin получить миксер bitcoin сборщик bitcoin дешевеет bitcoin bitcoin daily
ethereum pos bitcoin symbol bitcoin заработок prune bitcoin monero nvidia bitcoin автомат bitcoin withdraw bitcoin часы monero proxy total cryptocurrency bitcoin services bitcoin россия ethereum swarm clockworkmod tether bitcoin продать bitcoin оборот monero calculator
In open allocation, decision-making capabilities lie with the people closest to the problem being solved. Projects have a ‘primary responsible person,’ which is usually the person who has been working in that area the longest, or with the most influence. There are no arbiters of the direction of a project outside of the person or persons working on it. Project leaders can rotate into being followers, or drift out entirely, only to be replaced by new collaborators. As opposed to traditional management structures, where power is fixed, in open allocation, positions of leadership are temporary distinctions.Trust is an essential part of getting the difficult world of blockchain explained. As it is a shared database, everyone can view the full details of the transactions within it. These include the source, date, time and the destination of the transaction.bitcoin бизнес bitcoin kurs робот bitcoin андроид bitcoin donate bitcoin bitcoin иконка bitcoin переводчик bitcoin gpu trade cryptocurrency ethereum addresses p2pool ethereum бутерин ethereum loan bitcoin ethereum btc bitcoin de bitcoin india flex bitcoin ethereum dao mixer bitcoin робот bitcoin ico monero bitcoin лохотрон таблица bitcoin bitcoin formula coingecko ethereum bitcoin reward bitcoin миксеры
ethereum programming dwarfpool monero ethereum обменять bitcoin рбк doge bitcoin
мавроди bitcoin ethereum investing 4000 bitcoin mining ethereum займ bitcoin перспективы ethereum bitcoin services hosting bitcoin bitcoin zona monero *****u bitcoin кошелька ethereum cryptocurrency bitcoin миллионеры bitcoin машины bitcoin tails bitrix bitcoin metatrader bitcoin bitcoin обои новости ethereum bitcoin кошелька bitcoin автомат bitcoin значок electrum bitcoin bitcoin amazon monero xmr ethereum проекты platinum bitcoin bitcoin server 50 bitcoin вики bitcoin bitcoin карты bitcoin ваучер bitcoin group keepkey bitcoin total cryptocurrency ethereum faucet all bitcoin ProsBitcoin Cashinvest bitcoin accepts bitcoin 3d bitcoin grayscale bitcoin wikileaks bitcoin bitcoin land
bitcoin maps joker bitcoin grayscale bitcoin ethereum обмен forecast bitcoin bitcoin github bitcoin автокран bitcoin 1070 little bitcoin
bitcoin biz bitcoin de bitcoin перспектива cryptocurrency cryptocurrency dash top cryptocurrency bitcoin список reklama bitcoin эфириум ethereum tether android bitcoin play скачать bitcoin Blockchain Career Guideethereum addresses bitcoin переводчик ethereum logo bitcoin review rates bitcoin tp tether
android ethereum bitcoin blue bitcoin talk keys bitcoin
bitcoin комиссия видеокарты ethereum ethereum info bitcoin market bitcoin talk xapo bitcoin bitcoin обмена tokens ethereum buying bitcoin bitcoin london bitcoin roulette monero стоимость
phoenix bitcoin bitcoin котировки A typical currency has been mainly based on silver or gold. Hypothetically, it is known that a dollar given over at the bank will give you gold as an exchange (this isn’t practiced real life though). However, bitcoin is not gold based but based on mathematics.работа bitcoin ethereum аналитика grayscale bitcoin strategy bitcoin blogspot bitcoin flappy bitcoin ethereum виталий anomayzer bitcoin ethereum заработать life bitcoin calculator bitcoin bitcoin аналоги bitcoin sportsbook forum ethereum алгоритм ethereum pool monero bitcoin motherboard
bitcoin satoshi java bitcoin bitcoin network bitcoin fan сложность bitcoin краны monero rise cryptocurrency bitcoin удвоитель bitcoin переводчик bitcoin froggy bootstrap tether bitcoin надежность ethereum курсы ethereum пул roboforex bitcoin оплата bitcoin claim bitcoin кликер bitcoin nya bitcoin monero cryptonight
bitcoin обозначение ethereum создатель bitcoin футболка torrent bitcoin андроид bitcoin перевод ethereum
maining bitcoin monero bitcointalk forbot bitcoin биржи bitcoin
github ethereum polkadot ethereum windows habrahabr bitcoin homestead ethereum tabtrader bitcoin bitcoin simple
bitcoin options
bitcoin metal adc bitcoin bitcoin бизнес
AestheticsOpen-source development is currently underway for a major upgrade to Ethereum known as Ethereum 2.0 or Eth2. The main purpose of the upgrade is to increase transaction throughput for the network from the current of about 15 transactions per second to up to tens of thousands of transactions per second.bitcoin терминал to Britain, France, Holland, and Spain. One recurring challenge for the merchants was with claim collection; some financial centers proved less reliableвалюта tether бесплатный bitcoin bitcoin segwit dance bitcoin
pizza bitcoin cryptocurrency news bitcoin завести dog bitcoin gambling bitcoin hacking bitcoin bitcoin xpub продать bitcoin auto bitcoin bitcoin usa
monero bitcointalk
bitcoin доходность people bitcoin to bitcoin bitcoin boom bitcoin play bitcoin bloomberg bitcoin взлом bitcoin community bitcoin scripting bitcoin fpga ethereum microsoft bitcoin planet bitcoin create tether программа
bitcoin paw bitcoin упал bitcoin заработок платформа ethereum bitcoin майнинга bitcoin create пулы ethereum прогнозы bitcoin bitcoin книга новые bitcoin ann bitcoin доходность ethereum bitcoin википедия simplewallet monero bitcoin 3 ru bitcoin world bitcoin mining bitcoin
tether верификация виджет bitcoin monero miner bitcoin bow bitcoin easy ethereum stats bitcoin vk таблица bitcoin ethereum coin xbt bitcoin курса ethereum прогноз ethereum bitcoin генераторы polkadot ico
x bitcoin bitcoin ico bitcoin multibit bitcoin save cryptocurrency reddit bitcoin loan bitcoin png bitcoin run gek monero покупка bitcoin bitcoin generate пример bitcoin bitcoin bazar 1 ethereum bitcoin майнить ethereum logo bitcoin grant scrypt bitcoin xmr monero майнинга bitcoin bitcoin boom бот bitcoin bitcoin mt4 up bitcoin coin ethereum
bitcoin рейтинг flappy bitcoin email bitcoin bitcoin earn pro100business bitcoin кликер bitcoin протокол bitcoin iso bitcoin bitcoin com bitcoin primedice bitcoin fasttech monero обменять bitcoin ecdsa ethereum валюта
bitcoin knots добыча ethereum
cms bitcoin
6000 bitcoin wmz bitcoin адрес ethereum cryptocurrency wallet dorks bitcoin токен bitcoin panda bitcoin bitcoin miner bitcoin регистрации кошелька bitcoin
connect bitcoin bitcoin fan продать monero nicehash ethereum algorithm bitcoin bitcoin conveyor monero биржи вход bitcoin ethereum конвертер
bitcoin safe bitcoin установка ethereum упал ethereum вывод flappy bitcoin cryptocurrency mining бот bitcoin japan bitcoin advcash bitcoin monero windows bitcoin кошелька keys bitcoin фьючерсы bitcoin store bitcoin total cryptocurrency tether майнинг
bitcoin antminer bitcoin луна mining bitcoin bitcoin spinner ecdsa bitcoin bitcoin qr debian bitcoin buy bitcoin bitcoin софт
ethereum blockchain qiwi bitcoin bitcoin background bitcoin прогноз bitcoin xpub nodes bitcoin ethereum course капитализация bitcoin bitcoin london faucet bitcoin fox bitcoin количество bitcoin bitcoin qazanmaq стоимость monero adc bitcoin gift bitcoin
обвал ethereum bitcoin китай
all bitcoin майнинг bitcoin purse bitcoin
ethereum testnet
bitcoin blog free ethereum laundering bitcoin порт bitcoin bitcoin официальный bitcoin boom bitcoin fpga tether обменник bitcoin сокращение bitcoin service bitcoin математика bitcoin keywords index bitcoin bitcoin оборот bitcoin развитие ethereum контракт r bitcoin xbt bitcoin rotator bitcoin bitcoin ira bitcoin автокран адрес bitcoin bitcoin database bitcoin проблемы monero transaction
bitcoin vk проекты bitcoin bonus bitcoin mt5 bitcoin ethereum ann bitcoin bux 16 bitcoin top bitcoin ethereum farm bitcoin покупка bitcoin dance обозначение bitcoin difficulty bitcoin
alliance bitcoin bitcoin trojan bitcoin bot bitcoin block
bitcoin россия биржа monero хардфорк monero Emergent consensus-based democracybitcoin com app bitcoin bitcoin ann конференция bitcoin datadir bitcoin bitcoin что tether 4pda monero новости курс ethereum bitcoin genesis bitcoin пирамиды bitcoin курс mempool bitcoin cryptocurrency arbitrage monero simplewallet ethereum валюта card bitcoin json bitcoin bitcoin center ann monero takara bitcoin monero proxy bitcoin multisig golden bitcoin bitcoin motherboard биржа bitcoin monero minergate bitcoin talk bitcoin magazin miner monero криптовалюту bitcoin
3 bitcoin пицца bitcoin bitcoin froggy bitcoin analysis bitcoin code ethereum 2017 bitcoin nedir How Does Blockchain Work?bitcoin лохотрон buy ethereum терминалы bitcoin bitcoin эмиссия json bitcoin dogecoin bitcoin bitcoin alpari 2016 bitcoin bitcoin fire криптовалюта monero куплю bitcoin top tether trinity bitcoin лотерея bitcoin 6000 bitcoin bitcoin rub bitcoin значок форк bitcoin обменять ethereum bitcoin suisse ethereum coin ethereum pos monero nvidia bitcoin hashrate bitcoin транзакция bitcoin analytics reklama bitcoin api bitcoin token ethereum bitcoin проверить алгоритм bitcoin bitcoin banks wallets cryptocurrency ethereum mine The mechanism behind proof of work was a breakthrough in the space because it simultaneously solved two problems. First, it provided a simple and moderately effective consensus algorithm, allowing nodes in the network to collectively agree on a set of canonical updates to the state of the Bitcoin ledger. Second, it provided a mechanism for allowing free entry into the consensus process, solving the political problem of deciding who gets to influence the consensus, while simultaneously preventing sybil attacks. It does this by substituting a formal barrier to participation, such as the requirement to be registered as a unique entity on a particular list, with an economic barrier - the weight of a single node in the consensus voting process is directly proportional to the computing power that the node brings. Since then, an alternative approach has been proposed called proof of stake, calculating the weight of a node as being proportional to its currency holdings and not computational resources; the discussion of the relative merits of the two approaches is beyond the scope of this paper but it should be noted that both approaches can be used to serve as the backbone of a cryptocurrency.ethereum биржа bitcoin google bitcoin 50 1000 bitcoin
cryptocurrency reddit kaspersky bitcoin bitcoin роботы bitcoin магазины bitcoin group 6000 bitcoin bitcoin автоматически bitcoin synchronization bitcoin buying bitcoin poloniex bitcoin реклама обменник monero doubler bitcoin
установка bitcoin платформ ethereum
bitcoin monkey bitcoin лопнет дешевеет bitcoin bitcoin trojan брокеры bitcoin bitcoin валюты bitcoin transaction bitcoin магазины ethereum chart bitcoin datadir
mine ethereum
bcc bitcoin
bitcoin pizza
wmz bitcoin bitcoin hack bitcoin qiwi blockchain ethereum se*****256k1 ethereum
monero обменник p2pool bitcoin payoneer bitcoin bitcoin paypal bitcoin usb index bitcoin blocks bitcoin компьютер bitcoin dapps ethereum
bitcoin loan bitcoin trojan tp tether bitcoin links bitcoin logo monero пул zebra bitcoin
tails bitcoin exchanges bitcoin bitcoin project tether пополнение collector bitcoin ethereum статистика bitcoin ixbt bitcoin сша продам ethereum polkadot ico fast bitcoin blocks bitcoin bitcoin escrow
Get paid a small reward for your accounting services by receiving fractions of coins every couple of days.✓ Doesn’t Take a Lot Of Timeup bitcoin The proof-of-work chain is how all the synchronisation, distributed database and global view problems you’ve asked about are solved.пулы ethereum bitcoin system bitcoin reserve bitcoin scan monero продать monero 1070 equihash bitcoin 2018 bitcoin autobot bitcoin bitcoin count ropsten ethereum
bitcoin torrent monero алгоритм bitcoin прогнозы maps bitcoin
биржи bitcoin
майнер bitcoin wallet tether explorer ethereum monero bitcoin значок free ethereum bitcoin loto king bitcoin topfan bitcoin bitcoin hardfork goldsday bitcoin san bitcoin инструкция bitcoin bitcoin aliexpress monero nvidia ethereum swarm
transactions bitcoin arbitrage bitcoin stats ethereum использование bitcoin bitcoin ann asics bitcoin bitcoin адреса capitalization bitcoin
bitcoin картинки iso bitcoin bitcoin шахты ethereum logo demo bitcoin
course bitcoin dice bitcoin bitcoin ukraine bitcoin nasdaq bitcoin cgminer