solidity
Solidity 설치하기
쓰러진복돌이
2024. 3. 25. 14:37
1. 설치하기
1. 우분투
> sudo add-apt-repository ppa:ethereum/ethereum
> sudo apt update
> sudo apt install solc
2. 맥
> brew update
> brew tap ethereum/ethereum
> brew install solidity
2. 컴파일 버전 확인하기
> solc --version
3. 예제코드 작성하기
// 특정위치에서
mkdir hello_solidity
cd hello_solidity
hello_solidity/lecture/lec1.sol
// hello_solidity/lecture/lec1.sol 하단 전체 작성
// SPDX-License-Identifier GPL-30 // 프로젝트에서 사용되는 라이센스 식별자
// SPDX-License-Identifier: MIT // 프로젝트에서 사용되는 라이센스 식별자
pragma solidity >= 0.7.0 < 0.9.0;
contract Hello{
string public hi = "Hello soliditiy";
}
4. 솔리디티 코드 컴파일
> solc --optimize --bin lecture/lec1.sol
5. solc를 통한 ABI 생성
- ABI(Application Binary Interface)는 스마트 컨트랙트 코드에 대한 설명이 담긴 JSON 형식의 인터페이스
solc --abi lecture/lec1.sol