kaistshadow / blockchain-sim

Scalable blockchain simulator/emulator running on shadow simulator
MIT License
9 stars 1 forks source link

bitcoin dump program development #290

Closed hyojin5658 closed 3 years ago

hyojin5658 commented 3 years ago

sub issue of #266

트랜잭션 생성을 위하여 블록데이터(.dat)와 coinbase wallet의 priv key, coinbase transaction을 생성 하는 데이터 파일들이 필요하다. 이러한 dump 파일을 생성 하기 위한 로직을 코드로 추가하고자 한다.( 이전까지는 난이도 별로 생성 해 놓은 파일 사용)

hyojin5658 commented 3 years ago

일단, 덤프 파일을 생성하는 코드를 생성하였다. 파일의 위치는 testlibs/datadirDump 이며, 새로운 6블록 데이터 덤프를 생성하여, testlibs/dump 파일을 생성하는 코드를 작성하였다. 블록을 load 하기 위해서 필요한 파일은 blocks(block.dat 파일)과 coinfliphash.txt (coinflip 알고리즘 사용시 hastable에 등록해주기 위함), key.txt, stat.txt( tx generator 사용시 필요)이며, 이러한 파일들을 생성 해준다.

기존에 있던 데이터 dump 폴더는 삭제 하였다.

hyojin5658 commented 3 years ago

BLEEPeval/tpstest-app/prototype 에서 tps 측정을 위한 테스트 실행시, sh start_emulation.sh 3(난이도, 현재는 3밖에 동작하지 않음) 의 command로 실행 시키면 된다.

start_emulation.sh 실행 시 clean_data.sh 파일이 실행되어 미리 덤프되어 있는 파일 중 난이도에 맞는 파일을 복사해온다. 만약, 해당 난이도의 덤프 파일이 존재 하지 않으면, 생성 하고, 복사해오도록 만들어 놓았다.

start_emulation.sh 파일과, clion에서 debug 실행 시킬때 동일하게 동작 하도록 cmakelist.txt에도 추가하여 동일하게 동작하도록 구성하였다.