From 7fa543b52706c8bcee5c6545f910fceeadd17a55 Mon Sep 17 00:00:00 2001 From: Shannon Appelcline Date: Tue, 1 Sep 2020 09:22:00 -1000 Subject: [PATCH] Create 17_1_getaddress.go --- src/17_1_getaddress.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/17_1_getaddress.go diff --git a/src/17_1_getaddress.go b/src/17_1_getaddress.go new file mode 100644 index 0000000..72625e0 --- /dev/null +++ b/src/17_1_getaddress.go @@ -0,0 +1,30 @@ +package main + +import ( + "log" + "fmt" + "github.com/btcsuite/btcd/rpcclient" + "github.com/btcsuite/btcd/chaincfg" +) + +func main() { + connCfg := &rpcclient.ConnConfig{ + Host: "localhost:18332", + User: "StandUp", + Pass: "431451790e3eee1913115b9dd2fbf0ac", + HTTPPostMode: true, + DisableTLS: true, + Params: chaincfg.TestNet3Params.Name, + } + client, err := rpcclient.New(connCfg, nil) + if err != nil { + log.Fatal(err) + } + defer client.Shutdown() + + address, err := client.GetNewAddress("") + if err != nil { + log.Fatal(err) + } + fmt.Println(address) +}