From 828e7cbbb83e4c48b9de5ea4ff3bad9c2ada8863 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Fri, 13 Jul 2018 14:12:18 -0700 Subject: [PATCH 1/5] Move blockchain file: --- Gopkg.lock | 28 ++++++++++++++-------------- blockchain => data/blockchain | Bin main.go | 28 ++++++++++++++-------------- 3 files changed, 28 insertions(+), 28 deletions(-) rename blockchain => data/blockchain (100%) diff --git a/Gopkg.lock b/Gopkg.lock index a98c7be20..d97690ca4 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -31,7 +31,7 @@ packages = [ "store", "types", - "wire" + "wire", ] pruneopts = "T" revision = "0d6f99d6d514916974a7cc1a7e4577c650e987e1" @@ -83,7 +83,7 @@ "params", "rlp", "rpc", - "trie" + "trie", ] pruneopts = "T" revision = "37685930d953bcbe023f9bc65b135a8d8b8f1488" @@ -95,7 +95,7 @@ packages = [ "log", "log/level", - "log/term" + "log/term", ] pruneopts = "T" revision = "4dc7be5d2d12881735283bcab7352178e190fc71" @@ -126,7 +126,7 @@ "proto", "protoc-gen-gogo/descriptor", "sortkeys", - "types" + "types", ] pruneopts = "T" revision = "1adfc126b41513cc696b209667c8656ea7aac67c" @@ -140,7 +140,7 @@ "ptypes", "ptypes/any", "ptypes/duration", - "ptypes/timestamp" + "ptypes/timestamp", ] pruneopts = "T" revision = "925541529c1fa6821df4e44ce2723319eb2be768" @@ -160,7 +160,7 @@ name = "github.com/hashicorp/golang-lru" packages = [ ".", - "simplelru" + "simplelru", ] pruneopts = "T" revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" @@ -213,7 +213,7 @@ "leveldb/opt", "leveldb/storage", "leveldb/table", - "leveldb/util" + "leveldb/util", ] pruneopts = "T" revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445" @@ -225,7 +225,7 @@ packages = [ ".", "edwards25519", - "extra25519" + "extra25519", ] pruneopts = "T" revision = "d8387025d2b9d158cf4efb07e7ebf814bcce2057" @@ -260,7 +260,7 @@ "libs/log", "libs/pubsub", "libs/pubsub/query", - "types" + "types", ] pruneopts = "T" revision = "5923b6288fe8ce9581936ee97c2bf9cf9c02c2f4" @@ -277,7 +277,7 @@ "openpgp/errors", "poly1305", "ripemd160", - "salsa20/salsa" + "salsa20/salsa", ] pruneopts = "T" revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602" @@ -294,7 +294,7 @@ "idna", "internal/timeseries", "trace", - "websocket" + "websocket", ] pruneopts = "T" revision = "c21de06aaf072cea07f3a65d6970e5c7d8b6cd6d" @@ -316,7 +316,7 @@ "unicode/bidi", "unicode/cldr", "unicode/norm", - "unicode/rangetable" + "unicode/rangetable", ] pruneopts = "T" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" @@ -355,7 +355,7 @@ "stats", "status", "tap", - "transport" + "transport", ] pruneopts = "T" revision = "d11072e7ca9811b1100b80ca0269ac831f06d024" @@ -405,7 +405,7 @@ "github.com/ethereum/go-ethereum/rlp", "github.com/ethereum/go-ethereum/rpc", "github.com/ethereum/go-ethereum/trie", - "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/db", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/blockchain b/data/blockchain similarity index 100% rename from blockchain rename to data/blockchain diff --git a/main.go b/main.go index 43b5a3fc3..c97b6ff78 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ import ( ) var cpuprofile = flag.String("cpuprofile", "", "write cpu profile `file`") -var blockchain = flag.String("blockchain", "blockchain", "file containing blocks to load") +var blockchain = flag.String("blockchain", "data/blockchain", "file containing blocks to load") var ( // TODO: Document... @@ -39,20 +39,20 @@ var ( // TODO: Document... func main() { flag.Parse() - if *cpuprofile != "" { - f, err := os.Create(*cpuprofile) - if err != nil { - fmt.Printf("could not create CPU profile: %v\n", err) - return - } - if err := pprof.StartCPUProfile(f); err != nil { - fmt.Printf("could not start CPU profile: %v\n", err) - return - } - defer pprof.StopCPUProfile() - } + if *cpuprofile != "" { + f, err := os.Create(*cpuprofile) + if err != nil { + fmt.Printf("could not create CPU profile: %v\n", err) + return + } + if err := pprof.StartCPUProfile(f); err != nil { + fmt.Printf("could not start CPU profile: %v\n", err) + return + } + defer pprof.StopCPUProfile() + } - stateDB := dbm.NewDB("state", dbm.LevelDBBackend, "") + stateDB := dbm.NewDB("state", dbm.LevelDBBackend, "") codeDB := dbm.NewDB("code", dbm.LevelDBBackend, "") ethermintDB, err := state.NewDatabase(stateDB, codeDB) From 4a8288b82ce38ae5c63b579c82030992500f547d Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Fri, 13 Jul 2018 14:28:11 -0700 Subject: [PATCH 2/5] Add docker-compose and instructions to run --- README.md | 8 ++++++++ docker-compose.yaml | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 docker-compose.yaml diff --git a/README.md b/README.md index e9ab4627d..3c44e9d29 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,14 @@ $ make tools deps build $ make tools deps install ``` +### Using Ethermint to parse Mainnet Ethereum blocks + +There is an included `docker-compose.yaml` file and a `data/blockchain` file that provide an easy way to run the demo of parsing Mainnet ethereum blocks. The dump in `data/` only includes up to block `97638`. To run this have [`docker-compose.yaml` installed](https://docs.docker.com/compose/install/) and run the following: + +``` +$ docker-compose up +``` + ### Community The following chat channels and forums are a great spot to ask questions about Ethermint: diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..8fe939ee8 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,7 @@ +version: '3' +services: + ethermint: + build: . + volumes: + - ./data/:/data/ + command: ["ethermint", "-blockchain", "/data/blockchain"] From efe700dee85a0a16737374b2a69f3098e2bc5c38 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Fri, 13 Jul 2018 15:02:25 -0700 Subject: [PATCH 3/5] Remove docker-compose and add instructions to run blockchain file --- .gitignore | 2 ++ README.md | 26 ++++++++++++++++++++++---- docker-compose.yaml | 7 ------- 3 files changed, 24 insertions(+), 11 deletions(-) delete mode 100644 docker-compose.yaml diff --git a/.gitignore b/.gitignore index 17cffba80..38b539121 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ .glide/ vendor/ build/ +*.db +*.txt diff --git a/README.md b/README.md index 3c44e9d29..83c07e9a8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ __**WARNING:**__ Ethermint is under VERY ACTIVE DEVELOPMENT and should be treate - [Hard Spoon](https://blog.cosmos.network/introducing-the-hard-spoon-4a9288d3f0df) enablement: This is the ability to take a token from the Ethereum mainnet and "spoon" (shift) the balances over to another network. This feature is intended to make it easy for applications that require more transactions than the Ethereum main chain can provide to move their code over to a compatible chain with much more capacity. - Web3 Compatibility: In order enable applications to be moved over to an ethermint chain existing tooling (i.e. web3 compatable clients) need to be able to interact with `ethermint`. -### Implementation Steps +### Implementation - [x] Have a working implementation that can parse and validate the existing ETH Chain and persist it in a Tendermint store - [ ] Benchmark this implementation to ensure performance @@ -33,10 +33,28 @@ $ make tools deps install ### Using Ethermint to parse Mainnet Ethereum blocks -There is an included `docker-compose.yaml` file and a `data/blockchain` file that provide an easy way to run the demo of parsing Mainnet ethereum blocks. The dump in `data/` only includes up to block `97638`. To run this have [`docker-compose.yaml` installed](https://docs.docker.com/compose/install/) and run the following: +There is an included Ethereum Mainnet blockchain file in `data/blockchain` that provides an easy way to run the demo of parsing Mainnet Ethereum blocks. The dump in `data/` only includes up to block `97638`. To run this, type the following command: -``` -$ docker-compose up +```bash +$ go run main.go copied.go +balance of 0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0: 200000000000000000000 +commitID after genesis: CommitID{[235 78 80 238 156 235 50 19 95 118 247 9 106 207 72 45 127 238 223 177]:1} +genesis state root hash: 0000000000000001000000000000000000000000000000000000000000000000 +processed 10000 blocks, time so far: 3.076565301s +processed 20000 blocks, time so far: 6.437135359s +processed 30000 blocks, time so far: 10.145579892s +processed 40000 blocks, time so far: 14.538473343s +processed 50000 blocks, time so far: 20.924373963s +processed 60000 blocks, time so far: 28.486701074s +processed 70000 blocks, time so far: 40.029318946s +processed 80000 blocks, time so far: 48.056637508s +processed 90000 blocks, time so far: 57.049310537s +processed 97638 blocks +balance of one of the genesis investors: 200000000000000000000 +root500: 00000000000001f5000000000000000000000000000000000000000000000000 +investor's balance after block 500: 200000000000000000000 +miner of block 501's balance after block 500: 0 +miner of block 501's balance after block 501: 5000000000000000000 ``` ### Community diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 8fe939ee8..000000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,7 +0,0 @@ -version: '3' -services: - ethermint: - build: . - volumes: - - ./data/:/data/ - command: ["ethermint", "-blockchain", "/data/blockchain"] From b83692735923be523d42e6d27ab4aa57bc667dc1 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 16 Jul 2018 07:34:39 -0700 Subject: [PATCH 4/5] Remove fluff from readme --- README.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/README.md b/README.md index 83c07e9a8..731db7a19 100644 --- a/README.md +++ b/README.md @@ -37,24 +37,6 @@ There is an included Ethereum Mainnet blockchain file in `data/blockchain` that ```bash $ go run main.go copied.go -balance of 0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0: 200000000000000000000 -commitID after genesis: CommitID{[235 78 80 238 156 235 50 19 95 118 247 9 106 207 72 45 127 238 223 177]:1} -genesis state root hash: 0000000000000001000000000000000000000000000000000000000000000000 -processed 10000 blocks, time so far: 3.076565301s -processed 20000 blocks, time so far: 6.437135359s -processed 30000 blocks, time so far: 10.145579892s -processed 40000 blocks, time so far: 14.538473343s -processed 50000 blocks, time so far: 20.924373963s -processed 60000 blocks, time so far: 28.486701074s -processed 70000 blocks, time so far: 40.029318946s -processed 80000 blocks, time so far: 48.056637508s -processed 90000 blocks, time so far: 57.049310537s -processed 97638 blocks -balance of one of the genesis investors: 200000000000000000000 -root500: 00000000000001f5000000000000000000000000000000000000000000000000 -investor's balance after block 500: 200000000000000000000 -miner of block 501's balance after block 500: 0 -miner of block 501's balance after block 501: 5000000000000000000 ``` ### Community From 101df5826cf1424e1bf9138f869df978ef123622 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 16 Jul 2018 07:49:52 -0700 Subject: [PATCH 5/5] Clean up gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 38b539121..17cffba80 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,3 @@ .glide/ vendor/ build/ -*.db -*.txt