티스토리 뷰
이거 재밌다.
Blockchain and Smart Contract Development Courses - Cyfrin Updraft
Cyfrin Updraft offers the best Blockchain and Smart Contract Developer Courses. Learn Solidity, Foundry, Auditing, Security. Start your Web3 career. 100% Free.
www.cyfrin.io
솔리디티 기본 강좌를 듣기 시작했다.
유튜브에서도 유명한 강의같다.
회원가입할 때 지갑 인증도 있다. 근본같아...
코스 마치고 추가로 내가 퀴즈 풀면 NFT 받나보다.
Repetition is the mother of skill.
Remix - Ethereum IDE
remix.ethereum.org
여기서 코딩해 보면 되겠다.
여기는 컴파일링 하는것까지 다 있고 해서 좋네~ 연습하고 공부하기 좋겠다.
컨트랙트를 컴파일한다는 것은?
> It converts the Solidity code into bytecode and ABI(Application Binary Interface) that can be understood and executed by the Ethereum Virtual Machine (EVM).
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19; // Solidity version
contract SimpleStorage {
// favorite number will be initialized to 0 if no value is given
uint256 public favoriteNumber;
function store(uint256 _favoriteNumber) public {
favoriteNumber = _favoriteNumber;
}
}
이렇게 작성하고, 컴파일 한다.

파란색 compile 버튼을 누르면 된다. 컴파일 되면 왼편에 초록색 체크가 뜬다.
그 밑에 버튼 이더리움 아이콘을 누르면 Deploy & Run Transactions 섹션으로 넘어간다.

Deployed Contracts 에서 내가 좋아하는 숫자를 저장하고, 확인도 할 수 있다. 변수를 public으로 visibility 설정을 해 뒀기 때문이다.
public으로 명시해 두지 않으면 디폴트로 internal 이라서, 저기 보이는 favoriteNum... 이 버튼이 생기지 않는다.
calldata/ memory/ storage
// calldata, memory, storage
function addPerson(string memory _name, uint256 _favoriteNumber) public {
_name = "cat";
listOfPeople.push(Person(_favoriteNumber, _name));
}
메모리로 올리면 값 변경이 된다.
그런데 calldata로 올리면 변경이 안된다.
위의 코드는 valid, 하지만 아래의 코드는 컴파일 되지 않는다.
// calldata, memory, storage
function addPerson(string calldata _name, uint256 _favoriteNumber) public {
_name = "cat";
listOfPeople.push(Person(_favoriteNumber, _name));
}
calldata is a temporary variable that cannot be modified, whereas a memory variable is a temporary one that can be modified.
And storage is a permanent variable that can be modified.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19; // Solidity version
contract SimpleStorage {
// favorite number will be initialized to 0 if no value is given
uint256 myFavoriteNumber;
//uint256[] listOfFavoriteNumbers;
struct Person {
uint256 favoriteNumber;
string name;
}
// dynamic array
Person[] public listOfPeople; // []
// chelsea -> 232
mapping(string => uint256) public nameToFavoriteNumber;
function store(uint256 _favoriteNumber) public {
myFavoriteNumber = _favoriteNumber;
}
function retreive() public view returns(uint256) {
return myFavoriteNumber;
}
// calldata, memory, storage
function addPerson(string memory _name, uint256 _favoriteNumber) public {
listOfPeople.push(Person(_favoriteNumber, _name));
nameToFavoriteNumber[_name] = _favoriteNumber;
}
}
그리고 MetaMask에 Sepolia Ether 받아서 테스트넷에 배포도 해 보았다.
https://sepolia.etherscan.io/tx/0x70a381bb59c356bb93a5da1daa70dacee09b01f7adc74a5ad89ce47d9e63b459
Sepolia Transaction Hash: 0x70a381bb59... | Etherscan
Call 0x60806040 Method By 0x4920826A...f495c736A | Success | Aug-16-2025 10:29:36 AM (UTC)
sepolia.etherscan.io
신기방기......!!!!!
이더리움 메인넷에 배포하는건 너무 비싸다.
https://cloud.google.com/application/web3/faucet/ethereum/sepolia
Ethereum Sepolia Faucet
Get free Sepolia ETH to deploy smart contracts, debug transactions, and experiment on testnet.
cloud.google.com
여기 가서 배포 경험할 수 있는 세폴리아 이더를 받을 수 있다.
0.05 세폴리아 이더를 받을 수 있다.
어제 새벽 1시 넘어서 알게돼서 신청했는데, 트랜잭션 성공! 했는데 지갑에 안들어와서 돈이 왜 안들어오나~~~ 한 두 시간 기다렸는데도 안돼서 뭐지 뭐지~~ 오늘 아침에 여덟시쯤 눈 뜨자마자 메타마스크 열었는데 여전히 돈 안들어와서~~ 힝구 힝구 하고 있었는데
영화보고 밥먹고 간식먹고 들어와서 저녁 일곱시 반에 확인하니 0.05 세폴리아 이더가 들어와 있었다. 얏호~~~
그래서 바로 배포해 보았다.
리믹스에서 Deploy & Run Transactions의 Environment를 Wallet Connet로 변경하고, 내 지갑하고 연결하면 된다. 나는 메타마스크 쓰니까 메타마스크 세폴리아 돈 있는데랑 연결해 보았다.


디플로이 버튼 누르면 모바일에서 이런 창이 떠서 컨펌 하면 테스트넷에 배포가 된다. 기뻐랑... 뭔가 해 낸 이 기분.... 으갸갸갸...

얍 신난다!
- Total
- Today
- Yesterday
- 세상만사새옹지마
- prettier
- 터틀포인트
- 솔리디티
- DART
- web2web3비교
- setState
- 이더리움
- zksync
- 김영한
- til
- 티스토리챌린지
- vscode
- Flutter
- contains
- 찾아봄
- 플러터
- web3
- 오블완
- 선라이즈 패들보트
- 길리여행
- web2
- 패들보트
- 스파르타코딩클럽
- 길리
- 공부좀열심히해라
- 세폴리아
- 크립토좀비
- 테스트넷
- gili
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |