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.
zcash bitcoin часы bitcoin tether обзор зебра bitcoin parity ethereum trezor ethereum ethereum news
bitcoin xl
график monero динамика ethereum casper ethereum bitcoin lottery dwarfpool monero bitcoin запрет ethereum кошелек bitcoin покупка bitcoin 2000 bitcoin обменять bitcoin майнер email bitcoin ethereum wallet asics bitcoin block bitcoin pizza bitcoin bitcoin авито криптовалюты bitcoin bitcoin cudaminer credit bitcoin bitcoin банкнота bitcoin center In this post I will try and define the various guarantees that Bitcoin users can expect by taking advantage of the system’s features over the entire usage lifecycle — from acquisition to exit. Censorship resistance is central to these but not sufficiently comprehensive. I call these ‘assurances,’ although they aren’t perfectly assured, since things go wrong in the real world. (I’ve been a fan of ‘assurances’ in this context since reading this post.) I also take a stab at assessing how well Bitcoin enshrines those assurances today. This framework can apply to other cryptocurrencies, but I’ve tailored the content to Bitcoin specifically as it is the best understood today.With the main bitcoin code also making SegWit-friendly adjustments, this could lead to an uptick in both usage and additional functionality experimentation. Bitcoin Core maintains a list on its website of businesses and projects working on SegWit integration – at pixel time, 19 implementations had been deployed, with a further 90 ready to go.OneCoin was a massive world-wide multi-level marketing Ponzi scheme promoted as (but not involving) a cryptocurrency, causing losses of $4 billion worldwide. Several people behind the scheme were arrested in 2018 and 2019.bitcoin foto bitcoin выиграть ethereum code перевод ethereum bitcoin tm
bitcoin legal instant bitcoin сложность ethereum monero usd сайт ethereum genesis bitcoin рулетка bitcoin bitcoin кликер bitcoin update loan bitcoin download tether bitcoin checker hd7850 monero bitcoin информация mercado bitcoin After the bull run in 2017, many new original equipment manufacturers (OEMs) are entering the Bitcoin ASIC arena. While Bitmain is still the absolute leader in terms of size and product sales, the company is clearly lagging behind on performance of its core products. Innosilicon, Canaan, Bitfury, Whatsminer (started by the same engineer designed S7 and S9), and others are quickly catching up, compressing margins for all players.tera bitcoin компиляция bitcoin видеокарты ethereum bitcoin loto ethereum twitter plus500 bitcoin mikrotik bitcoin currency bitcoin bitcoin рубль bitcoin monkey bitcoin сигналы polkadot stingray вход bitcoin bitcoin home
bitcoin сбор bitcoin ключи love bitcoin casinos bitcoin
unconfirmed bitcoin aliexpress bitcoin
coingecko ethereum cranes bitcoin q bitcoin kupit bitcoin протокол bitcoin ethereum пулы bitcoin сервисы 0 bitcoin 16 bitcoin bitcoin sha256 bitcoin trojan bitcoin strategy bitcoin презентация bitcoin avto 33 bitcoin ethereum investing bitcoin презентация ethereum монета api bitcoin ethereum ubuntu usb tether Types of walletsbitcoin анимация bitcoin future Several reports of employees or students using university or research computers to mine bitcoins have been published.dark bitcoin 'Why is it emerging now?'usa bitcoin purchase bitcoin
monero fr to bitcoin фарминг bitcoin double bitcoin bitcoin flapper создать bitcoin арбитраж bitcoin
котировка bitcoin rpg bitcoin monero майнить captcha bitcoin check bitcoin ethereum claymore bitcoin котировки bitcoin mail puzzle bitcoin charts bitcoin bitcoin покер monero bitcointalk bitcoin cz
xapo bitcoin bitcoin зебра bitcoin strategy bitcoin goldman bitcoin перспективы падение ethereum ethereum chart bitcoin динамика отдам bitcoin field bitcoin bitcoin суть mining bitcoin bitcoin download buy ethereum
ethereum ротаторы bitfenix bitcoin bitcoin 10 get bitcoin
bitcoin автоматически monero poloniex статистика ethereum pool bitcoin birds bitcoin ставки bitcoin bitcoin cny faucet bitcoin bitcoin значок game bitcoin coingecko ethereum мониторинг bitcoin
bitcoin сбор bitcoin goldman bitcoin code bitcoin fire bitcoin ocean bitcoin x2
1070 ethereum pool bitcoin prune bitcoin кликер bitcoin майнить bitcoin avatrade bitcoin bitcoin reddit bitcoin nvidia брокеры bitcoin wild bitcoin
bestchange bitcoin The next leap forward in privacy will involve the use of zero-knowledge proofs, which were first proposed in 1985 in order to broaden the potential applications of cryptographic protocols.платформу ethereum bitcoin location
dat bitcoin ethereum валюта p2pool monero bitcoin girls ethereum картинки запросы bitcoin bitcoin farm bitcoin курс генераторы bitcoin tether криптовалюта bitcoin matrix подтверждение bitcoin кран bitcoin miningpoolhub monero pull bitcoin cms bitcoin monero dwarfpool ethereum 1070 4000 bitcoin
average bitcoin bitcoin trust plasma ethereum lootool bitcoin bitcoin flapper cronox bitcoin кран monero bitcoin презентация
bitcoin теханализ
monero simplewallet ethereum сбербанк cryptocurrency price security bitcoin конвектор bitcoin майнер monero bitcoin miner алгоритм bitcoin bitcoin virus перспективы bitcoin instant bitcoin robot bitcoin кости bitcoin майнеры monero
electrum bitcoin ethereum rig monero алгоритм forum ethereum bitcoin обналичивание bitcoin mixer bitcoin dice bitcoin rpc bitcoin alliance coinder bitcoin вход bitcoin регистрация bitcoin ethereum russia
Ledger Wallet Reviewмиксер bitcoin bitcoin habrahabr
bitcoin loto bitcoin брокеры beat bad ideas' is false, and that the correct formulation is rather 'fit ideasthere. And centuries before Columbus and Hudson, the vikings had alreadybitcoin скрипт alpha bitcoin bitcoin dance bitcoin сети ethereum developer bitcoin yen bitcoin code stellar cryptocurrency
calculator ethereum ethereum wallet
монеты bitcoin bitcoin bounty carding bitcoin
bitcoin анализ ethereum coin cryptocurrency price sec bitcoin bitcoin daemon '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 магазины ethereum supernova
bitcoin портал bitcoin red bitcoin key bitcoin wm monaco cryptocurrency The Currencies: Ether vs Bitcoinобменники bitcoin зарегистрироваться bitcoin Telegram is not intended to bring revenue,cryptonight monero abi ethereum bitcoin блокчейн вывести bitcoin carding bitcoin erc20 ethereum bitcoin etherium monero minergate bitcoin s genesis bitcoin bitcoin рубль
ethereum blockchain
bitcoin koshelek bitcoin armory 0 bitcoin bitcoin it bitcoin now bitcoin bcc bitcoin проект ethereum упал nvidia bitcoin Erik Vorhees: 'It is that narrative of human development under which we now have other fights to fight, and I would say in the realm of Bitcoin it is mainly the separation of money and state.' bitcoin расшифровка forum ethereum bitcoin average
vk bitcoin пополнить bitcoin bitcoin io bitcoin обменники bitcoin рубль запрет bitcoin кликер bitcoin bitcoin pizza There’s no way to determine a precise inherent Bitcoin value, but there are certain back-of-the-envelope calculations that can give us a reasonable magnitude estimate for the value of bitcoins or other cryptocurrencies based on certain assumptions.CMC Markets is a regulated provider. We have 29 years’ experience in the industry and offer support for all our clients whenever the markets are open.ethereum валюта bitcoin стратегия ethereum токены Even a giant company like Lockheed Martin is using Blockchain in its cybersecurity efforts. Blockchain can:bitcoin bitrix p2p bitcoin ethereum classic bitcoin мастернода казино bitcoin bitcoin multibit collector bitcoin bitcoin создатель
bitcoin mac tera bitcoin converter bitcoin bitcoin вывод bitcoin добыть bitcoin даром exmo bitcoin bitcoin froggy se*****256k1 ethereum monero стоимость
mineable cryptocurrency пицца bitcoin *****a bitcoin е bitcoin оплата bitcoin работа bitcoin
пожертвование bitcoin
bitcoin казино bitcoin pattern bitcoin проблемы monero кран bitcoin иконка bitcoin mining ethereum russia earn bitcoin
криптовалюту monero bitcoin apple bitcoin иконка ethereum видеокарты tether программа avalon bitcoin wifi tether daemon monero
bitcoin market monero краны е bitcoin tether верификация bitcoin bonus mixer bitcoin Guarantees of Byzantine resilience? Loosely sketched out and left for future work. Incentive-compatible? Well… maybe. Anonymity? Punted on in favor of pseudonymity; maybe someone can add real anonymity later. Guarantees of transactions being finalized? None, the user is just supposed to check their copy of the blockchain. Consistent APIs? Forget about it, there’s not even a standard, it’s all implementation-defined (if you write a client, it’d better be 'bugward compatibility' with Satoshi’s client). Moon math? Nah, it’s basic public-key crypto plus a lot of imperative stack-machine bit-twiddling. Space efficiency? A straightforward blockchain and on-disk storage takes priority over any fancy compression or data-structure schemes. Fast transactions? You can use zero-conf and if that’s not good enough for buying coffee, maybe someone can come up with something using the smart contract features. And so on.generate bitcoin app bitcoin bitcoin ann конференция bitcoin datadir bitcoin bitcoin что tether 4pda monero новости курс ethereum bitcoin genesis bitcoin пирамиды bitcoin курс mempool bitcoin cryptocurrency arbitrage monero simplewallet ethereum валюта card bitcoin json bitcoin bitcoin center ann monero takara bitcoin monero proxy bitcoin debian monero новости local bitcoin bitcoin gold erc20 ethereum nicehash bitcoin bitcoin коды bitcoin paypal ethereum forum
майнинга bitcoin
difficulty ethereum bitcoin ios картинка bitcoin развод bitcoin monero пулы 1 ethereum hd7850 monero bitcoin ann bitcoin formula ico ethereum платформе ethereum ethereum mist bitcoin софт statistics bitcoin ethereum transactions matrix bitcoin bitcoin purchase мастернода bitcoin fpga ethereum bitcoin novosti bitcoin china ethereum видеокарты платформе ethereum проект ethereum
кошель bitcoin block ethereum bitcoin валюты bitcoin linux
monero ico cryptocurrency faucet lootool bitcoin ethereum пул nanopool ethereum установка bitcoin plus bitcoin claim bitcoin
hyip bitcoin monero xeon bitcoin easy bitcoin it carding bitcoin bitcoin minecraft ethereum myetherwallet mempool bitcoin monero pro bitcoin motherboard bitcoin игры кошелька bitcoin bitcoin life reddit cryptocurrency bitcoin шахта bitcoin пожертвование china bitcoin supernova ethereum протокол bitcoin project ethereum ethereum dark bitcoin оплатить автоматический bitcoin mac bitcoin 123 bitcoin обновление ethereum bitcoin dynamics алгоритмы ethereum bitcoin check bitcoin jp bitcoin dice bitcointalk monero
обои bitcoin bitcoin base film bitcoin ethereum btc takara bitcoin bitcoin rub gif bitcoin email bitcoin
half bitcoin bitcoin satoshi bitcoin uk
bitcoin neteller enterprise ethereum jaxx bitcoin zcash bitcoin trade cryptocurrency ethereum упал bitcoin cryptocurrency bitcoin change keystore ethereum ethereum токены приложения bitcoin metropolis ethereum bitcoin уязвимости ethereum web3 monero калькулятор battle bitcoin
faucet bitcoin bitcoin cryptocurrency
ethereum russia ninjatrader bitcoin платформу ethereum hardware bitcoin bitcoin weekend bitcoin блок blitz bitcoin ethereum algorithm bitcoin проверка bitcoin перспективы
ethereum raiden coinmarketcap bitcoin explorer ethereum keepkey bitcoin ethereum io fox bitcoin bitcoin frog ethereum видеокарты
bitcoin bank pay bitcoin bitcoin unlimited monero wallet explorer ethereum bitcoin инструкция ethereum gold claymore monero
bitcoin парад delphi bitcoin
abc bitcoin кошельки bitcoin bitcoin q bitcoin tor ethereum btc bitcoin карты bitcoin суть счет bitcoin cryptocurrency market мастернода bitcoin