이더리움 어카운트

이동규 (Justin)·2023년 5월 30일
0

ERC-20 명세를 알아보던 중, balanceOf에서 밸런스라는게 컨트랙트에 귀속된 정보라는 것은 알겠는데, 컨트랙트가 하나의 어카운트로 생각되는 것이 헷갈린다(?)는 생각이 들어 돌아오게 되었다.

An Ethereum account is an entity with an ether balance
that can send transactions on Ethereum.

이더리움으로 트랜잭션을 송신할 수 있는, 이더 밸런스를 가진 'entity' 이다.

Accounts can be user-controlled or deployed as smart contracts.

이 부분이 중요하다. 'account' 라고 하면 '계정' 정도로 해석해서 인식하는데, 그렇다면 어느 사람에게 귀속된 정보로 생각하게 되지만 이더리움 어카운트는 'can be deployed as smart contracts' 이다. 스마트 컨트랙트로서 배포될 수도 있다는 말이다.

Ethereum has two account types:

  • EOA, Externally Owned Account - controlled by anyone with the private keys
  • Contract account - a smart contract deployed to the network, controlled by code.

어카운트가 무엇에 의해 컨트롤되느냐, private key를 가진 누군가이냐 아니면 코드이냐, 에 따라 EOA와 컨트랙트 어카운트로 구분될 수 있다.

Both account types have the ability to

  • Receive, hold and send ETH and tokens
  • Interact with deployed smart contracts

토큰을 받고, 밸런스에 저장하고, 보낼 수 있다. 스마트 컨트랙트(=다른 어카운트)와 소통할 수 있다.

그럼 차이점은?

  1. Externally-owned
  • Creating an account costs nothing
  • Can initiate transactions
  • Transactions btw EOA can only be ETH/token transfers
  • Made up of a cryptographic pair of keys: public and private keys that control account activities
  1. Contract
  • Creating a contract has a cost because you're using network(Ethereum Blockchain) storage
  • Can only send transactions in response to receiving a transaction
  • Transactions from an external account to a contract account can trigger code which can execute many different actions, such as transferring tokens or even creating a new contract (Factory!)
  • Contract accounts don't have private keys. Instead, they are controlled by the logic of the smart contract code.

그렇다.

그리고 account는 네개의 정보로 구성된다.

  • nonce
  • balance
  • codeHash
  • storageRoot

..더 자세한 정보는 아래를 읽자.

https://ethereum.org/en/developers/docs/accounts/

profile
Frontend Developer, JamStack, Ethereum

0개의 댓글