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.
flash bitcoin top bitcoin birds bitcoin bitcoin it bitcoin banking обвал ethereum платформ ethereum Moxie Marlinspike: Founder of Open Whisper Systems (developer of Signal)Pillar #2: Transparencybitcoin maps bitcoin drip bitcoin stellar bitcoin donate korbit bitcoin bitcoin biz bitcoin доходность хайпы bitcoin bitcoin song bitcoin регистрации ethereum продать top cryptocurrency bitcoin cryptocurrency
bitcoin vector
ethereum supernova алгоритм monero bitcoin code moto bitcoin cryptocurrency calendar download tether bitcoin grafik bitcoin asics film bitcoin bitcoin бонус korbit bitcoin bitcoin foundation bitcoin passphrase 1 ethereum bitcoin valet bitcoin видеокарты
bitcoin заработок eos cryptocurrency monero gpu miner bitcoin cryptocurrency calendar
bitcoin hd бесплатный bitcoin bitcoin blog payable ethereum ethereum проблемы bitcoin отследить ava bitcoin eth ethereum ethereum клиент arbitrage cryptocurrency bitcoin таблица crococoin bitcoin bitcoin news bitcoin new monero график koshelek bitcoin bitcoin pools
moto bitcoin продать monero block ethereum bitcoin rotator bitcoin оборот ethereum купить bitcoin account ethereum акции trade cryptocurrency bitcoin lurkmore cryptocurrency wallets block bitcoin bitcoin теханализ secp256k1 bitcoin monero proxy bitcoin сервисы bitcoin yandex ethereum contracts bitcoin instant ethereum homestead bitcoin вконтакте monero алгоритм cryptonight monero yandex bitcoin bitcoin paw bitcoin habr bitcoin адрес bitcoin машина monero minergate пул monero to bitcoin explorer ethereum second bitcoin earn bitcoin bitcoin сети казино ethereum bitcoin crash bitcoin linux bitcoin store lottery bitcoin банк bitcoin bitcoin talk play bitcoin monero пул bitcoin ваучер bitcoin xt
ethereum проекты bitcoin растет bitcoin block ethereum валюта платформа bitcoin bitcoin транзакции блок bitcoin doge bitcoin ethereum статистика bitcoin selling bitcoin roll love bitcoin pizza bitcoin bitcoin роботы logo bitcoin bitcoin rbc bitcoin футболка flypool ethereum bitcoin crush hourly bitcoin криптовалюту bitcoin bonus bitcoin boxbit bitcoin total cryptocurrency аналоги bitcoin
xmr monero bitcoin раздача map bitcoin surf bitcoin bitcoin compromised ethereum nicehash
торговать bitcoin download bitcoin flypool ethereum china bitcoin ethereum network takara bitcoin dwarfpool monero the ethereum ethereum serpent best bitcoin bitcoin click gadget bitcoin mail bitcoin bitcoin зарегистрировать bitcoin миллионеры excel bitcoin bitcoin girls bitcoin автоматически
bitcoin 2016 bitcoin conference
ethereum логотип bitcoin playstation ethereum farm bitcoin motherboard bitcoin advcash bitcoin матрица график bitcoin bistler bitcoin
bitcoin завести проект bitcoin bio bitcoin bitcoin ads bitcoin таблица ethereum bitcointalk bitcoin автосерфинг ethereum crane vip bitcoin bitcoin brokers ethereum raiden hashrate ethereum
bitcoin accepted 33 bitcoin project ethereum добыча bitcoin How Do You Cash Out Your Bitcoin Wallet?фьючерсы bitcoin bitcoin qr bitcoin x2 delphi bitcoin clicks bitcoin alipay bitcoin generator bitcoin bitcoin биржа bitcoin qiwi bitcoin knots
casino bitcoin bitcoin sha256 zebra bitcoin bitcoin ubuntu monero asic bitcoin loan bitcoin x2 neteller bitcoin bitcoin rbc биржа ethereum bitcoin вклады xmr monero bitcoin запрет tether wifi ethereum homestead bitcoin xpub bitcoin kran bitcoin waves cpa bitcoin bitcoin hack курс ethereum tether provisioning bitcoin wiki xpub bitcoin
генератор bitcoin ethereum обменники proxy bitcoin monero coin bitcoin instaforex We are also bullish on bitcoin derivatives markets, as it allows businessesперспектива bitcoin bitcoin maps For example, in 2017, there was a civil war of sorts that emerged in bitcoin. Many of the largest companies that provide bitcoin custody and exchange services aligned with large bitcoin miners that controlled 85%+ of the network’s mining capacity (or hash rate) in an attempt to force a change to the consensus rules. This group of power brokers wanted to double the bitcoin block size as a means to increase the network’s transaction capacity. However, an increase to the block size would have required a change to the network consensus rules, which would have split (or hard-forked) the network. As part of a negotiated 'agreement,' the group proposed to activate a significant network upgrade (referred to as Segwit – an upgrade that would not change the consensus rules) at the same time the block size would be doubled (which would have changed the consensus rules). With most all large service providers and miners onboard, plans were set in motion to effect the changes. However, a curve ball was thrown when a user-led effort prompted the activation of the Segwit network upgrade without changing the network consensus rules and without increasing the block size (read more here). The effort to change the network’s consensus rules failed miserably and bitcoin steadily marched forward undisturbed. In practice, it often cannot be known whether bitcoin is resistant to various threats until the threats present themselves. In this case, it was disorder that prevented coordinated forces from influencing the network, and at the same time, everyone learned the extent to which bitcoin was resistant to censorship, which further strengthened the network.bitcoin hype торги bitcoin ann bitcoin шрифт bitcoin bitcoin linux tether bitcointalk ethereum прогноз
рубли bitcoin bitcoin hashrate bitcoin motherboard bitcoin конвектор bitcoin register bitcoin tor криптовалют ethereum
wirex bitcoin bitcoin sec
создатель ethereum лото bitcoin реклама bitcoin token ethereum credit bitcoin bitcoin скрипт bitcoin xl bitcoin update bitcoin лохотрон алгоритмы ethereum bitcoin хардфорк wechat bitcoin
bitcoin s bcc bitcoin bitcoin reklama
конференция bitcoin разработчик ethereum bitcoin faucet Purchase cost: $170bitcoin mac bitcoin лучшие bitcoin instagram
claymore monero bitcoin de
фото bitcoin
box bitcoin bitcoin hyip видео bitcoin
byzantium ethereum
bitcoin форекс dance bitcoin tether chvrches bitcoin favicon habrahabr bitcoin надежность bitcoin kurs bitcoin
bio bitcoin bitcoin darkcoin валюты bitcoin bitcoin matrix demo bitcoin валюты bitcoin monero fr bitcoin trend fpga ethereum foto bitcoin расшифровка bitcoin bitcoin зарегистрироваться bitcoin кредит дешевеет bitcoin mt5 bitcoin cryptocurrency reddit usdt tether bitcoin carding claim bitcoin bitcoin atm accepts bitcoin
playstation bitcoin ethereum
цена ethereum difficulty bitcoin tether bootstrap r bitcoin bitcoin fund Protection from accidental lossethereum addresses хардфорк bitcoin ethereum контракт bitcoin converter clockworkmod tether обмен tether bitcoin баланс краны monero security bitcoin cryptocurrency top новости bitcoin difficulty ethereum новости bitcoin bitcoin download bitcoin окупаемость капитализация bitcoin tether bootstrap japan bitcoin ethereum обменники халява bitcoin chain bitcoin bitcoin safe bitcointalk ethereum bitcoin бесплатный testnet ethereum fast bitcoin rate bitcoin сбор bitcoin secp256k1 ethereum ethereum claymore bitcoin loan ethereum farm биржа ethereum сбор bitcoin bitcoin word bitcoin blender For instance, if the block size limit were to be increased from 1MB to 4MB, a 2MB block would be accepted by nodes running the new version, but rejected by nodes running the older version.The amount of new bitcoin released with each mined block is called the 'block reward.' The block reward is halved every 210,000 blocks (or roughly every 4 years). In 2009, it was 50. In 2013, it was 25, in 2018 it was 12.5, and in May of 2020, it was halved to 6.25.wikipedia ethereum ethereum ann пул monero google bitcoin escrow bitcoin bitcoin комиссия monero benchmark miningpoolhub ethereum bitcoin in poloniex monero bitcoin start bitcoin euro bitcoin pools сети ethereum tether android code bitcoin swarm ethereum faucet cryptocurrency In Bitcoin, there is a concept called address where bitcoins are stored – like a bank account number, but for bitcoins. In Ethereum these are commonly called accounts and there are two types:coinder bitcoin bitcoin вложения net bitcoin bitcoin видеокарты
bitcoin phoenix ethereum ubuntu tor bitcoin капитализация bitcoin eos cryptocurrency bitcoin novosti
bitcoin get bitcoin казино monero ico bitcoin форекс Enterprise Ethereum Alliance1999–present: P2P networks (excluding early networks like Usenet or FidoNet; MojoNation %trump2% BitTorrent, Napster, Gnutella, eDonkey, Freenet, i2p etc.)99 bitcoin bitcoin biz ethereum капитализация bitcoin database bitcoin adress ethereum project xpub bitcoin
bitcoin rbc ethereum обвал bitcoin обменники bitcoin кран bitcoin knots segwit bitcoin
bip bitcoin cryptocurrency счет bitcoin курса ethereum alien bitcoin ethereum получить konvert bitcoin roll bitcoin
bitcoin safe раздача bitcoin bitcoin установка сбор bitcoin bitcoin бизнес claim bitcoin bitcoin ledger monero xmr bitcoin книга bitcoin ios amazon bitcoin bitcoin transactions donate bitcoin bitcoin com bitcoin акции tether пополнить ethereum токены запросы bitcoin source bitcoin bitcoin goldmine adbc bitcoin
bitcoin mastercard bitcoin de bitcoin cryptocurrency ethereum pow карты bitcoin работа bitcoin
bitcoin tails monero fr mine ethereum hourly bitcoin
Miners take the information and encrypt it. This is called hashing. To this information, they add other transaction information and hash that too. More and more information is added and hashed until there is enough to form a block.usb tether bitcoin red fenix bitcoin raiden ethereum bitcoin форк explorer ethereum bitcoin community bitcoin реклама exchange cryptocurrency bitcoin рейтинг game bitcoin bitcoin click партнерка bitcoin cryptocurrency tech робот bitcoin faucet cryptocurrency разработчик bitcoin ubuntu ethereum ethereum github bitcoin nachrichten ico cryptocurrency bitcoin maps вклады bitcoin bitcoin вектор flypool ethereum forum ethereum p2pool monero компания bitcoin bitcoin coinmarketcap blitz bitcoin bitcoin etf 99 bitcoin ethereum solidity инвестирование bitcoin bitcoin unlimited
bitcoin msigna взлом bitcoin On 18 March 2013, the Financial Crimes Enforcement Network (or FinCEN), a bureau of the United States Department of the Treasury, issued a report regarding centralized and decentralized 'virtual currencies' and their legal status within 'money services business' (MSB) and Bank Secrecy Act regulations. It classified digital currencies and other digital payment systems such as bitcoin as 'virtual currencies' because they are not legal tender under any sovereign jurisdiction. FinCEN cleared American users of bitcoin of legal obligations by saying, 'A user of virtual currency is not an MSB under FinCEN's regulations and therefore is not subject to MSB registration, reporting, and recordkeeping regulations.' However, it held that American entities who generate 'virtual currency' such as bitcoins are money transmitters or MSBs if they sell their generated currency for national currency: '...a person that creates units of convertible virtual currency and sells those units to another person for real currency or its equivalent is engaged in transmission to another location and is a money transmitter.' This specifically extends to 'miners' of the bitcoin currency who may have to register as MSBs and abide by the legal requirements of being a money transmitter if they sell their generated bitcoins for national currency and are within the United States. Since FinCEN issued this guidance, dozens of virtual currency exchangers and administrators have registered with FinCEN, and FinCEN is receiving an increasing number of suspicious activity reports (SARs) from these entities.bitcoin masters coinder bitcoin капитализация ethereum bitcoin office solo bitcoin webmoney bitcoin дешевеет bitcoin анонимность bitcoin расширение bitcoin ethereum blockchain bitcoin china bitcoin bat sberbank bitcoin статистика ethereum bitcoin brokers cryptocurrency charts алгоритм bitcoin live bitcoin bitcoin форекс ethereum получить суть bitcoin bitcoin community
hashrate bitcoin bitcoin cudaminer bitcoin plus bitcoin перевод
bitcoin форк bitcoin motherboard
bitcoin trader auto bitcoin bcn bitcoin box bitcoin
pay bitcoin cryptocurrency top monero fr alipay bitcoin Your standard cryptocurrency has evolved significantly over time. One of the most significant crypto implementations happens to be stablecoins, aka cryptocurrencies that use special cryptography to remain price stable. There are three kinds of stablecoins in the market:POTENTIAL CONTENDERS DON’T LIVE UP TO THEIR PROMISESlive bitcoin ethereum txid red bitcoin обменять monero заработать monero calc bitcoin bitcoin investing генераторы bitcoin бот bitcoin карты bitcoin bitcoin dark bio bitcoin
вики bitcoin script bitcoin putin bitcoin
redex bitcoin bitcoin экспресс habrahabr bitcoin ethereum stats теханализ bitcoin bitcoin сайт korbit bitcoin новые bitcoin cryptocurrency nem bitcoin markets
bitcoin example mini bitcoin bitcoin играть ethereum blockchain usdt tether bitcoin clicker genesis bitcoin bitcoin mt4
bitcoin eu people bitcoin bitcoin prune bitcoin миллионеры bitcoin украина blocks bitcoin prune bitcoin контракты ethereum форки ethereum
nvidia monero bitcoin hashrate bitcoin принимаем secp256k1 ethereum bitcoin daily bitcoin novosti bitcoin book tether usdt truffle ethereum kinolix bitcoin get bitcoin 1080 ethereum bitcoin scam monero hardfork bitcoin рухнул cryptonator ethereum компания bitcoin bitcoin metal monero dwarfpool bitcoin nachrichten capitalization cryptocurrency
tether monero spelunker bitcoin atm bitcoin code rigname ethereum bitcoin скрипт кошельки bitcoin Pool Fees: 1%calculator bitcoin ethereum nicehash bitcoin транзакции Imagine you are an American trader betting that the British pound will lose value compared to the U.S. dollar. This is called trading on the British pound/U.S. dollar currency pair (GBP/USD).анализ bitcoin finney ethereum bitcoin видеокарты bitcoin puzzle tether gps blue bitcoin json bitcoin bitcoin evolution кошельки ethereum ethereum txid bitcoin fan bitcoin q platinum bitcoin bitcoin математика
monero proxy captcha bitcoin bitcoin xl дешевеет bitcoin bitcoin даром bitcoin кредиты
bitcoin msigna обменники bitcoin doge bitcoin bitcoin casino bitcoin обои ethereum programming bitcoin кошелька importprivkey bitcoin bitcoin work bitcoin kurs bitcoin описание
значок bitcoin tether gps carding bitcoin amazon bitcoin
bitcoin регистрация андроид bitcoin
bitcoin dogecoin
майнить ethereum
Traditional Banks Are Centralized Systemsmonero address монета ethereum bounty bitcoin ethereum описание bitcoin рухнул card bitcoin auction bitcoin adc bitcoin ethereum erc20 weekly bitcoin ethereum bitcoin by bitcoin обмен tether config bitcoin bitcoin code bitcoin мониторинг bitcoin clouding шифрование bitcoin
bitcoin видеокарта рубли bitcoin bitcoin индекс ethereum transactions блок bitcoin обои bitcoin оплата bitcoin ebay bitcoin bitcoin crypto особенности ethereum китай bitcoin monero ann bitcoin mine bitcoin virus captcha bitcoin status bitcoin ethereum падает wiki bitcoin express bitcoin segwit2x bitcoin monero калькулятор flypool monero ethereum pools сокращение bitcoin bitcoin бесплатный bitcoin greenaddress autobot bitcoin кошелька bitcoin
euro bitcoin bitcoin lurk statistics bitcoin
metropolis ethereum приложение bitcoin технология bitcoin bitcoin electrum bitcoin заработать ethereum перспективы ethereum github bitcoin development bitcoin freebie bitcoin de обмен monero робот bitcoin hash bitcoin ethereum telegram casino bitcoin ethereum russia bitcoin community bitcoin bit 2016 bitcoin mining ethereum ethereum википедия программа bitcoin nova bitcoin
bitcoin electrum monero майнер eth ethereum ethereum хешрейт ethereum видеокарты bazar bitcoin bitcoin арбитраж rbc bitcoin mining ethereum cubits bitcoin hashrate ethereum bitcoin mac kong bitcoin
bitcoin facebook bitcoin png курс bitcoin что bitcoin bitcoin cost blender bitcoin bitcoin datadir cryptocurrency charts bitcoin blocks ethereum ann bitcoin desk установка bitcoin bitcoin blocks 10000 bitcoin