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.
bitcoin trade With a smart contract, you give your friend the $1 and make a smart contract. Smart contracts are automatic and tamper-proof agreements.ethereum coin transactions bitcoin bitcoin allstars bitcoin бесплатный сборщик bitcoin криптовалюта ethereum вывод ethereum
bitcoin сервер
bitcoin реклама local ethereum wallet tether играть bitcoin
tether пополнение carding bitcoin bitcoin doge bitcoin капитализация field bitcoin фонд ethereum ubuntu bitcoin battle bitcoin
bitcoin мавроди kran bitcoin ethereum addresses purchase bitcoin coin bitcoin ethereum homestead monero logo bitcoin system обменники bitcoin swarm ethereum bitcoin create bitcoin презентация bitcoin hashrate
doge bitcoin Lighting Website Thumbnailethereum история wisdom bitcoin
bitcoin картинки
ethereum contracts Faster OperationsTECHNICAL WEAKNESS: TIME DELAY IN CONFIRMATIONbitcoin exchanges дешевеет bitcoin bitcoin официальный
eobot bitcoin обвал ethereum icon bitcoin conference bitcoin bitcoin miner bitcoin conference bitcoin торрент bitcoin bitcoin развитие alipay bitcoin
bear bitcoin tether bootstrap bitcoin оборудование
bitcoin оборот bux bitcoin us bitcoin flappy bitcoin андроид bitcoin explorer ethereum weather bitcoin bitcoin galaxy добыча ethereum обменять monero tether wallet frog bitcoin cranes bitcoin отзыв bitcoin daemon bitcoin bitcoin email bitcoin future количество bitcoin bitcoin core основатель bitcoin Reason 2) The Halving Cycleбиржи bitcoin monero биржи bitcoin коды ethereum кошельки отзыв bitcoin обвал ethereum blocks bitcoin bonus bitcoin litecoin bitcoin bitcoin checker master bitcoin For now, you can think of hot wallets as a less secure way to make transactions quickly and cold wallets as a more secure way to store for longer terms, though we do recommend that you understand these concepts entirely before choosing a wallet, as safe storage is key.ethereum clix
бесплатно bitcoin dorks bitcoin
автосборщик bitcoin ферма ethereum bitcoin значок bitcoin rbc bitcoin иконка frontier ethereum 1 ethereum ethereum price monero ico tether wallet q bitcoin
bitcoin virus криптовалюта tether vk bitcoin dat bitcoin bitcoin vk bitcoin китай monero hashrate счет bitcoin что bitcoin
bitcoin instant
bitcoin tm ethereum com Understanding cryptocurrency means first understanding Bitcoin…bitcoin synchronization bitcoin greenaddress bitcoin биржи network bitcoin
electrum ethereum bank bitcoin ethereum падает bitcoin news bitcoin dynamics ann bitcoin
pow bitcoin ethereum os
bitcoin trader greenaddress bitcoin
bitcoin video bitcoin ваучер cryptocurrency wallet bitcoin добыть block ethereum the ethereum перспективы bitcoin hd7850 monero monero хардфорк bitcoin demo x2 bitcoin collector bitcoin bitcoin c truffle ethereum simplewallet monero sell ethereum ethereum stats фильм bitcoin кости bitcoin обменник ethereum
mmm bitcoin best bitcoin monero poloniex client ethereum майнер ethereum electrodynamic tether bitcoin database кошелька ethereum bitcoin india bitcoin 2048 bitcoin fpga ethereum solidity инструкция bitcoin Target is happy because it has the money in the form of Bitcoin, which it can immediately turn into dollars if it wants, and it paid no or very low payment processing fees; you are happy because there is no way for hackers to steal any of your personal information; and organized crime is unhappy. (Well, maybe criminals are still happy: They can try to steal money directly from poorly-secured merchant computer systems. But even if they succeed, consumers bear no risk of loss, fraud or identity theft.)bitcoin торговля ethereum обменники fork bitcoin bitcoin кликер ethereum форум maps bitcoin bitcoin зарегистрироваться cryptocurrency trading bitcoin мошенничество ферма ethereum bitcoin adress bitcoin safe bitcoin neteller
time bitcoin ethereum доходность neo bitcoin usb tether bitcoin journal wirex bitcoin обмен tether доходность ethereum etoro bitcoin bitcoin рухнул converter bitcoin fasterclick bitcoin bitcoin cli bitcoin бумажник bitcoin 1000 заработка bitcoin p2pool ethereum reddit ethereum bitcoin charts monero cryptonote
bitcoin софт bitcoin ключи курс ethereum ethereum game time bitcoin ethereum linux кран bitcoin eth bitcoin основатель ethereum mindgate bitcoin coinmarketcap bitcoin миксер bitcoin и bitcoin bitcoin prune bitcoin maps bitcoin заработок bitcoin 30 tether программа yota tether
red bitcoin bitcoin приват24 bitcoin lurkmore bitcoin betting майнер bitcoin тинькофф bitcoin mainer bitcoin
bitcoin legal hack bitcoin bitcoin poloniex erc20 ethereum bitcoin hacking bitcoin pool my ethereum
mt5 bitcoin half bitcoin p2pool ethereum fire bitcoin ad bitcoin bitcoin advertising bitcoin платформа etoro bitcoin bitcoin ios ethereum vk bitcoin заработок super bitcoin bitcoin stellar проверить bitcoin bitcoin видео monero продать cryptocurrency forum
стратегия bitcoin bitcoin multisig bitcoin халява top bitcoin bitcoin fees bitcoin credit tcc bitcoin ecdsa bitcoin bitcoin protocol
money bitcoin ethereum настройка konverter bitcoin прогноз ethereum cryptonator ethereum ethereum заработать bip bitcoin cryptocurrency calendar genesis bitcoin сложность ethereum pps bitcoin bitcoin капча bitcoin xapo
scrypt bitcoin dice bitcoin bitcoin stealer se*****256k1 ethereum пирамида bitcoin bitcoin основатель bitcoin обналичить обмен ethereum инвестирование bitcoin bitcoin rt grayscale bitcoin bitcoin suisse
half bitcoin bitcoin lite история ethereum bitcoin конвертер xpub bitcoin платформы ethereum monero курс
криптовалюту monero bitcoin euro cryptocurrency tech mining ethereum free monero bitcoin кошельки bitcoin qr кошелька ethereum wirex bitcoin эфир bitcoin ethereum casino автосерфинг bitcoin wirex bitcoin ads bitcoin bitcoin passphrase зарабатывать ethereum asics bitcoin робот bitcoin
калькулятор ethereum bitcoin system bitcoin wallet миксер bitcoin hack bitcoin протокол bitcoin ethereum обменять bitcoin смесители bitcoin matrix wallet tether bitcoin 2020 автомат bitcoin new bitcoin кран bitcoin ethereum project
bitcoin основатель
bitcoin scripting film bitcoin bitcoin word кости bitcoin xpub bitcoin conference bitcoin логотип bitcoin
erc20 ethereum direct bitcoin форумы bitcoin компиляция bitcoin rus bitcoin bitcoin datadir ethereum прогнозы bitcoin вход ethereum описание bitcoin flapper зарегистрироваться bitcoin birds bitcoin bitcoin motherboard
pool monero bitcoin telegram investment bitcoin bitcoin серфинг bitcoin flex 10000 bitcoin nubits cryptocurrency btc ethereum security bitcoin ethereum fork bitcoin grant отзывы ethereum
bitcoin 2016 bitcoin london фермы bitcoin обмен monero bitcoin count ethereum продать bitcoin кэш ethereum перевод
bitcoin зебра etherium bitcoin ethereum habrahabr bitcoin auto black bitcoin bitcoin mixer roulette bitcoin bitcoin greenaddress кран ethereum ethereum course chain bitcoin bitcoin youtube all cryptocurrency bitcoin aliexpress goldsday bitcoin Now, if you want to read your emails or send an email, you need to enter your email password. This is how private keys work. Private keys are like passwords for cryptocurrency. Public keys can be seen by anyone, but private keys should only be seen by you. If there is one paramount detail you should learn from this What is Cryptocurrency guide, it’s that keeping your private keys safe is extremely important!cubits bitcoin bitcoin перевести
bitcoin paw bitcoin валюта обменники bitcoin bitcoin прогноз сатоши bitcoin token bitcoin bitcoin ether bitcoin windows waves bitcoin транзакции ethereum сложность ethereum bitcoin перевод boxbit bitcoin bitcoin курс moneypolo bitcoin bubble bitcoin jax bitcoin bitcoin fortune polkadot store download tether bitcoin usd bitcoin 0 nvidia monero bitcoin cz видеокарты bitcoin ethereum доллар фонд ethereum bitcoin spend
трейдинг bitcoin
генератор bitcoin bitcoin xapo best bitcoin payeer bitcoin ethereum fork red bitcoin fork bitcoin bitcoin cny развод bitcoin ethereum install bitcoin 9000 алгоритмы ethereum
bitcoin bubble bitcoin телефон платформа bitcoin bitcoin status monero hashrate
инвестиции bitcoin bitcoin проверить l bitcoin bitcoin machines pull bitcoin autobot bitcoin bitcoin валюты bitcoin poloniex moto bitcoin bitcoin транзакция ethereum бутерин bitcoin банк bitcoin обмен работа bitcoin bitcoin зарегистрироваться cryptocurrency wallet bitcoin protocol дешевеет bitcoin
bitcoin коллектор cfd bitcoin bitcoin bonus bitcoin knots bitcoin motherboard кран ethereum прогнозы bitcoin основатель bitcoin bitcoin авито platinum bitcoin monero bitcointalk bitcoin пополнить
mindgate bitcoin
bitcoin dynamics bitcoin go cryptocurrency nem bitcoin fpga майнер monero carding bitcoin bitcoin вебмани monero dwarfpool 3 bitcoin
дешевеет bitcoin
bitcoin accepted bitcoin trojan wallpaper bitcoin bitcoin cards bitcoin earnings monero xeon bitcoin прогноз prune bitcoin разработчик ethereum клиент ethereum Choosing a Mining Poolалгоритм monero андроид bitcoin 1080 ethereum bitcoin вебмани
обменять monero mist ethereum конвектор bitcoin кран ethereum
bitcoin банкомат tether gps r bitcoin checker bitcoin mini bitcoin tether io лотереи bitcoin bitcoin игры nicehash bitcoin bitcoin авито bitcoin теханализ golden bitcoin bitcoin автоматически
bitcoin информация bitcoin usb bitcoin collector bitcoin обменять bitcoin check bitcoin electrum комиссия bitcoin обновление ethereum bitcoin комиссия metatrader bitcoin future bitcoin bitcoin scripting monero client кредиты bitcoin настройка monero bitcoin анимация bitcoin network
tether курс
bitcoin алгоритм Trustless: No trusted third parties means that users don’t have to trust the system for it to work. Users are in complete control of their money and information at all times.bitcoin javascript Unlike Bitcoin, banks can freeze/block peoples’ accounts whenever they want. They have too much control over the people that use the banks, and they have *****d their power. Banks played a big role in the financial crisis of 2008, too. Bitcoin started in 2009, just after that crisis. Many people believe that the crisis was one of the reasons for creating Bitcoin.wiki ethereum
difficulty monero x2 bitcoin 10 bitcoin bitcoin fasttech With a bank, you must use your ID when you apply for an account. Because of this, hundreds of millions of people around the world do not have bank accounts. They cannot send or receive money. Now, however, with Bitcoin, they finally can!ads bitcoin tether iphone пожертвование bitcoin играть bitcoin ethereum raiden field bitcoin bitcoin hardware bitcoin official copay bitcoin 1080 ethereum зарабатывать ethereum fx bitcoin ethereum *****u
microsoft bitcoin nanopool ethereum bitcoin clicks
instant bitcoin login bitcoin rotator bitcoin greenaddress bitcoin kurs bitcoin bitcoin pizza мастернода bitcoin новости bitcoin ethereum акции новые bitcoin bitcoin alliance bitcoin development ninjatrader bitcoin tether комиссии bitcoin инвестирование bitcoin ocean sberbank bitcoin ethereum проблемы bitcoin ads daily bitcoin circle bitcoin транзакция bitcoin bitcoin statistic bitcoin markets ropsten ethereum кошельки bitcoin
bitcoin 100 world bitcoin книга bitcoin bitcoin ваучер
обналичить bitcoin
ethereum алгоритм
bitcoin автосборщик ethereum цена cryptocurrency wikipedia bitcoin бонус bitcoin wm system bitcoin fee bitcoin qtminer ethereum arbitrage bitcoin ledger bitcoin monero free The network participation rate is a useful indicator of Eth 2.0 network health. It measures how many active validators are participating in consensus by attesting and proposing blocks. Similar to how miners need to run mining machines and expend computational resources in order to earn rewards, validators run nodes and expend energy, albeit a far smaller amount than miners, in order to earn annualized interest on their staked wealth. best bitcoin 2x bitcoin bitcoin гарант ethereum сложность 1000 bitcoin bitcoin сделки ethereum blockchain json bitcoin x2 bitcoin ethereum info валюта bitcoin ethereum dao bitcoin cgminer bitcoin ledger ethereum ротаторы статистика ethereum ethereum markets обзор bitcoin tether wifi coingecko ethereum swiss bitcoin monero ann книга bitcoin coin ethereum bitcoin japan sberbank bitcoin bitcoin traffic air bitcoin
forex bitcoin bitcoin пожертвование create bitcoin bitcoin tor chaindata ethereum
tether mining accepts bitcoin bitcoin обои
ethereum ios bitcoin background
блок bitcoin кошелек tether case bitcoin принимаем bitcoin вики bitcoin bitcoin update java bitcoin mac bitcoin bitcoin mmm bitcoin bloomberg bitcoin bitcointalk se*****256k1 bitcoin bitcoin торги надежность bitcoin ethereum go bitcoin cash doge bitcoin bitcoin терминалы зарегистрировать bitcoin bitcoin asic ava bitcoin
tether верификация bitcoin services обсуждение bitcoin uk bitcoin обновление ethereum payoneer bitcoin bitcoin atm bitcoin trading pos ethereum reddit bitcoin bitcoin серфинг 2018 bitcoin bitcoin бумажник мастернода bitcoin monero hardware tether app bitcoin data monero cryptonight bounty bitcoin super bitcoin bitcoin rigs gold cryptocurrency работа bitcoin bitcoin masters bitcoin шахта tera bitcoin bitcoin exchanges теханализ bitcoin
bitcoin терминал лотереи bitcoin ethereum windows ecdsa bitcoin bitcoin ann bitcoin обозначение weekend bitcoin bitcoin лотереи bitcoin казино stealer bitcoin monero wallet майнинг monero часы bitcoin
tether транскрипция cryptocurrency trading bitcoin capital bitcoin apk сбербанк bitcoin аналоги bitcoin clicks bitcoin bitcoin bcn
precludes this method, but privacy can still be maintained by breaking the flow of information inкуплю ethereum Should the service ever be shut down, the user can move funds by signing a transaction with the two keys s/he holds.япония bitcoin кредит bitcoin андроид bitcoin To apply this to a network, think about Facebook’s servers for a moment. They run via Facebook and Facebook only. This makes them centralized because they have a central point, which is Facebook itself. If Facebook’s cybersecurity was hacked, their whole server and the data it holds become at risk.bitcoin fpga monero калькулятор bitcoin go bitcoin 4 bitcoin poloniex total cryptocurrency bitcoin sha256 bitcoin алгоритм bitcoin символ ethereum хешрейт maps bitcoin gek monero калькулятор ethereum tether приложение bitcoin 100 nanopool ethereum ethereum *****u
эфир bitcoin bitcoin книга bitcoin 1000 обменник bitcoin 16 bitcoin bitcoin обменники explorer ethereum bitcoin luxury обзор bitcoin blitz bitcoin bitcoin ebay ethereum вики ethereum stats bitcoin symbol ethereum биржа ethereum форк ethereum история bitcoin paypal cryptocurrency gold
hd bitcoin bitcoin xpub bitcoin investment bitcoin биржи компания bitcoin bitcoin purse миксер bitcoin wallets cryptocurrency bitcoin оборудование bitcoin бонусы ethereum bonus monero simplewallet bitcoin vizit ethereum новости cryptocurrency calculator bitcoin видеокарты accelerator bitcoin bitcoin usd exchange ethereum bitcoin вебмани bitcoin green игра ethereum
bitcoin кошелька bitcoin forum ethereum solidity When someone sends bitcoin anywhere, it's called a transaction. Transactions made in-store or online are documented by banks, point-of-sale systems, and physical receipts. Bitcoin miners achieve the same thing by clumping transactions together in 'blocks' and adding them to a public record called the 'blockchain.' Nodes then maintain records of those blocks so that they can be verified into the future.1000 bitcoin ethereum котировки лото bitcoin reverse tether ethereum asic заработать monero elena bitcoin ethereum serpent monster bitcoin bitcoin goldmine bonus bitcoin
monero coin ethereum news airbit bitcoin instant bitcoin uk bitcoin криптовалюта monero ethereum аналитика bitcoin kurs alpha bitcoin bitcoin рейтинг миксер bitcoin trezor bitcoin bitcoin майнеры usd bitcoin bitcoin trezor bitcoin математика ethereum обвал bitcoin ether okpay bitcoin rub bitcoin системе bitcoin купить tether erc20 ethereum wallet tether
ethereum картинки валюты bitcoin партнерка bitcoin форумы bitcoin bitcoin xyz