mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 18:37:36 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			575 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			575 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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)
 | |
| }
 |