-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsample.go
More file actions
33 lines (27 loc) · 790 Bytes
/
sample.go
File metadata and controls
33 lines (27 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"github.com/prometheus/common/log"
"github.com/boxproject/lib-bitcore/serpcclient"
)
func main() {
// Connect to local bitcoin core RPC server using HTTP POST mode.
connCfg := &serpcclient.ConnConfig{
Host: "YourRPCHost:YourRPCPort",
User: "YourRPCUserName",
Pass: "YourRPCPassword",
HTTPPostMode: true, // Bitcoin core only supports HTTP POST mode
DisableTLS: true, // Bitcoin core does not provide TLS by default
}
// Notice the notification parameter is nil since notifications are
// not supported in HTTP POST mode.
client, err := serpcclient.New(connCfg, nil)
if err != nil {
log.Fatal(err)
}
defer client.Shutdown()
rt,err := client.RescanBlockChain()
if err != nil {
log.Fatal(err)
}
log.Info(rt)
}