‘이더리움 댑 개발’ 세미나 보조 교재 – Learn Ethereum 2

이번 함께 읽기에서는 Section 2: Blockchain Development Cycle을 정리합니다.

  • Chapter 4, Solidity Fundamentals
  • Chapter 5, Developing Your Own Cryptocurrency

Solidity Fundamental

대부분 이미 세미나에서 다룬 내용들입니다. 전체적으로 빠르게 복습 차원에서 한 번 읽습니다.

아래 인용한 본문 내용을 다시 한 번 주의 깊게 읽어 봅니다.

  • All the data with reference types need to explicitly define a data location where the reference type data is stored.
    • Arrays, structs, and mappings in Solidity are reference types.
    • There are three data locations defined in Solidity, as follows:
      • Memory: Its lifetime is limited to a function call
      • Storage: The storage where the state variables are stored
      • Calldata: This is only available for external function call parameters and is used as a special data location that contains the function arguments
    • 데이터 위치가 다른 변수들 사이에는 복사가 일어납니다. 메모리와 메모리, 스토리지와 로컬 스토리지 사이에는 참조가 일어납니다.
    • When interacting with smart contracts on the Ethereum blockchain, the Ethereum web3 API or JSON-API interface uses the contract’s application binary interface (ABI) as the standard way to encode and decode the methods we call, as well as the input and output data. The same applies to calls from outside of the blockchain and calls between contracts. Data is encoded according to its type, as described in the ABI specification.
    • 컨트랙트 함수가 호출 될 때 함수 selector를 생성하고, 함수 인자들은 ABI로 인코딩(바이트 배열)해서 결합합니다.
      • 함수 selector는 함수 signature의 keccak256 해시의 4바이트로 계산됩니다.
      • This data is then sent to the contract address on the blockchain, which is able to decode the arguments and execute the smart contract code within the EVM.

Designing the decentralized digital art marketplace

ERC721 토큰이 구체적으로 어떻게 사용되는지 아는 것에 집중하도록 합니다. 이번 장은 ERC721로 프로젝트를 하게 될 때 도움이 될 것임으로 참고할 수 있도록 기억해 둡니다. 소스 코드 

아래 정리한 내용은 주의를 기울여 다시 한 번 읽어 봅니다.

  • digital art marketplace에서 가장 먼저 해야 할 일은 digital art 토큰을 발행하고 digital art 정보를 등록하고 판매를 시작하는 것입니다.
  • 판매상태에 있는 토큰은 구매(buyArt)할 수 있습니다. 이더리움 블록체인에서 실행되는 것이니 구매는 이더로 합니다. buyArt 함수는 payable이 되어야 합니다. 이더로 digital art에 대한 비용이 지급되고 토큰이 전송됩니다.  
  • 구매한 digital art를 새로운 판매 가격에 다시 판매(resellArt)할 수 있습니다.
About the Author
(주)뉴테크프라임 대표 김현남입니다. 저에 대해 좀 더 알기를 원하시는 분은 아래 링크를 참조하세요. http://www.umlcert.com/kimhn/

Leave a Reply

*