Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to detect btcd version #2250

Closed
nguyenHoang32 opened this issue Sep 14, 2024 · 0 comments
Closed

unable to detect btcd version #2250

nguyenHoang32 opened this issue Sep 14, 2024 · 0 comments

Comments

@nguyenHoang32
Copy link

Getting the block count was successful. Block: 861271.
However, when I call client.GetBlockChainInfo(), I get an error: "Unable to detect btcd version. Status code: 403, response: ''".

`package main

import (
"fmt"
"log"

"github.com/btcsuite/btcd/rpcclient"

)

func main() {
// RPC server details
username := "1"
password := "1"

// Create a new RPC connection configuration
connCfg := &rpcclient.ConnConfig{
	Host:         "go.getblock.io/66247efe0af84dfab9814fc368fb473a",
	User:         username,
	Pass:         password,
	HTTPPostMode: true,
	DisableTLS:   false, // Set to true if you don't use TLS
}
fmt.Println(connCfg.Host)
// Create a new RPC client
client, err := rpcclient.New(connCfg, nil)
if err != nil {
	log.Fatalf("Error creating new RPC client: %v", err)
}
defer client.Shutdown()
block, err := client.GetBlockCount()
fmt.Println("Block", block)
if err != nil {
	log.Fatalf("Error retrieving blockchain info: %v", err)
}
// Retrieve blockchain info
blockchainInfo, err := client.GetBlockChainInfo()
if err != nil {
	log.Fatalf("Error retrieving blockchain info: %v", err)
}

// Print blockchain info
fmt.Printf("Chain: %s\n", blockchainInfo.Chain)

}
`

@nguyenHoang32 nguyenHoang32 changed the title unable to detect btcd version: unable to detect btcd version Sep 14, 2024
@btcsuite btcsuite locked and limited conversation to collaborators Sep 15, 2024
@guggero guggero converted this issue into discussion #2251 Sep 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant