이더리움의 송금 및 채굴 (Step by Step)

CODEDRAGON Security/Blockchain

반응형



 

 

이더리움의 송금 채굴  (Step by Step)

Ethereum Testnet 설치하고 Ethereum 송금하는 실습과정입니다.

 

Step1: 제네시스 블록 생성 네트워크 구성

Step2: 테스트 네트워크 구동

Step3: 계정 생성 확인

Step4: 이더 송금

Step5: 이더 잔고 확인

Step6: 채굴

Step7: 이더 송금

Step8: balance 체크

Step9: 정보확인

 

 

 

 

 

Step1: 제네시스 블록 생성 네트워크 구성

 

Testnet 구성

mkdir testnet이라는 명령어를 통해서 Testnet 데이터를, 블록체인 데이터를 저장할 디렉터리를 만들어 줍니다.

 

 

osboxes@osboxes:~$ mkdir testnet
osboxes@osboxes:~$
cd testnet/
osboxes@osboxes:~/testnet$ pwd
/home/osboxes/testnet
osboxes@osboxes:~/testnet$

 

 

genesis.json 파일을 생성

 

genesis.json이라는 파일을 생성을 주는데 이것이 genesis 블록을 생성하기 위한 설정 정보를 갖다 주는 것입니다.

 

osboxes@osboxes:~/testnet$ vi genesis.json

 

 

 

 

genesis.json 파일 내용 확인 - Windows

Windows에서 genesis.json 파일을 오픈한 모든 내용을 복사합니다.


 

 

 

genesis.json 파일 내용 붙여넣기

Ubuntu 돌아와서 우분투 콘솔 메뉴에서 붙여넣기 합니다.

메뉴: [Edit] >> [Paste] 붙여넣기 합니다.


 

 

:wp 입력하여 수정한 내용을 파일에 저장한 vi 편집기를 빠져나옵니다.

:wp

 

osboxes@osboxes:~/testnet$ vi genesis.json
osboxes@osboxes:~/testnet$

 

 

 

 

genesis 블록을 생성

geth init 명령어로 genesis 블록을 생성하기 위한, private 블록체인을 운영하기 위한 준비 작업을 마무리하도록 하겠습니다.

datadir 옵션을 주는 datadir 계정폴더 밑의 만든 testnet이라고 하는 디렉터리를 지정하도록 하겠습니다.

그리고 마지막 인자로 genesis 블록에 대한 설정 정보가 있는 genesis.json 파일을 위치를 알려줍니다.

이렇게 하면 지금 genesis 블록에 대한 설정이 완료가 되어서 이제 Ethereum, Testnet 기동하기 위한 준비는 끝나게 됩니다.

 

 

geth init --datadir /home/osboxes/testnet /home/osboxes/testnet/genesis.json

osboxes@osboxes:~/testnet$ geth init --datadir /home/osboxes/testnet /home/osboxes/testnet/genesis.json
WARN [04-02|23:53:45.292] Sanitizing cache to Go's GC limits       provided=1024 updated=328
INFO [04-02|23:53:45.294] Maximum peer count                       ETH=25 LES=0 total=25
INFO [04-02|23:53:45.296] Allocated cache and file handles         database=/home/osboxes/testnet/geth/chaindata cache=16 handles=16
INFO [04-02|23:53:45.422] Writing custom genesis block
INFO [04-02|23:53:45.422] Persisted trie from memory database      nodes=0 size=0.00B time=11.499
µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-02|23:53:45.423] Successfully wrote genesis state         database=chaindata                            hash=5704d0
9bc5b0
INFO [04-02|23:53:45.423] Allocated cache and file handles         database=/home/osboxes/testnet/geth/lightchaindata cache=16 handles=16
INFO [04-02|23:53:45.442] Writing custom genesis block
INFO [04-02|23:53:45.442] Persisted trie from memory database      nodes=0 size=0.00B time=3.633
µgcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-02|23:53:45.443] Successfully wrote genesis state         database=lightchaindata                            hash=5704d0
9bc5b0
osboxes@osboxes:~/testnet$

 


 

 

 

 

정상 설치 확인

정상적으로 되었는지는 이렇게 tree라는 명령어를 통해서 현재 디렉터리, testnet 디렉터리를 보면 이렇게 데이터들, 블록체인 데이터를 저장하기 위한 설정들이 완료되었음을 확인할 수가 있습니다.

이상으로 여기까지가 genesis 블록 생성을 통한 Ethereum private 네트워크를 또는 테스트 네트워크를 기동하기 위한 준비가 끝난 상황입니다.

 

osboxes@osboxes:~/testnet$ tree .
.
├── genesis.json
├── geth
   ├── chaindata
      ├── 000001.log
      ├── CURRENT
      ├── LOCK
      ├── LOG
      └── MANIFEST-000000
   └── lightchaindata
       ├── 000001.log
       ├── CURRENT
       ├── LOCK
       ├── LOG
       └── MANIFEST-000000
└── keystore

4 directories, 11 files
osboxes@osboxes:~/testnet$

 


 

 

 

 

 

 

 

 

Step2: 테스트 네트워크 구동

 

Testnet 기동을 보도록 하겠습니다.

Testnet geth consol 통해서 Testnet, Ethereum 네트워크를 기동을 시키고 콘솔에 접속을 하게 됩니다.

네트워크 아이디는 현재 우리가 Testnet 구성하는 네트워크의 고유한 아이디인데 숫자로 임의의 값을 설정을 주시면 됩니다.

nodiscover 다른 노드에서 현재 우리가 만든 Testnet, 노드를 검색하지 않도록, nodiscover 통해서 private 블록체인이 되는 것입니다.

maxpeers 통해서 단독 노드를 구성을 합니다.

데이터 디렉터리는 전에 생성했던 testnet으로 설정합니다.

 

geth console --networkid 2080 --nodiscover --maxpeers 0 --datadir /home/osboxes/testnet

osboxes@osboxes:~/testnet$ geth console --networkid 2080 --nodiscover --maxpeers 0 --datadir /home/osboxes/testnet
WARN [04-03|01:19:43.834] Sanitizing cache to Go's GC limits       provided=1024 updated=328
INFO [04-03|01:19:43.948] Maximum peer count                       ETH=0 LES=0 total=0
INFO [04-03|01:19:44.002] Starting peer-to-peer node               instance=Geth/v1.8.23-stable-c9427004/linux-amd64/go1.10.4
INFO [04-03|01:19:44.002] Allocated cache and file handles         database=/home/osboxes/testnet/geth/chaindata cache=164 handles=2048
INFO [04-03|01:19:45.054] Initialised chain configuration          config="{ChainID: 33 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Byzantium: <nil> Constantinople: <nil>  ConstantinopleFix: <nil> Engine: unknown}"
INFO [04-03|01:19:45.054] Disk storage enabled for ethash caches   dir=/home/osboxes/testnet/geth/ethash count=3
INFO [04-03|01:19:45.055] Disk storage enabled for ethash DAGs     dir=/home/osboxes/.ethash             count=2
INFO [04-03|01:19:45.055] Initialising Ethereum protocol           versions="[63 62]" network=2080
INFO [04-03|01:19:45.219] Loaded most recent local header          number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:19:45.220] Loaded most recent local full block      number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:19:45.220] Loaded most recent local fast block      number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:19:45.254] Regenerated local transaction journal    transactions=0 accounts=0
INFO [04-03|01:19:45.707] New local node record                    seq=1 id=7e17b0edf5fc5969 ip=127.0.0.1 udp=0 tcp=30303
INFO [04-03|01:19:45.707] Started P2P networking                   self="enode://c7f5e565736a8957105e708ca4c122a10076b9c66d12b245025

340dfb939ae1b96046687b018dc202e673accbcdf4028b627214152efcb77197

fa00a1d59d2b5@127.0.0.1:30303?discport=0"
INFO [04-03|01:19:45.711] IPC endpoint opened                      url=/home/osboxes/testnet/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.23-stable-c9427004/linux-amd64/go1.10.4
 modules: admin:1.0 debug: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

>

Testnet 기동, Ethereum 네트워크가 기동이 되었고 지금 자바스트립트 콘솔에 접속이 되어서 명령어를 실행할 있는 상태입니다.

 

 

 

 

 

 

 

Step3: 계정 생성 확인

 

 

ether0 계정 생성

personal.newaccount 명령을 통해서 계정을 생성을 하도록 하겠습니다. 이때 geth0라고 하는 인자는 어카운트의 암호가 됩니다. 이렇게 하면 주소가 새로 생성된 Ethereum 계정입니다.

 

> personal.newAccount("ether0")
"
0x8c16404f2ed65382234fdf83ab63c549d3155515"
>

 

 

 

 

ether1 계정 생성

하나 생성해 보도록 하겠습니다.

 

> personal.newAccount("ether1")
"0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536"
>

 

이렇게 해서 2개의 지갑을 생성 또는 2개의 Ethereum 계정을 생성을 했습니다.



 

 

 

 

마이너의 전자지갑 주소 확인하기

eth.coinbase 명령어는 전자지갑 주소, 마이너의 전자지갑 주소를 알려줍니다.

Ethereum 제일 처음에 시작하면 디폴트로 제일 처음 생성된 주소(ether0) 마이너의 주소이기도 합니다.

 

> eth.coinbase
INFO [04-03|01:29:39.464] Etherbase automatically configured       address=0x8C16404f2ED65382234fDf83AB63C549D3155515
"
0x8c16404f2ed65382234fdf83ab63c549d3155515"
>

 

 

 

마이너 주소 바꾸기

만약에 마이너 주소를 번째 생성된 마이너(ether1) 바꾸기 위해 주소를 복사를 합니다.

그리고 miner.setEtherbase라는 명령어를 통해서 그래서 현재 노드의 채굴자의 획득하는 전자지갑 주소를 바꿔줍니다.

 

> miner.setEtherbase("0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536")
true
>

 

 

 

 

바뀐 마이너의 전자지갑 주소 확인하기

eth.coinbase 확인해 보시면 새로운 주소, 번째 전자지갑 주소(ether1), 그러니까 Ethereum 계정 주소로 바뀌어 있음을 확인할 있습니다.

> eth.coinbase
"
0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536"
>

 

 

 

원래대로 돌리기

다시 원래대로 ether0 주소로 돌리도록 하겠습니다.

그리고 다시 eth.coinbase 확인합니다.

> miner.setEtherbase("0x8c16404f2ed65382234fdf83ab63c549d3155515")
true
>
eth.coinbase
"0x8c16404f2ed65382234fdf83ab63c549d3155515"
>

정상적으로 번째 계정(ether0)으로 채굴자 주소가 설정되어 있는 것을 확인할 수가 있습니다.

 

 

 

 

 

 

생성된 전자지갑 주소 확인하기

eth.accounts라고 하는 명령어가 있는데 제가 일일이 이런 20바이트 이상의 전자지갑 주소 또는 Ethereum 계정을 기억하거나 복사하는 것이 번거롭기 때문에 eth.accounts라고 하는 명령어를 통해서 생성된 전자지갑 주소를 확인할 있습니다.

 

> eth.accounts
["0x8c16404f2ed65382234fdf83ab63c549d3155515", "0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536"]
>

 

 

 

eth.accounts 주소에 대한 Array 배열입니다.

그래서 eth.accounts[0] 또는 [1] 이런 식으로 해서 순서대로 생성된 전자지갑 주소를 접근할 수가 있습니다.

 

> eth.accounts[0]
"0x8c16404f2ed65382234fdf83ab63c549d3155515"
>
eth.accounts[1]
"0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536"
>

 

accounts[0], accounts[1]이라고 각각의 주소를 호칭하도록 하겠습니다.

 

 

 

 

 

 

 

 

Step4: 이더 송금

ether 송금을 하는 것이 실습의 목표인데 ether 송금을 보도록 하겠습니다.

 

 

accounts[0] -> accounts[1] 1 ether 송금하기 (Error)

eth.sendTransaction 통해서 accounts[0]에서 accounts[1] 1 ether 보내라고 하는 명령어를 수행합니다.

 

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})

> eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})
Error: authentication needed: password or unlock
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1

>

 

실행을 하면 실행이 됩니다.


오류를 보면 패스워드를 넣으라고 이야기하는데 송금을 하기 위해서는 from 송금을 패스워드 unlock 줘야 됩니다.

 

 

 

 

패스워드 unlock

그래야만 송금을 수가 있고요. 그래서 unlock 하는 명령어, personal.unlockAccount라는 명령을 통해서 수가 있습니다. 그리고 인자로는 계정을 생성할 입력했던 패스워드를 넣어 줍니다.

> personal.unlockAccount(eth.accounts[0], "ether0")
true

 

 

 

다시 송금을 시도합니다.

다시 에러가 발생하면서 실행이 되지 않습니다. 왜냐하면, 번째 이유로 지금 계정에 ether 잔고가 없기 때문입니다.

> eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})
Error: insufficient funds for gas * price + value
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1

>

 

 

 

 

 

 

Step5: 이더 잔고 확인

ether 잔고를 확인하는 방법은 eth.getbalance ether 잔고를 확인할 수가 있습니다.

 

 

accounts[0] ether 잔고 확인

먼저 accounts[0]번의 잔고를 확인하도록 하겠습니다. 0이고요.

 

> eth.getBalance(eth.accounts[0])
0
>

 

 

 

accounts[1] ether 잔고 확인

accounts[1] 주소에도 0 ether입니다. 그래서 ether 없기 때문에 지금 보낼 수가 없습니다.

> eth.getBalance(eth.accounts[1])
0
>

 

계정에 ether 잔고가 없는 것을 확인할 있습니다.


 

 

 

 

 

 

 

 

Step6: 채굴

ether 받는 방법은 3가지가 있다고 했는데 그중에 우리가 사용할 방법은 마이닝을 통해서 ether 받도록 하겠습니다.

 

miner.start(1) 하면 실행을 하면 마이닝이 시작됩니다.

먼저 명령어가 실행되면 마이닝을 있는 준비 작업을 하게 됩니다.

 

> miner.start(1)
INFO [04-03|01:55:00.059] Updated mining threads                   threads=1
INFO [04-03|01:55:00.072] Transaction pool price threshold updated price=1000000000
null
>
INFO [04-03|01:55:00.140] Commit new mining work                   number=1 sealhash=6a83f1fe9759 uncles=0 txs=0 gas=0 fees=0 elapsed=51.956ms
INFO [04-03|01:55:06.023] Generating DAG in progress               epoch=0 percentage=0 elapsed=4.881s
INFO [04-03|01:55:10.778] Generating DAG in progress               epoch=0 percentage=1 elapsed=9.635s
INFO [04-03|01:55:16.108] Generating DAG in progress               epoch=0 percentage=2 elapsed=14.965s
INFO [04-03|01:55:23.096] Generating DAG in progress               epoch=0 percentage=3 elapsed=21.953s

 

 


이렇게 콘솔에 메시지들이 계속 나오기 때문에 작업에 방해가 되므로 일단 작업을 중지한 다시 한번 나갔다가

에러 메시지, 또는 콘솔 메시지를 로그 파일로 저장하는 그런 명령어를 실행해서 다시 작업을 실행하도록 하겠습니다.

 

 

Ctrl+C 누르다음 > 프롬프트가 나오면 바로 exit 명령어를 쳐서 빠져나옵니다.

INFO [04-03|01:55:16.108] Generating DAG in progress               epoch=0 percentage=2 elapsed=14.965s
INFO [04-03|01:55:23.096] Generating DAG in progress               epoch=0 percentage=3 elapsed=21.953s
^C
>
exit
INFO [04-03|01:55:40.499] IPC endpoint closed                      url=/home/osboxes/testnet/geth.ipc
INFO [04-03|01:55:40.500] Blockchain manager stopped
INFO [04-03|01:55:40.500] Stopping Ethereum protocol
INFO [04-03|01:55:40.500] Ethereum protocol stopped
INFO [04-03|01:55:40.518] Transaction pool stopped
INFO [04-03|01:55:40.577] Database closed                          database=/home/osboxes/testnet/geth/chaindata
osboxes@osboxes:~/testnet$

 

 

geth console --networkid 2080 --nodiscover --maxpeers 0 --datadir /home/osboxes/testnet 2>> /home/osboxes/testnet/geth.log

osboxes@osboxes:~/testnet$ geth console --networkid 2080 --nodiscover --maxpeers 0 --datadir /home/osboxes/testnet 2>> /home/osboxes/testnet/geth.log
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.23-stable-c9427004/linux-amd64/go1.10.4
coinbase: 0x8c16404f2ed65382234fdf83ab63c549d3155515
at block: 0 (Wed, 31 Dec 1969 19:00:00 EST)
 datadir: /home/osboxes/testnet
 modules: admin:1.0 debug: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

>

 


 

 

 

 

geth.log 파일 모니터링 - console1

 

새로운 터미널창을 하나 띄워서 tail -f라는 명령어는 파일을 모니터링을 하라는 명령어입니다.

 


 


 

 

osboxes@osboxes:~$ tail -f /home/osboxes/testnet/geth.log
INFO [04-03|01:59:43.179] Initialising Ethereum protocol           versions="[63 62]" network=2080
INFO [04-03|01:59:43.211] Loaded most recent local header          number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:59:43.212] Loaded most recent local full block      number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:59:43.212] Loaded most recent local fast block      number=0 hash=5704d0
9bc5b0 td=256 age=49y11mo2w
INFO [04-03|01:59:43.212] Loaded local transaction journal         transactions=0 dropped=0
INFO [04-03|01:59:43.212] Regenerated local transaction journal    transactions=0 accounts=0
INFO [04-03|01:59:43.257] IPC endpoint opened                      url=/home/osboxes/testnet/geth.ipc
INFO [04-03|01:59:43.287] New local node record                    seq=2 id=7e17b0edf5fc5969 ip=127.0.0.1 udp=0 tcp=30303
INFO [04-03|01:59:43.287] Started P2P networking                   self="enode://c7f5e565736a8957105e708ca4c122a10076b9c66d12b2

45025340dfb939ae1b96046687b018dc202e673accbcdf4028b627214152

efcb77197fa00a1d59d2b5@127.0.0.1:30303?discport=0"
INFO [04-03|01:59:43.538] Etherbase automatically configured       address=0x8C16404f2ED65382234fDf83AB63C549D3155515

 


 

 

 

콘솔창 재배치

모니터링하면서 작업하기 위해 콘솔창을 재배치합니다.

위쪽이 console1이고 아래쪽이 console0입니다.


 

 

 

 

마이닝 시작 - console0

다시 마이닝을 시작하도록 하겠습니다.

 

miner.start(1)

> miner.start(1)
null
>

 


console0 창으로는 메시지가 나오지 않고 console1 창으로 메시지가 나오는 것을 확인할 수가 있습니다.

 

 

 

[0], [1] 이더 확인

Generating DAG in progress 상태는 아직 마이닝 준비 작업하고 있는 상태입니다.

아직 마이닝 전이라 ether 확인해 보시면 아직 ether 없음을 확인할 있습니다.

 

> miner.start(1)
null
>
eth.getBalance(eth.accounts[0])
0
>
>
eth.getBalance(eth.accounts[1])
0
>

 


 

 

 

지금 마이닝을 하기 위한 작업들이 끝났고 지금 이렇게 마이닝(mined potential block) 되고 있는 것을 확인할 있습니다. balance 다시 확인합니다.

> eth.getBalance(eth.accounts[0])
5000000000000000000
>
eth.getBalance(eth.accounts[1])
0
>

 


 

 

 

 

 

 

 

Step7: 이더 송금

 

[0], [1] 이더 확인

> eth.getBalance(eth.accounts[0])
5000000000000000000
>
eth.getBalance(eth.accounts[1])
0
>

 

 

 

 

1ether 송금

송금을 보도록 하겠습니다.

 

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})

> eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})
Error: authentication needed: password or unlock
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1

> personal.unlockAccount(eth.accounts[0], "ether0")
true
>
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(1, "ether")})
"0xe4a4a3f443282a3a1c76d305c2d5ff19f19368eb4bfc6da409cfa820c422fd43"
>

 

 

명령어를 실행하면 Transaction id 나오고요. Transaction id 통해서 확인을 수가 있습니다. 송금이 되었습니다.

 

 

 

 

 

 

 

Step8: balance 체크

 

마이닝 중단 (옵션)

마이닝을 중단시키면 ether 충분하지 않아 pedding Transaction 확인할 있습니다.

minor.stop()

 

 

 

[0], [1] 이더 확인

> eth.getBalance(eth.accounts[0])
5000000000000000000
>
eth.getBalance(eth.accounts[1])
0
>

 

 

 

송금을 했습니다. 각각의 balance [0], [1]번을 확인해 보면 아직 ether 변화가 없는 것을 확인할 있습니다.


 

 

 

 

 

pending transaction 확인

지금 상황은 Transaction pending 상태인 경우입니다.

이것은 전에 마이닝을 중지를 시켰기 때문에 채굴이 되지 않아서 지금 현재 pending 상태에 있는 것입니다.

그래서 pending 상태에 있는 Transaction들은 pendingTransacion 명령어를 통해서 확인할 수가 있습니다.

 

> eth.pendingTransactions
[{
    blockHash: null,
   
blockNumber: null,
    from: "0x8c16404f2ed65382234fdf83ab63c549d3155515",
    gas: 90000,
    gasPrice: 1000000000,
    hash: "0xe4a4a3f443282a3a1c76d305c2d5ff19f19368eb4bfc6da409cfa820c422fd43",
    input: "0x",
    nonce: 0,
    r: "0x1551f0e6619671b68779c6948267a97ef3cf76f56fa3d0ebbfe7c4f8b923838f",
    s: "0x38a9da49679700cbed9e5499d2a6c31c188a88e2481d4e16ea084ce7fa76e1b1",
    to: "0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536",
    transactionIndex: 0,
    v: "0x65",
    value: 1000000000000000000
}]
>

 

현재 pending 상태에 있는 거래들을 확인할 수가 있습니다.

블록 넘버가 null이기 때문에 채굴이 되고 pending 상태라는 것을 있습니다.


 

 

 

다시 마이닝을 시작하도록 하겠습니다. (옵션)

마이닝을 중단하고 pendding transaction 확인한 경우 확인 다시 마이닝을 시작합니다.

miner.start(1)

 

 

마이닝 시작이 되어 새로운 신규 불록이 생성이 되었기 때문에 pendingTransaction 없습니다.

> eth.pendingTransactions
[]
>

 

 

 

[0], [1] 이더 확인

송금을 했습니다. 각각의 balance [0], [1]번을 확인해 보면 1ether 송금되어 변화가 있는 것을 확인할 있습니다.

> eth.getBalance(eth.accounts[0])
9000000000000000000
> eth.getBalance(eth.accounts[1])
1000000000000000000
>

 


 

 

 

 

 

 

Step9: 정보 확인

 

트랜잭션 정보 확인

 

Transaction id 복사를 하고요. 그래서 저희가 eth.getTransaction 해서 Transaction id 입력을 하면 Transaction 정보를 확인할 있습니다.

 

eth.getTransaction("0xe4a4a3f443282a3a1c76d305c2d5ff19f

19368eb4bfc6da409cfa820c422fd43")

> eth.getTransaction("0xe4a4a3f443282a3a1c76d305c2d5ff19f19368eb4bfc6da409cfa820c422fd43")
{
  blockHash: "0x6063fa361b960378a952ec17519880a1f8444318439fd055cf21b6f5465a2682",
 
blockNumber: 2,
  from: "0x8c16404f2ed65382234fdf83ab63c549d3155515",
  gas: 90000,
  gasPrice: 1000000000,
  hash: "0xe4a4a3f443282a3a1c76d305c2d5ff19f19368eb4bfc6da409cfa820c422fd43",
  input: "0x",
  nonce: 0,
  r: "0x1551f0e6619671b68779c6948267a97ef3cf76f56fa3d0ebbfe7c4f8b923838f",
  s: "0x38a9da49679700cbed9e5499d2a6c31c188a88e2481d4e16ea084ce7fa76e1b1",
  to: "0xf85e2d6674b7c9e12fc805e7e8e28f31397f9536",
  transactionIndex: 0,
  v: "0x65",
  value: 1000000000000000000
}
>

 

아까는 블록 넘버(blockNumber)하고 블록 캐시가 null 값이었는데 지금은 블록, Transaction 포함된 블록에 대한 정보를 확인할 수가 있습니다. blockNumber 2 블록에 대해서 포함되어 있습니다.


 

 

 

 

 

블록 정보 확인

 

eth.getBlock(2)

> eth.getBlock(2)
{
  difficulty: 131072,
  extraData: "0xd883010817846765746888676f312e31302e34856c696e7578",
  gasLimit: 133955714,
  gasUsed: 21000,
  hash: "0x6063fa361b960378a952ec17519880a1f8444318439fd055cf21b6f5465a2682",
  logsBloom: "0x000000000000000000000000000000000000000000000000000000000000000000000000

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",

  miner: "0x8c16404f2ed65382234fdf83ab63c549d3155515",
  mixHash: "0x3b4ad37422073f88b32bac40973b4d09ccf52f30bc78ea0e5c2da4815158f8c6",
  nonce: "0x40d3e7c36d79962b",
  number: 2,
  parentHash: "0x5804a522b5b693b93ae17b6b74a28b4faa19c0af9554e99f691f41e9fb29a188",
  receiptsRoot: "0xd2b06aa381626fd89678b24c934e8669909cabc8a34345a579b920ca50097a70",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 650,
  stateRoot: "0x46a2ab8b904e751eb6aa7cc583bef0e75ed48445646f802b2b292d8c8287a27a",
  timestamp: 1554289542,
  totalDifficulty: 262400,
  transactions: ["0xe4a4a3f443282a3a1c76d305c2d5ff19f19368eb4bfc6da409cfa820c422fd43"],
  transactionsRoot: "0x5c8963e6875a024221c3657e5d1f39c79e055fa66eb6c2083909a314605b7fae",
  uncles: []
}
>

 

 

블록 넘버 2 넣으면 마이너에 대한 지갑 아이디, 난이도, 사용된 Gas, Gas limit, 해시 블록이 포함하고 있는 Transaction들을 확인할 수가 있습니다.


 

 

 

 



반응형

'Security > Blockchain' 카테고리의 다른 글

P2P(개인 대 개인) 네트워크 방식 장점  (0) 2019.05.07
블록체인 저장 방식  (0) 2019.04.29
이더리움 백서의 구조  (0) 2019.04.19
Struct  (0) 2019.04.13
MetaMask 계정 생성  (0) 2019.04.08