💡Ethereum Virtual Machine (EVM) Concepts:

· Accounts types
· Transactions
· Gas
· Storage
· Memory
· Stack
· Stack complex operations
· Instruction Set
· Message Calls
· Delegatecall
· Logs
· Create calls
· Self-destruct
· Deactivate and
· Precompiled Contracts

ACCOUNT TYPES:

- External accounts: controlled by public-private key pairs, address determined from the public key.

- Contract accounts: controlled by the code stored with the account, address determined at the creation time.
TRANSACTIONS

Messages sent from one account to another one

It can include:
- Binary data (payload)
- Ether

If the target account contains code, that code is executed. The payload is provided as input data.

If the target account is not set, a new contract is created.
GAS

A transaction is charged with gas.

First, a gas price is set by the creator, at gas_price * gas cost.

If some gas is left after the execution, it's refunded.

If the gas is used up at any point, an exception is triggered, and all the modifications are reverted.
STORAGE

It's a key-value store that maps 256-bit words to 256-bit words.

Each account has persistent storage between function calls and transactions.

It's not possible to enumerate storage from within a contract, it's costly to read, and even more to initialize and modify it.
MEMORY

Contract's space instance for each message call.

Memory can be addressed at byte level:
- Reads are limited to 256 bits
- Writes can be 8 bits or 256 bits

Memory is expanded on access by a 256-bit, the gas cost must be paid at expansions time (it scales quadratically).
STACK

The EVM is a stack machine: all computations are performed on a data area (the stack).

Maximum size of 1024 elements with 256-bits words

Possible actions:
- copy one of the topmost 16 elements to the top of the stack
- swap the topmost element with one of the 16 below.
STACK COMPLEX OPERATIONS

Other operations take the topmost 2 elements from the stack and push the result onto it.

Stack elements can be moved to storage/memory to get deeper access

It's not possible to just access arbitrary elements in the stack without first removing the top
INSTRUCTION SET

All instructions operate on 256-bit words, or on memory slices.

Arithmetic, bit, logical, comparison operations are present.

Conditional/unconditional jumps are possible.

Contracts can access relevant properties of the current block (number, timestamp, ...).
MESSAGE CALLS

Similarly transactions, they have:
- source
- target
- data
- payload
- Ether
- gas
- return data

A transaction is a top-level msg call that can create further message calls.

Contracts can call other contracts or send Ether to non-contract accounts with msg calls
DELEGATECALL

It's a msg call variant, BUT:
- target address code executed on calling the contract context
- msg.sender/msg.value don't change values

A contract can dynamically load code from a different address at runtime

Storage, address, balance refer to the calling contract
LOGS

Data can be stored in a specially indexed data structure that maps all the way up to the block level.

Contracts cannot access log data after creation, but they can be efficiently accessed from outside the blockchain.

This feature is used by Solidity to implement events.
CREATE CALLS

Contracts can create other contracts using a special opcode.

Differences between create calls and normal message calls:
- the payload data is executed
- the result is stored as code
- the caller/creator receives the address of the new contract on the stack
SELF DESTRUCT

Operation on contract's address to remove code from the blockchain

- the Ether is sent to a designated target
- storage and code are removed from the state

Removing the contract is dangerous: if someone sends Ether to removed contracts, the Ether is lost.
DEACTIVATE

If you want to deactivate your contracts, you should instead disable them by changing some internal state which causes all functions to revert. This makes it impossible to use the contract, as it returns Ether immediately.
PRECOMPILED CONTRACTS

Contract addresses with ranges 1-8 are special.

They can be called like any other contract, but their behavior and gas cost is not defined by EVM code stored at that address but implemented in the EVM execution environment itself.

Src: Solidity docs.
if this has been useful, consider following @FrancescoCiull4 and sharing this thread

• • •

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

Keep Current with Francesco Ciulla

Francesco Ciulla 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 @FrancescoCiull4

1 Jan
Why a framework for DAPPS?

To have a feature out of the box, so we can focus on development.

There's a trade-off between the simplicity of a framework and the dependency it causes.

In the thread below, I've checked 10 of them.

⚠Remember to focus on the project, NOT the tool Image
TRUFFLE

Truffle is a development environment, testing framework, and asset pipeline for blockchains using EVM (Ethereum Virtual Machine)

The GitHub repository is very active and it has more than 12k stars and 2k forks.
github.com/trufflesuite/t…
HARDHAT

Hardhat is an Ethereum development environment for professionals. It's written in Typescript and it uses a plugin system.

The GitHub repository has 2.2k stars and 500 forks
github.com/nomiclabs/hard…
Read 13 tweets
31 Dec 21
Thank you to all the @portainerio team and for the collaborations during 2021

Special Thanks to @hrittikhere, we made amazing live streams together!

You can see a recap of all videos with the team below.

Oh and thank you for the nice SWAG!👕🖊🧦📘
How to install Portainer with Docker.

This has been the very first video, and in 4 minutes, I explain how you can install Portainer using Docker (yes you got it right). Very straightforward video.
Portainer Tech Show

First show with the Portainer Team, I really enjoyed this as it's a relaxed yet interesting chat with the Portainer team.

Guests:
Adolfo Delorenzo
Dimko
Ryan Gray
Read 6 tweets
31 Dec 21
18 people you should follow in 2022.

4 lines for each of them, with what I honestly think about them.

Check them out ↓
Csaba Kissi (@csaba_kissi )

Csaba is super talented and tweets about web development, color associations for websites. He is also a master of side projects, you should really check them!
Sumudu (@sumusiriwardana )

One of the kindest people on Twitter. She is PM at Hashnode and Developer Advocate at Dasha. Introverted like me, but when she will start for real she will become unstoppable, I am sure about that.
Read 19 tweets
27 Dec 21
🐳Docker Architecture thread.

Docker uses a client-server architecture.

The Docker client talks to the Docker daemon (server), which menages different Docker objects:
- images
- containers
- networks
- volumes

Images (not containers) can be stored in Registries.

/thread
The Docker client and the daemon can run on the same system, or they can be connected remotely using HTTP protocol.

The connection is established using REST APIs, over UNIX sockets/network interfaces.
DOCKER DAEMON (SERVER)

The Docker daemon (dockerd) is a process, which runs in the background, that manages the docker objects (images, containers, networks, volumes).

It processes Docker API requests.
Read 14 tweets
17 Nov 21
Portainer BE version 2.10 is out.

Some massive improvements here📈

☸️Kubernetes support improved by a ton.
↪ Proxy for container environments.
🌓Dark mode is now supported.
💻Kubectl integration.
💾GitOps integration.
🌸UI improvements.
🔐HTTPS support.

/thread @portainerio Portainer in Dark mode
✅Improved UI

The new UI has been redesigned to reduce clutter and be more intuitive, It's now much easier to navigate inside Portainer.

Kubernetes users should feel it very comfortable.
✅Lightweight GitOps integration

Introduced a lightweight GitOps engine: it enables users to employ 'entry level' CD automation' (no expertise needed).

This allows a user to configure the app's updates:
- automatic
- poll-based
- push-based (webhooks)
Read 16 tweets
17 Nov 21
5000 Subscribers on YouTube!!!!!

Thank you for your support 🖤

To celebrate this I want to share what I learned about creating tech videos.

It took me 1.5 years to understand the process!

This is not a perfect one but what I use, and it works for me.

/thread how I creat my tutorials, s...
👣Steps:

·Research
·Test
·Steps
·Re-Test
·Record Demo
·Cut Demo
·Article
·Voiceover
·Edit VoiceOver
·Animations/Blur
·Body Render/Check
·Thumbnail/Green Screen
·Record Outro/Intro
·Body+Intro+Outro
·Edit Intro/outro
·Text/Chapters
·Final render/check
·YT stuff
·Promo

Details↓
1. Research

Before creating my video and article, I document my existing videos on the subject: My main sources are:
- @freeCodeCamp
- @traversymedia
- @dailydotdev

Yes, to create a video I document myself to know as much as possible before starting! ImageImageImage
Read 25 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

Too expensive? 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!

:(