mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			705 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			705 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import (
 | |
| 	"log"
 | |
| 	"fmt"
 | |
| 	"github.com/btcsuite/btcd/rpcclient"
 | |
| 	"github.com/btcsuite/btcd/chaincfg/chainhash"
 | |
| )
 | |
| 
 | |
| 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()
 | |
| 
 | |
| 	chash, err := chainhash.NewHashFromStr("1661ce322c128e053b8ea8fcc22d17df680d2052983980e2281d692b9b4ab7df")
 | |
| 	if err != nil {
 | |
| 		log.Fatal(err)
 | |
| 	}
 | |
| 	transactions, err := client.GetTransaction(chash)
 | |
| 	if err != nil {
 | |
| 		log.Fatal(err)
 | |
| 	}
 | |
| 
 | |
| 	fmt.Println(transactions)
 | |
| }
 |