> For the complete documentation index, see [llms.txt](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/basics/3.-evm/evm-3.md).

# EVM과 이더리움 상태 변화의 원리

EVM은 수학적인 함수처럼 작동한다. 즉, 입력이 주어지면 항상 동일한 출력을 생성한다. \
따라서 다음과 같은 상태 전이 함수로 나타낼 수 있다.

```jsx
Y(S, T) = S'
```

* `S`: 이전의 유효한 상태
* `T`: 새로운 유효한 트랜잭션들
* `Y`: 상태 전이 함수
* `S'`: 실행 결과로 만들어진 새로운 유효한 상태

{% hint style="info" %}
상태란?<br>

상태란 거대한 자료 구조다. 상태는 모든 사용자 계정, 잔액, 스마트 계약의 저장소, 코드, 넌스 값을 포함한다. 이 모든 정보는 머클 파트리샤 트라이라는 구조에 들어가 있고 이 구조는 블록체인에 루트 해시 하나로 저장된다.
{% endhint %}

{% hint style="info" %}
트랜잭션이란?<br>

트랜잭션은 말 그대로 사용자의 명령이다. 트랜잭션에는 두 가지 유형이 있다.<br>

1. 메세지 호출 : 기존 스마트 계약을 호출하는 것
2. 계약 생성 : 새로운 스마트 계약을 블록체인에 배포하는 것
   {% endhint %}

[<mark style="background-color:blue;">출처</mark>](https://ethereum.org/en/developers/docs/evm/#the-ethereum-state-transition-function)
