Connect

Users can access the signet network in three ways, one is P2P mode, one is RPC mode, and the other is based on ElectrumX protocol access.

一. P2P Node

tcp://106.75.5.22:38333

Sample configuration file:

chain=signet

[signet]
rpcallowip=0.0.0.0/0
rpcbind=192.168.2.163
bind=user-machine-ip:38333
server=1
rpcpassword=sathub.pass
rpcuser=sathub.user
connect=106.75.5.22:38333
txindex=1

signetchallenge=5121038cce116112da87846abb3eea7ed6dc04d362f9a5d11dd575bdcd96df8bbd0f11210282a43fc95da4bb52533294867733b70140507745367f11c8c674972c1def3c322103878af834b52bfad5b8904bd41ea06007cf9c411719591d7d4be71dde6a37616653ae

fallbackfee=0.00001
onlynet=ipv4
onlynet=ipv6
noonion=1
deprecatedrpc=create_bdb

二. Electrumx Service

Sample configuration of Electrs is:

auth = "rpcuser:rpcpass"

daemon_p2p_addr = "bitcoind-node-ip:38333"
daemon_rpc_addr = "bitcoind-node-ip:38332"

electrum_rpc_addr = "0.0.0.0:60601"

log_filters = "INFO"

network = "signet"

server_banner = "Welcome to Sathub Signet testing ground"

skip_block_download_wait = true

signet_magic = "a92b03d3"

Example code with golang:

package main
import (
	"context"
	"log"
	"time"
	"github.com/checksum0/go-electrum/electrum"
)
func main() {
	client, err := electrum.NewClientTCP(context.Background(), "node.sathub.io:60601")
	if err != nil {
		log.Fatal(err)
	}

	serverVer, protocolVer, err := client.ServerVersion(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Server version: %s [Protocol %s]", serverVer, protocolVer)

	go func() {
		for {
			if err := client.Ping(context.Background()); err != nil {
				log.Fatal(err)
			}
			if banner, err := client.ServerBanner(context.Background()); err != nil {
				log.Fatal(err)
			} else {
				log.Printf("Server banner: %s", banner)
			}
			time.Sleep(3 * time.Second)
		}
	}()
	select {}
    }

三. Bitcoin Core RPC

Example code of golang

package main
import (
	"log"
	bitcoind "github.com/satshub/go-bitcoind/jsonrpc"
)

const (
	SERVER_HOST        = "106.75.5.22"
	SERVER_PORT        = 38332
	USER               = "sathub.user"
	PASSWD             = "sathub.pass"
	USESSL             = false
)

func main() {
	bc, err := bitcoind.New(SERVER_HOST, SERVER_PORT, USER, PASSWD, USESSL)
	if err != nil {
		log.Fatalln(err)
	}
	// getbestblockhash
	bestblockhash, err := bc.GetBestBlockhash()
	log.Println(err, bestblockhash)
}

If you want to get more information, please contact the maintainer via X/Twitter Message Box

Last updated