2017-11-06 20:36:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
2017-11-09 19:34:58 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/cmd"
|
2017-11-06 20:36:12 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/geth"
|
|
|
|
"github.com/8thlight/vulcanizedb/pkg/history"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
environment := flag.String("environment", "", "Environment name")
|
|
|
|
startingBlockNumber := flag.Int("starting-number", -1, "First block to fill from")
|
|
|
|
flag.Parse()
|
2017-11-09 19:34:58 +00:00
|
|
|
config := cmd.LoadConfig(*environment)
|
|
|
|
blockchain := geth.NewGethBlockchain(config.Client.IPCPath)
|
2017-12-04 15:53:36 +00:00
|
|
|
repository := cmd.LoadPostgres(config.Database)
|
2017-11-06 20:36:12 +00:00
|
|
|
numberOfBlocksCreated := history.PopulateBlocks(blockchain, repository, int64(*startingBlockNumber))
|
|
|
|
fmt.Printf("Populated %d blocks", numberOfBlocksCreated)
|
|
|
|
}
|