2017-10-18 20:14:17 +00:00
|
|
|
package main
|
|
|
|
|
2017-10-23 15:56:29 +00:00
|
|
|
import (
|
2017-10-23 19:33:08 +00:00
|
|
|
"flag"
|
2017-10-25 15:57:59 +00:00
|
|
|
|
|
|
|
"log"
|
|
|
|
|
2017-10-23 15:56:29 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/core"
|
2017-10-25 15:57:59 +00:00
|
|
|
"github.com/jmoiron/sqlx"
|
2017-10-23 15:56:29 +00:00
|
|
|
)
|
2017-10-18 20:14:17 +00:00
|
|
|
|
|
|
|
func main() {
|
2017-10-23 19:33:08 +00:00
|
|
|
ipcPath := flag.String("ipcPath", "", "location geth.ipc")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
var blockchain core.Blockchain = core.NewGethBlockchain(*ipcPath)
|
2017-10-23 15:56:29 +00:00
|
|
|
blockchain.RegisterObserver(core.BlockchainLoggingObserver{})
|
2017-10-25 15:57:59 +00:00
|
|
|
pgConfig := "host=localhost port=5432 dbname=vulcanize sslmode=disable"
|
|
|
|
db, err := sqlx.Connect("postgres", pgConfig)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error connecting to DB: %v\n", err)
|
|
|
|
}
|
|
|
|
blockchain.RegisterObserver(core.BlockchainDBObserver{Db: db})
|
2017-10-23 18:58:33 +00:00
|
|
|
blockchain.SubscribeToEvents()
|
2017-10-18 20:14:17 +00:00
|
|
|
}
|