Skip to content

Commit

Permalink
add: 1-4강 geth, solidity 기본
Browse files Browse the repository at this point in the history
  • Loading branch information
5jisoo committed Dec 13, 2024
1 parent 24cdffb commit 3d30e03
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
52 changes: 52 additions & 0 deletions _posts/2024-12-13-geth-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Geth 기본 명령어
date: 2024-12-13 20:42:00 +/-TTTT
categories: [Security, Blockchain]
tags: [security, blockchain, geth]
math: true
---

## Ethereum 실행하기

```shell
% geth --datadir {경로} console
```

## Geth에서 자주 쓰이는 명령어

### 계좌 정보

모든 계좌 확인하기
```
> eth.accounts
```

특정 계좌 확인하기
```
> eth.accounts[숫자]
```

잔고 확인하기
```
> eth.getBalance(eth.accounts[숫자])
```

### 계좌 잠금을 풀 때

```
> personal.unlockAccount(eth.accounts[숫자])
> personal.unlockAccount(eth.accounts[숫자], "기존 비밀번호")
```

### 채굴

```
> miner.start()
> miner.stop()
```

채굴 전엔 잔액이 0이었으나, 채굴 후엔 아래 사진과 같이 잔액이 늘어난 것을 확인할 수 있음.

![img](/assets/img/2024-12-13-geth-command/0.png){: w="500" }{: .shadow }

- 0번째 계좌만 잔액이 늘어난 이유는 기본 계좌가 0번 계좌로 설정되어 있기 때문임.
32 changes: 32 additions & 0 deletions _posts/2024-12-13-install-solidity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Solidity 설치하기
date: 2024-12-13 19:19:00 +/-TTTT
categories: [Security, Blockchain]
tags: [security, blockchain, solidity, ethereum]
math: true
---

## Solidity Compiler 설치하기

npm을 이용하여 설치해보자.

```shell
% sudo npm install -g solc
```

## 프로그래밍 예제

> VSC에서 `hello.sol` 파일을 만들고 프로그래밍 해보자.
```
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
contract hello{
string message = "Hello world!";
function showMsg() public view returns (string memory){
return message;
}
}
```

2 changes: 1 addition & 1 deletion _posts/2024-12-13-private-ethereum-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ INFO [12-13|19:00:41.038] Exported existing genesis block
### Genesis Block 생성하기
```shell
% geth --datadir {경로} init {json 파일 위치}
% geth --datadir {경로} init {경로/파일이름.json}
```
### Ethereum 실행하기
Expand Down
Binary file added assets/img/2024-12-13-geth-command/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3d30e03

Please sign in to comment.