일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Sass
- 코딩테스트
- Goerlifaucet
- ts-loader
- @debug
- 자바스크립트
- 자료구조
- next-connect
- incentive
- set-cookie
- webpack
- wallet
- CA불러오기
- HTMLFormElement
- next.js
- Codestates
- methoidID
- currentTarget
- 해쉬테이블
- TypeScript
- geth
- Blockchain
- 다중서명계약
- JavaScript
- scss
- S3
- keccak256
- goerli
- 스마트컨트랙트
- 블록체인
- Today
- Total
Minwook’s portfolio
Geth 설치 및 계정생성 본문
1.Geth설치(우분투 20.04v)
Launchpad PPA(Personal Package Archives) 활성화를 위해 아래 코드를 실행합니다
$sudo add-apt-repository -y ppa:ethereum/ethereum
https://itsfoss.com/ppa-guide/ <- 자세한내용은 여기에
Geth를 설치합니다.
$sudo apt-get update
$sudo apt-get install ethereum
설치가 정상적으로 되었는지 버젼을 확인해보겠습니다.
$geth -version
아래와 같이 나오면 출력된다면 성공적으로 설치되었습니다.
Geth
Version: 1.10.23-stable
Git Commit: d...
Architecture: amd64
Go Version: go1.18.5
Operating System: linux
GOPATH=
GOROOT=go
2. Geth계정생성
아래명령어를 입력합니다.
$get account new
계정에서 사용할 비밀번호를 입력합니다.
INFO [08-29|18:53:40.970] Maximum peer count ETH=50 LES=0 total=50
INFO [08-29|18:53:40.970] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
Your new account is locked with a password. Please give a password. Do not forget this password.
Password:
Repeat password:
Your new key was generated
정상적으로 계정이 만들어졌으면 public address와 secret key file의 경로를 알려줍니다.
*비밀번호 / Public address / secret key file 경로는 잊어버리지 않도록 주의합니다!
Public address of the key: 0x..... //주소
Path of the secret key file: /home/users/.ethereum/keystore/UTC--2022-08-29T09-53-52.60..... //키파일 경로
- You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
아래 코드를 통해 자신의 계정리스트를 확인 할 수 있습니다.
$geth account list
users@ubuntu:~$ geth account list
INFO [08-29|20:12:43.567] Maximum peer count ETH=50 LES=0 total=50
INFO [08-29|20:12:43.567] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [08-29|20:12:43.568] Set global gas cap cap=50,000,000
Account #0: {6d...} keystore:///home/users/.ethereum/keystore/UTC--2022-08-29T09-53-52.60...
3. Geth javascript 콘솔실행
$geth console 2> /dev/null --goerli //goerli 테스트서버접속
https://geth.ethereum.org/docs/interface/javascript-console
Ctrl + D 또는 exit를 타이핑하여 콘솔을 종료 할 수 있습니다.
Welcome to the Geth JavaScript console!
instance: Geth/v1.10.23-stable-d901d853/linux-amd64/go1.18.5
at block: 0 (Thu Jan 01 1970 09:00:00 GMT+0900 (KST))
datadir: /home/minwook/.ethereum/goerli
modules: admin:1.0 debug:1.0 engine:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
To exit, press ctrl-d or type exit
>
네트워크 연결확인
> net.listening //연결이 성공적으로 이루어졌다면 true가 출력
네트워크 계정생성
> personal.newAccount();
Passphrase:
Repeat passphrase:
"0x..." //account
계정확인
> eth.accounts;
계정잔고확인
> eth.getBalance(eth.accounts[i]); //eth.accounts의 배열 index를 입력
geth는 콘솔을 열고 주변 노드들에게 block을 받아 동기화 과정을 걸쳐야 잔고를 확인할 수 있습니다.
그러나 동기화과정에는 매우 긴시간이 소요됩니다.
third party API를 사용한다면 동기화하는 과정없이 원격으로 노드에 접근하여 데이터를 받아 올 수 있습니다.
예시코드
users@ubuntu:~$ geth console 2> /dev/null --goerli
Welcome to the Geth JavaScript console!
instance: Geth/v1.10.23-stable-d901d853/linux-amd64/go1.18.5
at block: 0 (Thu Jan 01 1970 09:00:00 GMT+0900 (KST))
datadir: /home/users/.ethereum/goerli
modules: admin:1.0 debug:1.0 engine:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
To exit, press ctrl-d or type exit
> net.listening
true
> eth.accounts
[] //계정이 없으므로 빈배열
> personal.newAccount()
Passphrase:
Repeat passphrase:
"0x..." //계정이 생성됨
> eth.accounts;
["0x..."] //만든계정이 배열안으로 들어가 있음
> eth.getBalance(eth.accounts[0]); //0번째 계정을 조회
0 //잔고
> exit
users@ubuntu:~$
테스트용 ropsten Ether 받는곳
이렇게 생성된 계정을 이더스캔에서 내 계정의 활동과 정보를 검색할 수 있다.
'Codestates 블록체인 부트캠프 6기' 카테고리의 다른 글
Opensea Clone Coding Project 회고 (0) | 2022.10.26 |
---|---|
3인조직 solidity 스마트 컨트랙트 작성 (1) | 2022.10.08 |
Local에서 Remix 연결하기 + 팁! (0) | 2022.09.20 |
docker container geth 설치 (0) | 2022.09.13 |
Eth-LightWallet를 이용한 keystore와 address 생성 (0) | 2022.08.30 |