package main import ( "database/sql" "encoding/json" "log" "math/big" "sync-block/collector" "sync-block/er" "sync-block/eth" "sync-block/util" "github.com/ybbus/jsonrpc/v2" ) var db *sql.DB var rpc jsonrpc.RPCClient func main() { log.SetFlags(log.Lshortfile) //var err error db = util.ConnectDb("13.124.2.254", "weberp_db", "nb7X94raSds", "weberp_db") // rpc = jsonrpc.NewClient("http://3.38.62.211:8545") //log.Println(get("0x0fc6349b4733b01cc3194839eb57d3854ad01a8b473299fc6b564f4294604732")) eth, err := eth.New("http://3.38.62.211:8545", nil) er.Check(err) c := collector.New(db, eth, 1000) _ = c log.Println(c.Process(41, 42)) return no, err := eth.GetLastBlockNumber() log.Println(no.Uint64()) er.Check(err) log.Println(get("0x0fc6349b4733b01cc3194839eb57d3854ad01a8b473299fc6b564f4294604732")) v := new(big.Int) v, _ = v.SetString("1bc16d674ec800000", 16) log.Println(v.String()) return } func get(tx string) error { args := make([]interface{}, 0) args = append(args, tx) args = append(args, map[string]interface { }{ "tracer": "callTracer", "reexec": 712585 - 672922 + 20, }) resp, _ := rpc.Call("debug_traceTransaction", args) data, _ := json.Marshal(resp.Result) log.Println(string(data)) return resp.Error }