Hello Solidity, 솔리디티 강좌 2. 데이터 타입과 이더, 가스

cth.release·2024년 7월 15일

Solidity

목록 보기
2/2
post-thumbnail

자, 오늘은 간단하게 데이터 타입과, 이더(ether), 가스(gas) 에 대해서 알아보도록 하겠다.

데이터 타입

    string public hello = "Hello, World!";
    
    bool public bool1 = true; // true or false
    
    // ! || == && 를 사용할 수 있음.
    bool public bool2 = !false;
    bool public bool3 = false || true;
    bool public bool4 = false == true;
    bool public bool5 = false && true;

    // address <-- 지갑 주소나 이더리움 주소 등등 주소를 나타낼 때 사용함
    address public addr = 0xD4Fc541236927E2EAf8F27606bD7309C1Fc2cbee;

    // bytes
    bytes public bt = "0x1";
    bytes4 public bt4 = 0x12345678;

    // int, uint
    int public it1 = 0;
    uint8 public it2 = 1;
    uint256 public it3 = 2;

가스? 이더? wei? gwei?

스마트 컨트랙을 사용할 때, 비용이 상출이 되는데 개발자가 스마트컨트렉을 얼마나 길게 만들었는지에 따라 결정된다.

// 1 ether = 10^9 Gwei = 10 ^ 18 = wei
// 0.00000000000000001 ether = 1 ^- 18 = 1 wei
// 0.01 ether = 10 ^ 16 wei

아래 링크 27페이지에서 얼마나 소모 되는지 자세하게 적혀있다.
https://ethereum.github.io/yellowpaper/paper.pdf

profile
그냥 뭐.... 개발자에요

0개의 댓글