Haym Salomon Profile picture
Sep 9 19 tweets 8 min read
(1/18) @ethereum Fundamentals: Transactions

Sent $ETH? LP'ed into an AMM? Deployed a new contract? Everything you do on the World Computer leaves an on-chain record. Ever wonder what's inside your transactions?

A field-by-field guide to the atomic unit of Ethereum computing
(2/18) @ethereum is the World Computer: a globally shared utility that exists between a network of 1000s of computers

Users interact with Ethereum through a wallet (like @MetaMask), which creates and sends txns to the network. Once accepted, the txns are written into a block.
(3/18) Perquisite - hashing, (applying a hash function)

Hash function: a piece of code used to transform any amount of data into a compact, uniform value. The input can be of arbitrary length but the output is always the same length.

(Good) hash functions are non-reversible.
(4/18) An @ethereum transaction is made of up 3 parts:

- metadata, including to/from, $ETH amount, gas details and signature data
- cache, a list of accounts and keys the transaction expects to use
- data, the payload of the transaction (smart contract code or API call)
(5/18) Metadata - information about the transaction

The attached images show all the metadata fields. We will discuss the non-obvious ones in the tweets below.
(6/18) chainId - introduced by EIP-155 to protect against an $ETC replay attack

type - there are two types: a new contract (0x0) and all others (0x2). EIP-2718 introduced a wrapper (0x2) that allows for many more types without affecting the core @ethereum specs
(7/18) nonce - number of transactions sent from a given address. Once imprinted on a block, the wallet's nonce is increased. Protects against replay attacks

to - address (wallet or smart contract) the transaction is being sent to
(8/18) value - amount of $ETH being transferred. Note - this is ONLY for $ETH (no other token)

gas - units of gas used by the transaction

maxFeePerGas - maximum amount (WEI per gas) the user who created the transaction is willing to pay. Inclusive of base fee and priority fee
(9/18) maxPriorityFeePerGas - maximum amount (WEI per gas) above the base fee the user who created the transaction is willing to pay. This fee will be paid directly to the miner/validator as a tip to incentive inclusion.

gasPrice - cost per unit of gas paid by this transaction
(10/18) (r, s, v) - three values that form the signature of the user who created the transaction. They can be used to verify that the user authorized the transaction before it was executed in the EVM

For more information, see: Elliptic Curve Digital Signature Algorithm (ECDSA)
(11/18) Cache - contains the accessList, a list of addresses and keys the transaction anticipates using. The transaction will still be able to use resources off this list, but at a higher cost.
(12/18) The accessList was added by EIP-2929, allowing clients to fetch/cache data to be used during the transaction.

Today, the discount for using addresses & keys in the accessList is ~10%. However, this will increase in the future as @ethereum moves to support light clients.
(13/18) Data - the data payload being delivered by the transaction. This can be used in 3 ways:

- $ETH transfer - empty

- smart contract API call - name of function and parameters

- new smart contract - code of the smart contract
(14/18) Data in the input field is recorded in binary, but can be translated back to a human readable form.
(15/18) The input field exists on-chain, but is not part of the EVM state. It simply provides data for the contract to use during the transaction, it is not tracked by @ethereum nor used in consensus.

The EVM can only use data supplied in that transaction; it cannot look back.
(16/18) This property becomes useful for applications that want to write historical data to the @ethereum blockchain (eg for manual retrieval later) but don't care about having direct EVM access.

Rollups are the first category of applications to truly leverage this idea.
(17/18) We will cover rollups another time. For now, rollups rely on the fact that writing data into the input field is cheaper than writing directly into the @ethereum state.

This allows rollups to execute much more efficiently while still posting a record of all txns on-chain.
(18/18) And there you have it! That's an @ethereum transaction!
Like what you read? Help me spread the word by retweeting the thread (linked below).

Follow me for more explainers and as much alpha as I can possibly serve.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Haym Salomon

Haym Salomon Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @SalomonCrypto

Sep 11
(1/19) Blockchain Scaling: Plasma

First there were state channels. There there was Plasma, the first persistent-state scaling solution that settled to @ethereum.

Your guide to the precursor to modern blockchain scaling. Image
(2/19) In 2008, Satoshi Nakamoto gave us @Bitcoin and introduced the dream.

In 2015, @VitalikButerin gave us @ethereum and delivered on that dream: the World Computer was born.

In its early years, the World Computer is painfully slow. Fortunately, we have scaling solutions.
(3/19) The first category: state channels.

To open a channel, the participating parties fund a smart contract where the funds are held in on-chain-escrow. The participants can transact off-chain as much as they want. When finished, the smart contract settles channel.
Read 20 tweets
Sep 10
(1/14) Blockchain Scaling: State Channels

@Bitcoin, @ethereum and all (good) blockchain computers share one important quality: they are SLOW. State channels are the first attempt at changing this and bringing blockchain to scale.

Your guide to the original scaling tech. Image
(2/14) In 2008, Satoshi Nakamoto created blockchain technology, changing the world forever.

The purpose: to create a shared, untrusted computing platform. A public utility, usable by all... at any time... for any reason.
(3/14) The foundation of Blockchain computers is decentralization: more centralization requires more trust assumptions.

In order to maintain decentralization, we must ensure that a wide spectrum of machines are capable of participating.
Read 15 tweets
Sep 9
(1/21) @ethereum Fundamentals: PoS Blocks

In less than 1 week, the Ethereum blockchain will Merge with the Beacon Chain and the World Computer will transition from PoW to PoS. The blockchain will never be the same.

A field-by-field guide to on-chain future. Image
(2/21) @ethereum is the World Computer: a globally shared utility that exists between a network of 1000s of computers, each running a local version of the Ethereum Virtual Machine (EVM).

From genesis in 2015 until now, Ethereum has coordinated with a system called Proof of Work.
(3/21) In a few days, the @ethereum blockchain will Merge with the Beacon Chain, creating the new canonical PoS $ETH.

As the name "The Merge" suggests, Ethereum blocks will be a combination of the old blocks (execution layer) and the new Beacon Chain blocks (consensus layer). Image
Read 22 tweets
Sep 9
(1/18) @ethereum Fundamentals: PoW Blocks

Every ~15 seconds a new $ETH block is born... ever wondered what's inside?

A field-by-field guide to the building blocks that make up the blockchain. Image
(2/18) @ethereum is the World Computer: a globally shared utility that exists between a network of 1000s of computers, each running a local version of the Ethereum Virtual Machine (EVM)

These nodes coordinate and sync their actions by building, proposing and distributing blocks
(3/18) Prerequisite - Merkle Trees

Merkle Tree: data structure used to organize and encrypt huge data sets. Merkle Proofs can be used to efficiently verify that data exists in a dataset (confirmation a piece of data exists without transferring the whole dataset).
Read 19 tweets
Sep 7
(1/13) Computer Science 201: Merkle Trees and Merkle Proofs

If you want to understand @Bitcoin, @ethereum and blockchain technology, you need to learn:

- How a Merkle trees expresses a large dataset
- How a Merkle proof works
- Why a Markle tree is so efficient Image
(2/13) Hashing - applying a hash function - takes data (of arbitrary contents and size) and reduces it to a unique, compact string.

Every input produces a unique output, even if two inputs are nearly identical.
(3/13) A Merkle Tree uses hashing to build a data structure that allows for quick, efficient, verifiable proof that a transaction was included in a much larger data set.

Also called a hash tree, they are named after Ralph Merkle (who proposed them in 1987).
Read 14 tweets
Sep 7
(1/7) Computer Science 101: Hash Functions

What is a hash function? What are the characteristics of a good hash function? Where do hash functions appear and why do I hear about them all the time?

If you want to understand the fundamental tool of crypto, this guide is for you!
(2/7) The purpose of a hash function is to transform any amount of data into a compact, uniform value. The input can be of arbitrary length but the output is always the same length.

The length is decided by the hash function; it can be as small or large as desired.
(3/7) Hash functions have many different uses, but all uses rely on the same fundamental properties:

- quick and efficient to compute
- outputs should be randomly distributed between all possible outputs
- difficult (if not impossible) to reverse engineer an input from an output
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(