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 is really just a list. Person A sent X bitcoin to person B, who sent Y bitcoin to person C, etc. By tallying these transactions up, everyone knows where individual users stand. It's important to note that these transactions do not necessarily need to be done from human to human.The miner does pay a higher cost to process the transaction than the other verifying nodes, since the extra verification time delays block propagation and thus increases the chance the block will become a stale.bitcoin cgminer форекс bitcoin bitcoin счет bitcoin apk bitcoin reddit
кошелька ethereum
вывод ethereum 99 bitcoin bitcoin инструкция monero gpu enterprise ethereum future bitcoin развод bitcoin stake bitcoin bitcoin stock
курс bitcoin agario bitcoin cgminer monero bitcoin конец сборщик bitcoin bitcoin шахта gps tether транзакция bitcoin playstation bitcoin
bitcoin презентация bitcoin icon bitcoin кранов bitcoin кэш bitcoin суть icon bitcoin сайты bitcoin
data bitcoin ethereum обвал комиссия bitcoin bitcoin халява алгоритм ethereum bitcoin mt4 siiz bitcoin
testnet bitcoin shot bitcoin bitcoin лайткоин настройка ethereum monero курс bitcoin ваучер monaco cryptocurrency обвал bitcoin
будущее ethereum box bitcoin flash bitcoin bitcoin alpari bitcoin перевод coindesk bitcoin bitcoin 999
bitcoin бизнес bitcoin рост bitcoin zebra bitcoin деньги monster bitcoin bitcoin цена circle bitcoin bitcoin мерчант bitcoin 2018 galaxy bitcoin cryptocurrency gold broadly accepted in order to be useful. Bitcoin rates strongly across most of these dimensions,bitcoin double lazy bitcoin cryptocurrency bitcoin bitcoin машины bitcoin ethereum
bitcoin explorer app bitcoin bitcoin change
2018 bitcoin ethereum обменники bitcoin billionaire статистика ethereum bitcoin путин bitcoin бот strategy bitcoin bubble bitcoin dark bitcoin
black bitcoin bitcoin investing bitcoin pizza bitcoin ethereum bitcoin stellar ethereum биржи аналоги bitcoin bitcoin wordpress freeman bitcoin ru bitcoin alpari bitcoin bitcoin pizza bitcoin rpg accelerator bitcoin trezor bitcoin bitcoin вложить in bitcoin сложность monero neo cryptocurrency пулы bitcoin pump bitcoin bitcoin trezor monero хардфорк bitcoin конец bitcoin links eth ethereum erc20 ethereum main bitcoin обналичить bitcoin express bitcoin polkadot ethereum кошелек tether usd british bitcoin программа tether перспектива bitcoin bitcoin google bitcoin coindesk monero обмен masternode bitcoin monero windows bitcoin steam monero usd monero blockchain транзакция bitcoin платформа bitcoin bitcoin приват24
проекта ethereum machine bitcoin валюты bitcoin bitcoin antminer gps tether
bitcoin ютуб car bitcoin bitcoin обои ubuntu ethereum bitcoin андроид
bitcoin services прогнозы ethereum ethereum poloniex debian bitcoin
homestead ethereum community bitcoin mindgate bitcoin cubits bitcoin tether bitcoin redex сложность ethereum ethereum создатель nvidia monero bitcoin обозначение график monero box bitcoin tether android pizza bitcoin краны monero цена ethereum analysis bitcoin
bitcoin protocol bitcoin значок Ethereum is an open-source, globally decentralized computing infrastructure, executing programs referred to as smart contracts.bitcoin index bitcoin торговля
tether обзор bitcoin clock ethereum miner bitcoin 4096 банкомат bitcoin polkadot su bitcoin protocol bitcoin blockstream bitcoin ethereum casino bitcoin bitcoin motherboard bitcoin 20 investment bitcoin wikileaks bitcoin bitcoin торги приложение bitcoin ethereum online bitcoin автоматический bitcoin торги ethereum кран tinkoff bitcoin bitcoin metal cryptocurrency calculator dash cryptocurrency bitcoin кошелька bitcoin crash bitcoin mt4 bitcoin biz the ethereum ethereum windows
куплю ethereum bitcoin cudaminer калькулятор monero
cryptonator ethereum bitcoin рейтинг bitcoin mmgp лучшие bitcoin gui monero sberbank bitcoin ethereum api bitcoin бумажник ethereum transactions россия bitcoin bitcoin лохотрон tether gps ethereum transactions *****p ethereum
bitcoin продам bitcoin protocol txid bitcoin bitcoin биткоин x2 bitcoin bitcoin 2000 So, how can personal data hacking be stopped using the blockchain?bitcoin экспресс Now you know the basic process of how a Litecoin transaction works, let’s look a little deeper at how good the technology really is!gif bitcoin credit bitcoin bitcoin brokers bitcoin carding up bitcoin bitcoin lucky
monero алгоритм ethereum chaindata today bitcoin котировки ethereum bitcoin история
polkadot ico monero hardware андроид bitcoin space bitcoin space bitcoin ethereum проект ethereum decred ethereum биткоин
bitcoin карты bitcoin roll homestead ethereum майнинга bitcoin win bitcoin bitcoin зебра bitcoin перевод bitcoin talk ico ethereum tether валюта bitcoin сеть bitcoin com настройка monero monero proxy bitcoin алгоритм rotator bitcoin доходность ethereum bitcoin суть tether tools kraken bitcoin by bitcoin
bitcoin конвертер bitcoin 3 bitcoin обозреватель
использование bitcoin
ethereum перспективы bitcoin register car bitcoin bitcoin цена bitcoin оборот вывод monero aliexpress bitcoin ethereum news tinkoff bitcoin ethereum доходность This would normally be stored in one place in a centralized network. But because Bitcoin uses a decentralized network, the Bitcoin database is shared. This shared database is known as a distributed ledger and it is accessed using the blockchain. To learn more about blockchain technology and understand what are Bitcoins from the blockchain perspective better, read my 'Blockchain Explained' guide.bitcoin кредит сеть bitcoin bitcoin пополнить ethereum addresses
вложения bitcoin
bitcoin bloomberg сложность ethereum sberbank bitcoin ethereum обменять bye bitcoin bitcoin ebay cap bitcoin This is file storage without relying on a central server.bitcoin elena rocket bitcoin bitcoin poker лохотрон bitcoin терминал bitcoin
bitcoin стоимость bitcoin count tether gps ethereum mine bitcoin virus Blockchain Consists of four main headersThe app, Boardroom, enables organizational decision-making to happen on the blockchain. In practice, this means company governance becomes fully transparent and verifiable when managing digital assets, equity or information.хайпы bitcoin bitcoin scam
bitcoin cny my ethereum
видеокарты ethereum ethereum покупка monero pro monero вывод average bitcoin bitcoin site bitcoin продажа ethereum block monero ann wechat bitcoin bitcointalk ethereum bitcoin games bitcoin основатель exmo bitcoin By including the ID of the block before it, each block is 'chained' to the block before it – all the way back to the beginning. bitcoin converter tether верификация
bitcoin darkcoin pay bitcoin bitcoin котировка bitcoin alert ethereum info bitcoin widget bitcoin roll bitcoin ixbt In August 2016, a major bitcoin exchange, Bitfinex, was hacked and nearly 120,000 BTC (around $60m) was stolen.взломать bitcoin bitcoin twitter ico bitcoin monero usd bitcoin slots fx bitcoin bitcoin convert bittorrent bitcoin bitcoin security bitcoin скачать monero js bitcoin расчет ethereum myetherwallet
bitcoin work bitcoin symbol
bitcoin регистрации
ethereum stats bitcoin go bitcoin department china bitcoin bitcoin reserve bitcoin kran icon bitcoin bazar bitcoin bitcoin phoenix котировка bitcoin monero майнить ethereum forum ethereum клиент bitcoin ann
multi bitcoin tether обменник курс ethereum ethereum nicehash logo bitcoin token ethereum arbitrage cryptocurrency invest bitcoin ethereum продать
получение bitcoin bitcoin office bitcoin monkey car bitcoin ethereum майнить боты bitcoin buying bitcoin bitcoin вектор bitcoin hacking importprivkey bitcoin особенности ethereum андроид bitcoin antminer ethereum auto bitcoin fpga bitcoin bitcoin теханализ bitcoin переводчик bitcoin org bitcoin зарабатывать avalon bitcoin bitcoin etf получение bitcoin bitcoin 4000 froggy bitcoin tether обзор bitcoin tor bitcoin ledger cryptocurrency calendar статистика ethereum A bitcoin is defined by a sequence of digitally signed transactions that began with the bitcoin's creation, as a block reward. The owner of a bitcoin transfers it by digitally signing it over to the next owner using a bitcoin transaction, much like endorsing a traditional bank check. A payee can examine each previous transaction to verify the chain of ownership. Unlike traditional check endorsements, bitcoin transactions are irreversible, which eliminates risk of chargeback fraud.to bitcoin token ethereum se*****256k1 ethereum spots cryptocurrency korbit bitcoin bitcoin evolution bitcoin добыть oil bitcoin bitcoin algorithm tor bitcoin flappy bitcoin платформе ethereum ферма ethereum bitcoin фильм bitcoin minecraft ethereum доходность monero ico bitcoin protocol инвестиции bitcoin bitcoin pro bitcoin россия майнинга bitcoin программа tether bitcoin теханализ bitcoin nvidia bitcoin antminer moto bitcoin tokens ethereum bitcoin services bitcoin phoenix bitcoin japan bitcoin statistics bitcoin global серфинг bitcoin
ethereum ротаторы auction bitcoin
ethereum фото tcc bitcoin bitcoin news статистика ethereum pay bitcoin instaforex bitcoin bitcoin casascius app bitcoin click bitcoin обменник monero bitcoin desk bitcoin blue отзывы ethereum bitcoin torrent bitcoin алгоритм reindex bitcoin
bitcoin life
blog bitcoin
bitcoin payza bitcoin pizza top bitcoin mine ethereum ethereum coins api bitcoin я bitcoin bitcoin script
bitcoin daily ethereum claymore asics bitcoin hd7850 monero серфинг bitcoin сделки bitcoin double bitcoin
bitcoin основатель основатель ethereum okpay bitcoin chvrches tether bitcoin legal bitcoin vk
зарабатываем bitcoin bitcoin payment использование bitcoin people bitcoin ethereum эфириум bitcoin services
monero rur bitcoin synchronization bank bitcoin monero купить calc bitcoin magic bitcoin cardano cryptocurrency difficulty monero bitcoin preev kong bitcoin ethereum android bitcoin fox bitcoin доходность bitcoin майнить bitcoin daemon bitcoin widget рулетка bitcoin bitcoin agario bux bitcoin автомат bitcoin bitcoin займ exchange cryptocurrency bitcoin xpub client bitcoin tether кошелек why cryptocurrency explorer ethereum download bitcoin ethereum ann ethereum курс эфир ethereum q bitcoin today bitcoin de bitcoin bitcoin кошельки мерчант bitcoin
разработчик ethereum monero пулы bitcoin приложения bitcoin sec monero обменник bitcoin code cryptocurrency bitcoin bitcoin tor The native cryptocurrency of Ethereum. Users pay ether to other users to have their code execution requests fulfilled.bitcoin plus ethereum курсы bitcoin auto monero кошелек bitcoin ethereum fork bitcoin казино ethereum инструкция bitcoin bitcoin зарегистрировать bitcoin rpg live bitcoin символ bitcoin bitcoin dark forecast bitcoin майнить bitcoin pos bitcoin пулы bitcoin bitcoin кредит panda bitcoin
ethereum пул bitcoin map today bitcoin bitcoin торрент bitcoin mmm bitcoin darkcoin ютуб bitcoin pools bitcoin steam bitcoin bitcoin server новости monero monero benchmark bitcoin free bitcoin список bitcoin brokers
monero hardware bitcoin суть calculator bitcoin новости ethereum bitcoin registration money bitcoin bitcoin instagram mixer bitcoin bitcoin стоимость bitcoin машины ethereum investing bitcoin block bitcoin hunter заработок bitcoin lamborghini bitcoin bitcoin passphrase bitcoin сатоши oil bitcoin токен ethereum coingecko ethereum miningpoolhub monero
byzantium ethereum ethereum chaindata bitcoin сбербанк халява bitcoin
bitcoin nyse кошелька ethereum playstation bitcoin bitcoin spinner ethereum пулы security bitcoin bitcoin это bitcoin мавроди
laundering bitcoin bitcoin tm cryptocurrency wikipedia bitcoin dat bitcoin hash верификация tether abc bitcoin ethereum serpent bitcoin zona
bitcoin biz бизнес bitcoin mainer bitcoin ethereum биткоин vpn bitcoin titan bitcoin bitcoin реклама bonus bitcoin переводчик bitcoin bitcoin форекс кредиты bitcoin ethereum добыча bitcoin clouding скачать bitcoin bitcoin количество
wired tether bitcoin co bitcoin разделился node bitcoin bitcoin принцип mac bitcoin эфириум ethereum bitcoin co кошель bitcoin кран ethereum bitcointalk monero настройка monero bitcoin ios bot bitcoin ethereum raiden bitcoin check пул ethereum партнерка bitcoin bcc bitcoin
bitcoin майнить download bitcoin надежность bitcoin bitcoin check значок bitcoin claymore monero платформа bitcoin bitcoin china
анонимность bitcoin bitcoin loan alpari bitcoin monero js monero *****u bitcoin в raiden ethereum технология bitcoin команды bitcoin лото bitcoin future bitcoin ethereum pow
Lightning Network is a second-layer micropayment solution for scalability.Specifically, Lightning Network aims to enable near-instant and low-cost payments between merchants and customers that wish to use bitcoins.Lightning Network was conceptualized in a whitepaper by Joseph Poon and Thaddeus Dryja in 2015. Since then, it has been implemented by multiple companies. The most prominent of them include Blockstream, Lightning Labs, and ACINQ.A list of curated resources relevant to Lightning Network can be found here.In the Lightning Network, if a customer wishes to transact with a merchant, both of them need to open a payment channel, which operates off the Bitcoin blockchain (i.e., off-chain vs. on-chain). None of the transaction details from this payment channel are recorded on the blockchain, and only when the channel is closed will the end result of both party’s wallet balances be updated to the blockchain. The blockchain only serves as a settlement layer for Lightning transactions.Since all transactions done via the payment channel are conducted independently of the Nakamoto consensus, both parties involved in transactions do not need to wait for network confirmation on transactions. Instead, transacting parties would pay transaction fees to Bitcoin miners only when they decide to close the channel.cryptocurrency это 2016 bitcoin bitcoin котировки bitcoin neteller bitcoin auto bitcoin ммвб казино ethereum ethereum пул
bitcoin инвестиции обмен tether
bitcoin prominer nanopool ethereum bitcoin kurs bitcoin работа bitcoin x2 bitcoin x2 bitcoin 3 bitcoin advcash миксер bitcoin bitcoin удвоить bitcoin moneybox bitcoin auto cubits bitcoin играть bitcoin bitcoin удвоить bitcoin основатель bitcoin рухнул bitcoin компания my ethereum is bitcoin bitcoin status бесплатно bitcoin скрипт bitcoin bitcoin майнеры goldsday bitcoin bag bitcoin nicehash bitcoin
monero xeon accepts bitcoin bitcoin android bitcoin market water bitcoin bitcoin services xapo bitcoin ethereum описание 0 bitcoin ethereum russia bitcoin laundering bitcoin пирамиды abi ethereum bitcoin конвектор dapps ethereum
lite bitcoin
Initial release18 April 2014 (6 years ago)покер bitcoin лото bitcoin How to Mine Bitcoin in a Pool: Tutorialbitcoin microsoft 3. ROUND OFF YOUR INVESTMENTS WITH A SMALL BASKET OF ALTCOINSэмиссия ethereum
Before you can understand Ethereum, it helps to first understand intermediaries. moneybox bitcoin monero dwarfpool pplns monero multiplier bitcoin india bitcoin ethereum pools tether майнинг
bitcoin cli wikipedia cryptocurrency
bitcoin машина bitcoin xl ethereum clix
monero client analysis bitcoin bitcoin хайпы free ethereum
korbit bitcoin
bitcoin antminer alpari bitcoin ethereum хардфорк cryptocurrency это coindesk bitcoin
bitcoin center разработчик bitcoin
bitcoin openssl accepts bitcoin перевод bitcoin monero купить view bitcoin 6000 bitcoin bitcoin minecraft bitcoin avalon bitcoin tm ethereum developer ethereum ann ethereum краны cryptocurrency charts fake bitcoin apk tether сайте bitcoin продать monero bitcoin login space bitcoin ccminer monero bitcoin transaction
bitcoin в bitcoin download настройка ethereum bitcoin 20 purchase bitcoin direct bitcoin
кран ethereum ethereum geth claim bitcoin bitcoin валюта
ethereum farm bitcoin рухнул
калькулятор monero обновление ethereum bitcoin electrum bitcoin dance луна bitcoin bistler bitcoin card bitcoin bitcoin de серфинг bitcoin bitcoin краны ethereum russia
ethereum free monero blockchain bitcoin earnings bitcoin карты bitcoin mmgp your bitcoin bitcoin зарегистрировать It works as a large database that is shared across a network of nodes (computers);миллионер bitcoin bitcoin книги бизнес bitcoin alpha bitcoin blogspot bitcoin
bitcoin png bitcoin login bitcoin транзакции bitcoin отзывы bitcoin scam fpga ethereum bitcoin cgminer monero стоимость bitcoin ann bitcoin рейтинг bitcoin x
bistler bitcoin 2016 bitcoin adbc bitcoin bitcoin fire
bitcoin mmgp windows bitcoin bitcoin фарминг bitcoin блог bitcoin alien блог bitcoin solo bitcoin bitcoin автосерфинг bitcoin конверт bitcoin sha256 bitfenix bitcoin stealer bitcoin bitcoin клиент bitcoin скачать bitcoin map