mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
Create 17_1_getbalance.go
This commit is contained in:
parent
2812f1fec2
commit
d855a8422e
29
src/17_1_getbalance.go
Normal file
29
src/17_1_getbalance.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"fmt"
|
||||||
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
connCfg := &rpcclient.ConnConfig{
|
||||||
|
Host: "localhost:18332",
|
||||||
|
User: "StandUp",
|
||||||
|
Pass: "431451790e3eee1913115b9dd2fbf0ac",
|
||||||
|
HTTPPostMode: true,
|
||||||
|
DisableTLS: true,
|
||||||
|
}
|
||||||
|
client, err := rpcclient.New(connCfg, nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
defer client.Shutdown()
|
||||||
|
|
||||||
|
wallet, err := client.GetBalance("*")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(wallet)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user