PBL Ⅲ/Ethereum and Solidity

Section1 : 20. Our First Contract~

myejinni 2022. 8. 15. 21:18

20. Our First Contract

 

21. Contract Structure

contract 키워드 = class 키워드와 유사

string 키워드 = 문자열

public 키워드 = who has access to contects

 

22. Function Declarations

 

public: 계정을 가진 모든 사람이 접근 가능

private: 계정주만 접근 가능

payable

 

24.Testing with Remix

 

작성한 contract의 동작 diagram

25.~27. more on running functions than you want to know

 

블록체인에 저장된 데이터를 변경하고 싶다면 transaction을 submit + 마이닝되기까지 기다림

-> 이게 왜 중요한가?

 

setMessage = 블록체인을 바꾸는 것 => 트랜젝션 포함해야 함

getMessage = 블록체인을 바꾸지 않음 => 트랜젝션 포함하지 않아도 됨

 

우리가 정의한 스마트컨트랙에서 함수를 부르기 위한 두 가지 방법이 있음

1. Calling a function

2. sending a transaction to a function : invoke a function that is intended to change some data

 

유저에게 블록타임을 알려주는 것이 필요함 (시간이 걸리기 때문)

*개발 환경 != 실제 환경

 

28. Wei vs Ether

 

cost money means...

=costs some amount of ether to send a transaction to a function

 

units of measurement

구글에 wei converter 검색하면 다른 unit 간 변환할 수 있음

https://converter.murkin.me/

 

29. Gas and Transactions

30. Mnemonic Phrases

Mnemonic => make it a lot easier for you to manage your keys