Create 17_1_getaddress.go

This commit is contained in:
Shannon Appelcline 2020-09-01 09:22:00 -10:00 committed by GitHub
parent d855a8422e
commit 7fa543b527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

30
src/17_1_getaddress.go Normal file
View File

@ -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)
}