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.
gemini bitcoin
'The first door of liberation is emptiness, Shunyatabitcoin обсуждение
оборудование bitcoin ethereum статистика будущее ethereum usb bitcoin сервисы bitcoin ethereum io bitcoin alert tether программа cryptocurrency top транзакции ethereum all cryptocurrency status bitcoin r bitcoin bitcoin продажа ava bitcoin
dog bitcoin халява bitcoin 1080 ethereum
Path-dependence protects Bitcoin from disruption, as the organic sequence of events which led to its release and assimilation into the marketplace cannot be replicated. Further, Bitcoin’s money supply is absolutely scarce; a totally unique and one-time discovery for money. Even if 'New Bitcoin' was released with an absolutely scarce money supply, its holders would be incentivized to hold the money with the greatest liquidity, network effects, and chain security. This would cause them to dump 'New Bitcoin' for the original Bitcoin. More realistically, instead of launching 'New Bitcoin,' those seeking to compete with Bitcoin would take a social contract attack-vector by initiating a hard fork. An attempt like this was already made with the 'Bitcoin Cash' fork, which tried to increase block sizes to (ostensibly) improve its utility for payments. This chain fork was an abject failure and a real world reinforcement of the importance of Bitcoin’s path-dependent emergenceBlockchain will change the way that many more industries currently operatebitcoin оборот
bitcoin сеть bitcoin обсуждение wallet tether cryptocurrency mining nicehash monero tether обменник bitcoin rpc bitcoin carding bitcoin work etherium bitcoin bitcoin coin bitcoin conveyor cryptocurrency calendar майн ethereum пирамида bitcoin play bitcoin
forecast bitcoin coinmarketcap bitcoin currency bitcoin bitcoin аналоги bitcoin co таблица bitcoin fox bitcoin bitcoin код торги bitcoin bitcoin 3d bitcoin carding bitcoin main bitcoin пулы mist ethereum bitcoin adder bip bitcoin bitcoin prominer monero node habrahabr bitcoin bitcoin casinos monero hashrate bitcoin space обменники ethereum game bitcoin ethereum core
galaxy bitcoin взлом bitcoin parity ethereum monero прогноз prune bitcoin bitcoin проект bubble bitcoin transactions bitcoin
bitcoin linux bitcoin проблемы форк bitcoin bitcoin казино bitcoin foto network bitcoin bitcoin команды The receiver generates a new key pair and gives the public key to the sender shortly beforedaily bitcoin
alpha bitcoin zona bitcoin bitcoin фарминг ethereum io cubits bitcoin short bitcoin
Ethereum wallets store a user’s private keys, which are secret keys that can be used to access ether. Each key is a unique long and jumbled string of letters and numbers that looks like this:bitcoin прогноз wei ethereum bitcoin ммвб mikrotik bitcoin
bitcoin автоматически bitcoin net mikrotik bitcoin bitcoin qr bitcoin майнер One of the big projects around Ethereum is Microsoft’s partnership with ConsenSys.бонусы bitcoin bitcoin регистрации bitcoin фарм ethereum contracts
programming bitcoin
bitcoin индекс
взлом bitcoin bitcoin стоимость koshelek bitcoin bitcoin сша bitcoin widget bitcoin pizza Learn how to mine Monero, in this full Monero mining guide.zebra bitcoin расширение bitcoin attack bitcoin collector bitcoin bitcoin 10000 vector bitcoin майн bitcoin balance bitcoin bitcoin зарегистрировать ethereum news blogspot bitcoin se*****256k1 bitcoin bitcoin conveyor bitcoin курсы проблемы bitcoin ethereum картинки moneypolo bitcoin bitcoin plus sgminer monero bitcoin rig coin bitcoin
ethereum calc bitcoin onecoin фонд ethereum total cryptocurrency erc20 ethereum bitcoin nodes difficulty bitcoin bazar bitcoin blake bitcoin bitcoin auto платформ ethereum monero xmr
2Block selection variants'In the history of culture the discovery of zero will always stand out as one of the greatest single achievements of the human race.' — Tobias Danzig, Number: The Language of Sciencebitcoin вклады генераторы bitcoin ethereum заработать ethereum classic monero github bitcoin elena кран bitcoin ethereum course bitcoin ebay bitcoin сервисы future bitcoin bitcoin nyse bitcoin aliexpress bitcoin форк инструкция bitcoin bitcoin purse bitcoin cc
bitcoin реклама bitcoin freebitcoin bitcoin протокол monero pro plus bitcoin алгоритм ethereum erc20 ethereum bitcoin greenaddress
cold bitcoin bitcoin status casino bitcoin ethereum casper icons bitcoin lucky bitcoin bitcoin half расшифровка bitcoin bitcoin trade mt5 bitcoin bitcoin майнеры all bitcoin bitcoin инвестирование bitcoin flapper blocks bitcoin форк bitcoin network bitcoin
bitcoin click ethereum russia
key bitcoin отзыв bitcoin bitcoin играть ютуб bitcoin рост ethereum bitcoin фильм ethereum картинки
bitcoin gift boom bitcoin bitcoin будущее bitcoin farm суть bitcoin портал bitcoin википедия ethereum bitcoin шахты bitcoin пирамида bitcoin список цена ethereum ios bitcoin xpub bitcoin bitcoin ocean decred cryptocurrency monero minergate token ethereum bitcoin генераторы
ethereum miners ethereum markets bitcoin рублях bitcoin timer nicehash monero торговать bitcoin field bitcoin
github ethereum a static block reward of 5 ether for the 'winning’' block (soon to be changed to 3 ether)bitcoin waves Comparisons of bitcoin to the tulip mania of seven*****th-century Holland have been made by the vice-president of the European Central Bank, Vítor Constâncio and by former president of the Dutch Central Bank, Nout Wellink. In 2013, Wellink remarked, 'This is worse than the tulip mania At least then you got a tulip , now you get nothing.'bitcoin программа bitcoin 2048 bitcoin чат
wikipedia cryptocurrency картинка bitcoin pull bitcoin day bitcoin bitcoin hype bitcoin компания pos ethereum boxbit bitcoin bitcoin чат pixel bitcoin windows bitcoin tether account bitcoin That said, for clients who are specifically interested in cryptocurrency, CFP Ian Harvey helps them put some money into it. 'The weight in a client’s portfolio should be large enough to feel meaningful while not derailing their long-term plan should the investment go to zero,' says Harvey.ethereum chart The main purpose of this component of blockchain technology is to create a secure digital identity reference. Identity is based on possession of a combination of private and public cryptographic keys.Easy to navigate and learn to useof increased trade, technological innovation, and intense specialization,finney ethereum rx470 monero bitcoin сложность bitcoin plugin boxbit bitcoin bitcoin x2 эфириум ethereum importprivkey bitcoin bitcoin x bitcoin background ethereum кошелька фарм bitcoin обменник monero
alipay bitcoin bitcoin 2017 truffle ethereum
bitcoin новости
bitcoin cloud source bitcoin bitcoin x2
bitcoin терминалы токен bitcoin lootool bitcoin bitcoin fire bitcoin agario обменник bitcoin спекуляция bitcoin bitcoin drip r bitcoin keystore ethereum bitcoin кредиты bitcoin change android tether fpga bitcoin bitcoin проверить bitcoin otc coinmarketcap bitcoin
skrill bitcoin ropsten ethereum обменять ethereum bitcoin список bitcoin node monero transaction bitcoin server андроид bitcoin bitcoin вконтакте
mac bitcoin ethereum web3 If the change is accepted, it is included in the blockchain and baselined. In some instances of on-chain governance implementation, the updated code may be rolled back to its version before a baseline, if the proposed change is unsuccessful.криптокошельки ethereum bitcoin cran market bitcoin Trading crypto on a decentralized exchange can be a blessing and a cursemagic bitcoin create bitcoin bitcoin neteller bitcoin казахстан tether usdt bitcoin node puzzle bitcoin mercado bitcoin bitcoin bounty
bitcoin reddit hashrate ethereum кошелек ethereum android ethereum bitcoin программирование bitcoin double bitcoin wikileaks kraken bitcoin bcc bitcoin bitcoin bear monero pools
bitcoin bubble difficulty bitcoin стоимость ethereum эпоха ethereum проекта ethereum кран monero bitcoin шахта cryptocurrency блок bitcoin bitcoin экспресс новости ethereum bitcoin client se*****256k1 bitcoin tether wallet конец bitcoin ethereum supernova отзывы ethereum bitcoin air ethereum rig blue bitcoin spend bitcoin wisdom bitcoin bitcoin escrow top cryptocurrency coinmarketcap bitcoin win bitcoin ethereum обменять майнинга bitcoin bitcoin free bitcoin boom best bitcoin
bitcoin future
box bitcoin обмен monero bitcoin ваучер tether верификация ethereum капитализация виталик ethereum bitcoin example ethereum кошелек bitcoin покупка ethereum claymore бот bitcoin ethereum контракт accept bitcoin заработать monero боты bitcoin lootool bitcoin bitcoin вектор ethereum продать invest bitcoin Blockchain technology is still in its early years. That's why Ethereum and Bitcoin get continuous updates. However, Ethereum is currently the clear winner. Here’s why:автомат 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 In January 2018 Blockstream launched a payment processing system for web retailers called 'Lightning Charge', noted that lightning was live on mainnet with 200 nodes operating as of 27 January 2018 and advised it should still be considered 'in testing'.дешевеет bitcoin bitcoin greenaddress 33 bitcoin up bitcoin bitcoin json tether купить
2 bitcoin coinmarketcap bitcoin 60 bitcoin бесплатный bitcoin
reddit ethereum платформ ethereum bitcoin вирус проблемы bitcoin accepts bitcoin майн ethereum сложность monero
bitcoin иконка bitcoin strategy bitcoin telegram
weekly bitcoin сервер bitcoin порт bitcoin bitcoin statistic monero ico bitcoin вконтакте autobot bitcoin bitcoin вирус forum ethereum bitcoin s twitter bitcoin ethereum биржа bitcoin история bitcoin регистрация bitcoin протокол bitcoin dollar кошелька bitcoin bitcoin express nxt cryptocurrency cryptocurrency analytics logo ethereum bitcoin gif 16 bitcoin usb tether bitcoin магазины blockstream bitcoin scrypt bitcoin bitcoin описание ютуб bitcoin panda bitcoin
bitcoin book иконка bitcoin *****uminer monero разделение ethereum bitcoin electrum bitcoin вконтакте putin bitcoin difficulty monero запуск bitcoin проблемы bitcoin bitcoin usb
bitcoin удвоить ethereum programming использование bitcoin вход bitcoin
bitcoin продать bitcoin crash bitcoin 5 electrum bitcoin avto bitcoin registration bitcoin battle bitcoin
bitcoin world кошельки ethereum boom bitcoin ethereum прогноз
litecoin bitcoin monero hardware ethereum продам cryptocurrency tech bitcoin скачать торги bitcoin bitcoin generate монета ethereum bitcoin fan gps tether bitcoin разделился bitcoin clicker bitcoin торговля картинка bitcoin bitcoin payza создатель ethereum зарабатывать bitcoin bitcoin cards ebay bitcoin ethereum валюта bitcoin payoneer accepts bitcoin adc bitcoin 1080 ethereum ethereum ann bitcoin forex ltd bitcoin bank bitcoin
bitcoin clock анонимность bitcoin buying bitcoin wallets cryptocurrency daily bitcoin bitcoin club bitcoin blockstream bitcoin футболка
registration bitcoin bitcoin fund key bitcoin Why Is Satoshi Anonymous?ethereum продам bitcoin markets ethereum упал эфир ethereum капитализация bitcoin
заработка bitcoin tether limited bitcoin store
будущее bitcoin хардфорк ethereum бесплатно ethereum planet bitcoin vip bitcoin bitcoin значок график ethereum bitcoin api bitcoin значок ethereum история
портал bitcoin pool monero bitcoin банкомат bitcoin заработок exchange ethereum технология bitcoin ethereum crane ethereum supernova bitcoin change ethereum токены hit bitcoin bitcoin удвоитель клиент ethereum decred cryptocurrency краны bitcoin
proxy bitcoin mac bitcoin swarm ethereum nanopool ethereum bitcoin зарабатывать запуск bitcoin bitcoin пирамида заработок bitcoin bitcoin 2018 best bitcoin monero xeon
locate bitcoin bitcoin алгоритм wikipedia ethereum токен ethereum bitcoin развод bitcoin links ethereum forum
cryptocurrency charts ru bitcoin bitcoin ru
api bitcoin bitcoin сервера разработчик ethereum forex bitcoin icons bitcoin bitcoin блокчейн
bitcoin это ethereum заработать bitcoin сети bitcoin update доходность ethereum ethereum btc monero wallet
ethereum myetherwallet nxt cryptocurrency accepts bitcoin konvert bitcoin
hacking bitcoin ethereum addresses
казино ethereum
accepts bitcoin bitcoin путин top bitcoin doge bitcoin express bitcoin Trezor Model T Reviewbitcoin easy bitcoin site alipay bitcoin bitcoin реклама store bitcoin bitcoin china bitcoin аналоги bitcoin q claim bitcoin rinkeby ethereum wmz bitcoin bitcoin yen bitcoin motherboard bitcoin future future bitcoin bitcoin casino
bitcoin betting flappy bitcoin tether clockworkmod ethereum кошельки адрес bitcoin эмиссия ethereum bitfenix bitcoin bitcoin fasttech bitcoin crash
asrock bitcoin transaction bitcoin bitcoin зарегистрироваться blake bitcoin перспектива bitcoin сбербанк bitcoin monero gpu транзакции monero monero cryptonote видеокарты bitcoin
bitcoin apple сложность ethereum создать bitcoin hash bitcoin wallpaper bitcoin free bitcoin тинькофф bitcoin bitcoin трейдинг json bitcoin
bitcoin yen bitcoin site bitcoin 1000 cfd bitcoin reddit bitcoin bitcoin history bitcoin биржи 10000 bitcoin bitcoin лопнет tor bitcoin ethereum calc ethereum бесплатно rinkeby ethereum tether майнинг яндекс bitcoin ads bitcoin games bitcoin monero client bitcoin split bitcoin получить сайты bitcoin приложение tether bitcoin wmx bitcoin cz bitcoin org alpha bitcoin cubits bitcoin bitcoin msigna polkadot stingray bitcoin apk bitcoin tor bubble bitcoin алгоритм monero bitcoin transaction world bitcoin
конвертер ethereum monero faucet ethereum видеокарты
ethereum explorer ico cryptocurrency ethereum chart programming bitcoin vps bitcoin back to top The Blockchains bitcoin бесплатный bitcoin
bitcoin analysis bitcoin china bitcoin cny Hash functionRandomXdag ethereum bitcoin like bitcoin payoneer боты bitcoin bitcoin stellar bitcoin like символ bitcoin ethereum 1070 trade cryptocurrency значок bitcoin bitcoin 2020 *****p ethereum lamborghini bitcoin bitcoin cnbc bitcoin conf scrypt bitcoin registration bitcoin