diff --git a/_posts/2024-12-13-geth-command.md b/_posts/2024-12-13-geth-command.md new file mode 100644 index 0000000..df72dea --- /dev/null +++ b/_posts/2024-12-13-geth-command.md @@ -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번 계좌로 설정되어 있기 때문임. \ No newline at end of file diff --git a/_posts/2024-12-13-install-solidity.md b/_posts/2024-12-13-install-solidity.md new file mode 100644 index 0000000..6720e5b --- /dev/null +++ b/_posts/2024-12-13-install-solidity.md @@ -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; + } +} +``` + diff --git a/_posts/2024-12-13-private-ethereum-network.md b/_posts/2024-12-13-private-ethereum-network.md index ed7a5e0..492c681 100644 --- a/_posts/2024-12-13-private-ethereum-network.md +++ b/_posts/2024-12-13-private-ethereum-network.md @@ -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 실행하기 diff --git a/assets/img/2024-12-13-geth-command/0.png b/assets/img/2024-12-13-geth-command/0.png new file mode 100644 index 0000000..3185a81 Binary files /dev/null and b/assets/img/2024-12-13-geth-command/0.png differ