mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-05 21:56:50 +00:00
[NOD-499] Change ports and network magics (#550)
* [NOD-499] Change network magics * [NOD-499] Change default rpc ports * [NOD-499] Change default p2p ports * [NOD-499] Change port 18333 to 10433 everywhere * [NOD-499] Change port 8333 to 10333 everywhere * [NOD-499] Fix TestElementWire * [NOD-499] Fix tests * [NOD-499] Change port 10333->16111 and 10332->16110 * [NOD-499] Change port 10433->16211 and 10432->16210 * [NOD-499] Change port 10633->16511 and 10632->16510 * [NOD-499] Change port 10533->16611 and 10532->16610
This commit is contained in:
parent
0d1f447cb7
commit
f72afc8bbb
@ -38,59 +38,59 @@ var someIP = "173.194.115.66"
|
|||||||
func addNaTests() {
|
func addNaTests() {
|
||||||
// IPv4
|
// IPv4
|
||||||
// Localhost
|
// Localhost
|
||||||
addNaTest("127.0.0.1", 8333, "127.0.0.1:8333")
|
addNaTest("127.0.0.1", 16111, "127.0.0.1:16111")
|
||||||
addNaTest("127.0.0.1", 8334, "127.0.0.1:8334")
|
addNaTest("127.0.0.1", 16110, "127.0.0.1:16110")
|
||||||
|
|
||||||
// Class A
|
// Class A
|
||||||
addNaTest("1.0.0.1", 8333, "1.0.0.1:8333")
|
addNaTest("1.0.0.1", 16111, "1.0.0.1:16111")
|
||||||
addNaTest("2.2.2.2", 8334, "2.2.2.2:8334")
|
addNaTest("2.2.2.2", 16110, "2.2.2.2:16110")
|
||||||
addNaTest("27.253.252.251", 8335, "27.253.252.251:8335")
|
addNaTest("27.253.252.251", 8335, "27.253.252.251:8335")
|
||||||
addNaTest("123.3.2.1", 8336, "123.3.2.1:8336")
|
addNaTest("123.3.2.1", 8336, "123.3.2.1:8336")
|
||||||
|
|
||||||
// Private Class A
|
// Private Class A
|
||||||
addNaTest("10.0.0.1", 8333, "10.0.0.1:8333")
|
addNaTest("10.0.0.1", 16111, "10.0.0.1:16111")
|
||||||
addNaTest("10.1.1.1", 8334, "10.1.1.1:8334")
|
addNaTest("10.1.1.1", 16110, "10.1.1.1:16110")
|
||||||
addNaTest("10.2.2.2", 8335, "10.2.2.2:8335")
|
addNaTest("10.2.2.2", 8335, "10.2.2.2:8335")
|
||||||
addNaTest("10.10.10.10", 8336, "10.10.10.10:8336")
|
addNaTest("10.10.10.10", 8336, "10.10.10.10:8336")
|
||||||
|
|
||||||
// Class B
|
// Class B
|
||||||
addNaTest("128.0.0.1", 8333, "128.0.0.1:8333")
|
addNaTest("128.0.0.1", 16111, "128.0.0.1:16111")
|
||||||
addNaTest("129.1.1.1", 8334, "129.1.1.1:8334")
|
addNaTest("129.1.1.1", 16110, "129.1.1.1:16110")
|
||||||
addNaTest("180.2.2.2", 8335, "180.2.2.2:8335")
|
addNaTest("180.2.2.2", 8335, "180.2.2.2:8335")
|
||||||
addNaTest("191.10.10.10", 8336, "191.10.10.10:8336")
|
addNaTest("191.10.10.10", 8336, "191.10.10.10:8336")
|
||||||
|
|
||||||
// Private Class B
|
// Private Class B
|
||||||
addNaTest("172.16.0.1", 8333, "172.16.0.1:8333")
|
addNaTest("172.16.0.1", 16111, "172.16.0.1:16111")
|
||||||
addNaTest("172.16.1.1", 8334, "172.16.1.1:8334")
|
addNaTest("172.16.1.1", 16110, "172.16.1.1:16110")
|
||||||
addNaTest("172.16.2.2", 8335, "172.16.2.2:8335")
|
addNaTest("172.16.2.2", 8335, "172.16.2.2:8335")
|
||||||
addNaTest("172.16.172.172", 8336, "172.16.172.172:8336")
|
addNaTest("172.16.172.172", 8336, "172.16.172.172:8336")
|
||||||
|
|
||||||
// Class C
|
// Class C
|
||||||
addNaTest("193.0.0.1", 8333, "193.0.0.1:8333")
|
addNaTest("193.0.0.1", 16111, "193.0.0.1:16111")
|
||||||
addNaTest("200.1.1.1", 8334, "200.1.1.1:8334")
|
addNaTest("200.1.1.1", 16110, "200.1.1.1:16110")
|
||||||
addNaTest("205.2.2.2", 8335, "205.2.2.2:8335")
|
addNaTest("205.2.2.2", 8335, "205.2.2.2:8335")
|
||||||
addNaTest("223.10.10.10", 8336, "223.10.10.10:8336")
|
addNaTest("223.10.10.10", 8336, "223.10.10.10:8336")
|
||||||
|
|
||||||
// Private Class C
|
// Private Class C
|
||||||
addNaTest("192.168.0.1", 8333, "192.168.0.1:8333")
|
addNaTest("192.168.0.1", 16111, "192.168.0.1:16111")
|
||||||
addNaTest("192.168.1.1", 8334, "192.168.1.1:8334")
|
addNaTest("192.168.1.1", 16110, "192.168.1.1:16110")
|
||||||
addNaTest("192.168.2.2", 8335, "192.168.2.2:8335")
|
addNaTest("192.168.2.2", 8335, "192.168.2.2:8335")
|
||||||
addNaTest("192.168.192.192", 8336, "192.168.192.192:8336")
|
addNaTest("192.168.192.192", 8336, "192.168.192.192:8336")
|
||||||
|
|
||||||
// IPv6
|
// IPv6
|
||||||
// Localhost
|
// Localhost
|
||||||
addNaTest("::1", 8333, "[::1]:8333")
|
addNaTest("::1", 16111, "[::1]:16111")
|
||||||
addNaTest("fe80::1", 8334, "[fe80::1]:8334")
|
addNaTest("fe80::1", 16110, "[fe80::1]:16110")
|
||||||
|
|
||||||
// Link-local
|
// Link-local
|
||||||
addNaTest("fe80::1:1", 8333, "[fe80::1:1]:8333")
|
addNaTest("fe80::1:1", 16111, "[fe80::1:1]:16111")
|
||||||
addNaTest("fe91::2:2", 8334, "[fe91::2:2]:8334")
|
addNaTest("fe91::2:2", 16110, "[fe91::2:2]:16110")
|
||||||
addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335")
|
addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335")
|
||||||
addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336")
|
addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336")
|
||||||
|
|
||||||
// Site-local
|
// Site-local
|
||||||
addNaTest("fec0::1:1", 8333, "[fec0::1:1]:8333")
|
addNaTest("fec0::1:1", 16111, "[fec0::1:1]:16111")
|
||||||
addNaTest("fed1::2:2", 8334, "[fed1::2:2]:8334")
|
addNaTest("fed1::2:2", 16110, "[fed1::2:2]:16110")
|
||||||
addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335")
|
addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335")
|
||||||
addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336")
|
addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336")
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ func TestAddAddressByIP(t *testing.T) {
|
|||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
someIP + ":8333",
|
someIP + ":16111",
|
||||||
nil,
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ func TestIPTypes(t *testing.T) {
|
|||||||
rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598,
|
rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598,
|
||||||
local, valid, routable bool) ipTest {
|
local, valid, routable bool) ipTest {
|
||||||
nip := net.ParseIP(ip)
|
nip := net.ParseIP(ip)
|
||||||
na := *wire.NewNetAddressIPPort(nip, 8333, wire.SFNodeNetwork)
|
na := *wire.NewNetAddressIPPort(nip, 16111, wire.SFNodeNetwork)
|
||||||
test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380,
|
test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380,
|
||||||
rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable}
|
rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable}
|
||||||
return test
|
return test
|
||||||
|
@ -209,7 +209,7 @@ func TestHaveBlock(t *testing.T) {
|
|||||||
{hash: dagconfig.SimNetParams.GenesisHash.String(), want: true},
|
{hash: dagconfig.SimNetParams.GenesisHash.String(), want: true},
|
||||||
|
|
||||||
// Block 3b should be present (as a second child of Block 2).
|
// Block 3b should be present (as a second child of Block 2).
|
||||||
{hash: "6ffe9704c50b3f1892ce9e667337304ec0e9eb50a23673bc8ff7aaa20745ee4a", want: true},
|
{hash: "09e5e38f3fa2c5104b72b2f7122b2245085331e0d8cd1df79a3b12d66666ecb3", want: true},
|
||||||
|
|
||||||
// Block 100000 should be present (as an orphan).
|
// Block 100000 should be present (as an orphan).
|
||||||
{hash: "65b20b048a074793ebfd1196e49341c8d194dabfc6b44a4fd0c607406e122baf", want: true},
|
{hash: "65b20b048a074793ebfd1196e49341c8d194dabfc6b44a4fd0c607406e122baf", want: true},
|
||||||
|
BIN
blockdag/testdata/blk_0_to_4.dat
vendored
BIN
blockdag/testdata/blk_0_to_4.dat
vendored
Binary file not shown.
BIN
blockdag/testdata/blk_3A.dat
vendored
BIN
blockdag/testdata/blk_3A.dat
vendored
Binary file not shown.
BIN
blockdag/testdata/blk_3B.dat
vendored
BIN
blockdag/testdata/blk_3B.dat
vendored
Binary file not shown.
BIN
blockdag/testdata/blk_3C.dat
vendored
BIN
blockdag/testdata/blk_3C.dat
vendored
Binary file not shown.
BIN
blockdag/testdata/blk_3D.dat
vendored
BIN
blockdag/testdata/blk_3D.dat
vendored
Binary file not shown.
@ -116,13 +116,13 @@ func normalizeAddress(addr string, useTestNet, useSimNet, useDevNet bool) string
|
|||||||
var defaultPort string
|
var defaultPort string
|
||||||
switch {
|
switch {
|
||||||
case useDevNet:
|
case useDevNet:
|
||||||
fallthrough
|
defaultPort = "16610"
|
||||||
case useTestNet:
|
case useTestNet:
|
||||||
defaultPort = "18334"
|
defaultPort = "16210"
|
||||||
case useSimNet:
|
case useSimNet:
|
||||||
defaultPort = "18556"
|
defaultPort = "16510"
|
||||||
default:
|
default:
|
||||||
defaultPort = "8334"
|
defaultPort = "16110"
|
||||||
}
|
}
|
||||||
|
|
||||||
return net.JoinHostPort(addr, defaultPort)
|
return net.JoinHostPort(addr, defaultPort)
|
||||||
|
@ -99,7 +99,7 @@ type Flags struct {
|
|||||||
AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
|
AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
|
||||||
ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"`
|
ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"`
|
||||||
DisableListen bool `long:"nolisten" description:"Disable listening for incoming connections -- NOTE: Listening is automatically disabled if the --connect or --proxy options are used without also specifying listen interfaces via --listen"`
|
DisableListen bool `long:"nolisten" description:"Disable listening for incoming connections -- NOTE: Listening is automatically disabled if the --connect or --proxy options are used without also specifying listen interfaces via --listen"`
|
||||||
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 8333, testnet: 18333)"`
|
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 16111, testnet: 16211)"`
|
||||||
TargetOutboundPeers int `long:"outpeers" description:"Target number of outbound peers"`
|
TargetOutboundPeers int `long:"outpeers" description:"Target number of outbound peers"`
|
||||||
MaxInboundPeers int `long:"maxinpeers" description:"Max number of inbound peers"`
|
MaxInboundPeers int `long:"maxinpeers" description:"Max number of inbound peers"`
|
||||||
DisableBanning bool `long:"nobanning" description:"Disable banning of misbehaving peers"`
|
DisableBanning bool `long:"nobanning" description:"Disable banning of misbehaving peers"`
|
||||||
@ -110,7 +110,7 @@ type Flags struct {
|
|||||||
RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
|
RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
|
||||||
RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"`
|
RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"`
|
||||||
RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
|
RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
|
||||||
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 8334, testnet: 18334)"`
|
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 16110, testnet: 16210)"`
|
||||||
RPCCert string `long:"rpccert" description:"File containing the certificate file"`
|
RPCCert string `long:"rpccert" description:"File containing the certificate file"`
|
||||||
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
||||||
RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
|
RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
|
||||||
|
@ -620,7 +620,7 @@ func TestListeners(t *testing.T) {
|
|||||||
// Setup a connection manager with a couple of mock listeners that
|
// Setup a connection manager with a couple of mock listeners that
|
||||||
// notify a channel when they receive mock connections.
|
// notify a channel when they receive mock connections.
|
||||||
receivedConns := make(chan net.Conn)
|
receivedConns := make(chan net.Conn)
|
||||||
listener1 := newMockListener("127.0.0.1:8333")
|
listener1 := newMockListener("127.0.0.1:16111")
|
||||||
listener2 := newMockListener("127.0.0.1:9333")
|
listener2 := newMockListener("127.0.0.1:9333")
|
||||||
listeners := []net.Listener{listener1, listener2}
|
listeners := []net.Listener{listener1, listener2}
|
||||||
cmgr, err := New(&Config{
|
cmgr, err := New(&Config{
|
||||||
|
@ -182,8 +182,8 @@ var MainNetParams = Params{
|
|||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "mainnet",
|
Name: "mainnet",
|
||||||
Net: wire.MainNet,
|
Net: wire.MainNet,
|
||||||
RPCPort: "8334",
|
RPCPort: "16110",
|
||||||
DefaultPort: "8333",
|
DefaultPort: "16111",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
@ -240,8 +240,8 @@ var RegressionNetParams = Params{
|
|||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "regtest",
|
Name: "regtest",
|
||||||
Net: wire.RegTest,
|
Net: wire.RegTest,
|
||||||
RPCPort: "18334",
|
RPCPort: "16210",
|
||||||
DefaultPort: "18444",
|
DefaultPort: "16211",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
@ -296,8 +296,8 @@ var TestNetParams = Params{
|
|||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "testnet",
|
Name: "testnet",
|
||||||
Net: wire.TestNet,
|
Net: wire.TestNet,
|
||||||
RPCPort: "18334",
|
RPCPort: "16210",
|
||||||
DefaultPort: "18333",
|
DefaultPort: "16211",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
@ -358,8 +358,8 @@ var SimNetParams = Params{
|
|||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "simnet",
|
Name: "simnet",
|
||||||
Net: wire.SimNet,
|
Net: wire.SimNet,
|
||||||
RPCPort: "18556",
|
RPCPort: "16510",
|
||||||
DefaultPort: "18555",
|
DefaultPort: "16511",
|
||||||
DNSSeeds: []string{}, // NOTE: There must NOT be any seeds.
|
DNSSeeds: []string{}, // NOTE: There must NOT be any seeds.
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
@ -412,8 +412,8 @@ var DevNetParams = Params{
|
|||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "devnet",
|
Name: "devnet",
|
||||||
Net: wire.DevNet,
|
Net: wire.DevNet,
|
||||||
RPCPort: "18334",
|
RPCPort: "16610",
|
||||||
DefaultPort: "18333",
|
DefaultPort: "16611",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
|
BIN
database/testdata/blocks1-256.bz2
vendored
BIN
database/testdata/blocks1-256.bz2
vendored
Binary file not shown.
1
database/testdata/generator.go
vendored
1
database/testdata/generator.go
vendored
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/kaspanet/kaspad/dagconfig"
|
"github.com/kaspanet/kaspad/dagconfig"
|
||||||
"github.com/kaspanet/kaspad/util/daghash"
|
"github.com/kaspanet/kaspad/util/daghash"
|
||||||
"github.com/kaspanet/kaspad/wire"
|
"github.com/kaspanet/kaspad/wire"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
4
doc.go
4
doc.go
@ -32,7 +32,7 @@ Application Options:
|
|||||||
or --proxy options are used without also specifying
|
or --proxy options are used without also specifying
|
||||||
listen interfaces via --listen
|
listen interfaces via --listen
|
||||||
--listen= Add an interface/port to listen for connections
|
--listen= Add an interface/port to listen for connections
|
||||||
(default all interfaces port: 8333, testnet: 18333)
|
(default all interfaces port: 16111, testnet: 16211)
|
||||||
--maxpeers= Max number of inbound and outbound peers (125)
|
--maxpeers= Max number of inbound and outbound peers (125)
|
||||||
--nobanning Disable banning of misbehaving peers
|
--nobanning Disable banning of misbehaving peers
|
||||||
--banduration= How long to ban misbehaving peers. Valid time units
|
--banduration= How long to ban misbehaving peers. Valid time units
|
||||||
@ -46,7 +46,7 @@ Application Options:
|
|||||||
--rpclimituser= Username for limited RPC connections
|
--rpclimituser= Username for limited RPC connections
|
||||||
--rpclimitpass= Password for limited RPC connections
|
--rpclimitpass= Password for limited RPC connections
|
||||||
--rpclisten= Add an interface/port to listen for RPC connections
|
--rpclisten= Add an interface/port to listen for RPC connections
|
||||||
(default port: 8334, testnet: 18334)
|
(default port: 16110, testnet: 16210)
|
||||||
--rpccert= File containing the certificate file
|
--rpccert= File containing the certificate file
|
||||||
--rpckey= File containing the certificate key
|
--rpckey= File containing the certificate key
|
||||||
--rpcmaxclients= Max number of RPC clients for standard connections
|
--rpcmaxclients= Max number of RPC clients for standard connections
|
||||||
|
598
docs/README.md
598
docs/README.md
@ -1,299 +1,299 @@
|
|||||||
### Table of Contents
|
### Table of Contents
|
||||||
1. [About](#About)
|
1. [About](#About)
|
||||||
2. [Getting Started](#GettingStarted)
|
2. [Getting Started](#GettingStarted)
|
||||||
1. [Installation](#Installation)
|
1. [Installation](#Installation)
|
||||||
1. [Windows](#WindowsInstallation)
|
1. [Windows](#WindowsInstallation)
|
||||||
2. [Linux/BSD/MacOSX/POSIX](#PosixInstallation)
|
2. [Linux/BSD/MacOSX/POSIX](#PosixInstallation)
|
||||||
1. [Gentoo Linux](#GentooInstallation)
|
1. [Gentoo Linux](#GentooInstallation)
|
||||||
2. [Configuration](#Configuration)
|
2. [Configuration](#Configuration)
|
||||||
3. [Controlling and Querying btcd via btcctl](#BtcctlConfig)
|
3. [Controlling and Querying btcd via btcctl](#BtcctlConfig)
|
||||||
4. [Mining](#Mining)
|
4. [Mining](#Mining)
|
||||||
3. [Help](#Help)
|
3. [Help](#Help)
|
||||||
1. [Startup](#Startup)
|
1. [Startup](#Startup)
|
||||||
1. [Using bootstrap.dat](#BootstrapDat)
|
1. [Using bootstrap.dat](#BootstrapDat)
|
||||||
2. [Network Configuration](#NetworkConfig)
|
2. [Network Configuration](#NetworkConfig)
|
||||||
3. [Wallet](#Wallet)
|
3. [Wallet](#Wallet)
|
||||||
4. [Contact](#Contact)
|
4. [Contact](#Contact)
|
||||||
1. [IRC](#ContactIRC)
|
1. [IRC](#ContactIRC)
|
||||||
2. [Mailing Lists](#MailingLists)
|
2. [Mailing Lists](#MailingLists)
|
||||||
5. [Developer Resources](#DeveloperResources)
|
5. [Developer Resources](#DeveloperResources)
|
||||||
1. [Code Contribution Guidelines](#ContributionGuidelines)
|
1. [Code Contribution Guidelines](#ContributionGuidelines)
|
||||||
2. [JSON-RPC Reference](#JSONRPCReference)
|
2. [JSON-RPC Reference](#JSONRPCReference)
|
||||||
3. [The btcsuite Bitcoin-related Go Packages](#GoPackages)
|
3. [The btcsuite Bitcoin-related Go Packages](#GoPackages)
|
||||||
|
|
||||||
<a name="About" />
|
<a name="About" />
|
||||||
|
|
||||||
### 1. About
|
### 1. About
|
||||||
|
|
||||||
btcd is a full node bitcoin implementation written in [Go](http://golang.org),
|
btcd is a full node bitcoin implementation written in [Go](http://golang.org),
|
||||||
licensed under the [copyfree](http://www.copyfree.org) ISC License.
|
licensed under the [copyfree](http://www.copyfree.org) ISC License.
|
||||||
|
|
||||||
This project is currently under active development and is in a Beta state. It
|
This project is currently under active development and is in a Beta state. It
|
||||||
is extremely stable and has been in production use since October 2013.
|
is extremely stable and has been in production use since October 2013.
|
||||||
|
|
||||||
It properly downloads, validates, and serves the block chain using the exact
|
It properly downloads, validates, and serves the block chain using the exact
|
||||||
rules (including consensus bugs) for block acceptance as Bitcoin Core. We have
|
rules (including consensus bugs) for block acceptance as Bitcoin Core. We have
|
||||||
taken great care to avoid btcd causing a fork to the block chain. It includes a
|
taken great care to avoid btcd causing a fork to the block chain. It includes a
|
||||||
full block validation testing framework which contains all of the 'official'
|
full block validation testing framework which contains all of the 'official'
|
||||||
block acceptance tests (and some additional ones) that is run on every pull
|
block acceptance tests (and some additional ones) that is run on every pull
|
||||||
request to help ensure it properly follows consensus. Also, it passes all of
|
request to help ensure it properly follows consensus. Also, it passes all of
|
||||||
the JSON test data in the Bitcoin Core code.
|
the JSON test data in the Bitcoin Core code.
|
||||||
|
|
||||||
It also properly relays newly mined blocks, maintains a transaction pool, and
|
It also properly relays newly mined blocks, maintains a transaction pool, and
|
||||||
relays individual transactions that have not yet made it into a block. It
|
relays individual transactions that have not yet made it into a block. It
|
||||||
ensures all individual transactions admitted to the pool follow the rules
|
ensures all individual transactions admitted to the pool follow the rules
|
||||||
required by the block chain and also includes more strict checks which filter
|
required by the block chain and also includes more strict checks which filter
|
||||||
transactions based on miner requirements ("standard" transactions).
|
transactions based on miner requirements ("standard" transactions).
|
||||||
|
|
||||||
One key difference between btcd and Bitcoin Core is that btcd does *NOT* include
|
One key difference between btcd and Bitcoin Core is that btcd does *NOT* include
|
||||||
wallet functionality and this was a very intentional design decision. See the
|
wallet functionality and this was a very intentional design decision. See the
|
||||||
blog entry [here](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon)
|
blog entry [here](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon)
|
||||||
for more details. This means you can't actually make or receive payments
|
for more details. This means you can't actually make or receive payments
|
||||||
directly with btcd. That functionality is provided by the
|
directly with btcd. That functionality is provided by the
|
||||||
[btcwallet](https://github.com/btcsuite/btcwallet) and
|
[btcwallet](https://github.com/btcsuite/btcwallet) and
|
||||||
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
|
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
|
||||||
which are both under active development.
|
which are both under active development.
|
||||||
|
|
||||||
<a name="GettingStarted" />
|
<a name="GettingStarted" />
|
||||||
|
|
||||||
### 2. Getting Started
|
### 2. Getting Started
|
||||||
|
|
||||||
<a name="Installation" />
|
<a name="Installation" />
|
||||||
|
|
||||||
**2.1 Installation**
|
**2.1 Installation**
|
||||||
|
|
||||||
The first step is to install btcd. See one of the following sections for
|
The first step is to install btcd. See one of the following sections for
|
||||||
details on how to install on the supported operating systems.
|
details on how to install on the supported operating systems.
|
||||||
|
|
||||||
<a name="WindowsInstallation" />
|
<a name="WindowsInstallation" />
|
||||||
|
|
||||||
**2.1.1 Windows Installation**<br />
|
**2.1.1 Windows Installation**<br />
|
||||||
|
|
||||||
* Install the MSI available at: https://github.com/kaspanet/kaspad/releases
|
* Install the MSI available at: https://github.com/kaspanet/kaspad/releases
|
||||||
* Launch btcd from the Start Menu
|
* Launch btcd from the Start Menu
|
||||||
|
|
||||||
<a name="PosixInstallation" />
|
<a name="PosixInstallation" />
|
||||||
|
|
||||||
**2.1.2 Linux/BSD/MacOSX/POSIX Installation**
|
**2.1.2 Linux/BSD/MacOSX/POSIX Installation**
|
||||||
|
|
||||||
|
|
||||||
- Install Go according to the installation instructions here:
|
- Install Go according to the installation instructions here:
|
||||||
http://golang.org/doc/install
|
http://golang.org/doc/install
|
||||||
|
|
||||||
- Ensure Go was installed properly and is a supported version:
|
- Ensure Go was installed properly and is a supported version:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ go version
|
$ go version
|
||||||
$ go env GOROOT GOPATH
|
$ go env GOROOT GOPATH
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: The `GOROOT` and `GOPATH` above must not be the same path. It is
|
NOTE: The `GOROOT` and `GOPATH` above must not be the same path. It is
|
||||||
recommended that `GOPATH` is set to a directory in your home directory such as
|
recommended that `GOPATH` is set to a directory in your home directory such as
|
||||||
`~/goprojects` to avoid write permission issues. It is also recommended to add
|
`~/goprojects` to avoid write permission issues. It is also recommended to add
|
||||||
`$GOPATH/bin` to your `PATH` at this point.
|
`$GOPATH/bin` to your `PATH` at this point.
|
||||||
|
|
||||||
- Run the following commands to obtain btcd, all dependencies, and install it:
|
- Run the following commands to obtain btcd, all dependencies, and install it:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ go get -u github.com/Masterminds/glide
|
$ go get -u github.com/Masterminds/glide
|
||||||
$ git clone https://github.com/kaspanet/kaspad $GOPATH/src/github.com/kaspanet/kaspad
|
$ git clone https://github.com/kaspanet/kaspad $GOPATH/src/github.com/kaspanet/kaspad
|
||||||
$ cd $GOPATH/src/github.com/kaspanet/kaspad
|
$ cd $GOPATH/src/github.com/kaspanet/kaspad
|
||||||
$ glide install
|
$ glide install
|
||||||
$ go install . ./cmd/...
|
$ go install . ./cmd/...
|
||||||
```
|
```
|
||||||
|
|
||||||
- btcd (and utilities) will now be installed in ```$GOPATH/bin```. If you did
|
- btcd (and utilities) will now be installed in ```$GOPATH/bin```. If you did
|
||||||
not already add the bin directory to your system path during Go installation,
|
not already add the bin directory to your system path during Go installation,
|
||||||
we recommend you do so now.
|
we recommend you do so now.
|
||||||
|
|
||||||
**Updating**
|
**Updating**
|
||||||
|
|
||||||
- Run the following commands to update btcd, all dependencies, and install it:
|
- Run the following commands to update btcd, all dependencies, and install it:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cd $GOPATH/src/github.com/kaspanet/kaspad
|
$ cd $GOPATH/src/github.com/kaspanet/kaspad
|
||||||
$ git pull && glide install
|
$ git pull && glide install
|
||||||
$ go install . ./cmd/...
|
$ go install . ./cmd/...
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="GentooInstallation" />
|
<a name="GentooInstallation" />
|
||||||
|
|
||||||
**2.1.2.1 Gentoo Linux Installation**
|
**2.1.2.1 Gentoo Linux Installation**
|
||||||
|
|
||||||
* Install Layman and enable the Bitcoin overlay.
|
* Install Layman and enable the Bitcoin overlay.
|
||||||
* https://gitlab.com/bitcoin/gentoo
|
* https://gitlab.com/bitcoin/gentoo
|
||||||
* Copy or symlink `/var/lib/layman/bitcoin/Documentation/package.keywords/btcd-live` to `/etc/portage/package.keywords/`
|
* Copy or symlink `/var/lib/layman/bitcoin/Documentation/package.keywords/btcd-live` to `/etc/portage/package.keywords/`
|
||||||
* Install btcd: `$ emerge net-p2p/btcd`
|
* Install btcd: `$ emerge net-p2p/btcd`
|
||||||
|
|
||||||
<a name="Configuration" />
|
<a name="Configuration" />
|
||||||
|
|
||||||
**2.2 Configuration**
|
**2.2 Configuration**
|
||||||
|
|
||||||
btcd has a number of [configuration](http://godoc.org/github.com/kaspanet/kaspad)
|
btcd has a number of [configuration](http://godoc.org/github.com/kaspanet/kaspad)
|
||||||
options, which can be viewed by running: `$ btcd --help`.
|
options, which can be viewed by running: `$ btcd --help`.
|
||||||
|
|
||||||
<a name="BtcctlConfig" />
|
<a name="BtcctlConfig" />
|
||||||
|
|
||||||
**2.3 Controlling and Querying btcd via btcctl**
|
**2.3 Controlling and Querying btcd via btcctl**
|
||||||
|
|
||||||
btcctl is a command line utility that can be used to both control and query btcd
|
btcctl is a command line utility that can be used to both control and query btcd
|
||||||
via [RPC](http://www.wikipedia.org/wiki/Remote_procedure_call). btcd does
|
via [RPC](http://www.wikipedia.org/wiki/Remote_procedure_call). btcd does
|
||||||
**not** enable its RPC server by default; You must configure at minimum both an
|
**not** enable its RPC server by default; You must configure at minimum both an
|
||||||
RPC username and password or both an RPC limited username and password:
|
RPC username and password or both an RPC limited username and password:
|
||||||
|
|
||||||
* btcd.conf configuration file
|
* btcd.conf configuration file
|
||||||
```
|
```
|
||||||
[Application Options]
|
[Application Options]
|
||||||
rpcuser=myuser
|
rpcuser=myuser
|
||||||
rpcpass=SomeDecentp4ssw0rd
|
rpcpass=SomeDecentp4ssw0rd
|
||||||
rpclimituser=mylimituser
|
rpclimituser=mylimituser
|
||||||
rpclimitpass=Limitedp4ssw0rd
|
rpclimitpass=Limitedp4ssw0rd
|
||||||
```
|
```
|
||||||
* btcctl.conf configuration file
|
* btcctl.conf configuration file
|
||||||
```
|
```
|
||||||
[Application Options]
|
[Application Options]
|
||||||
rpcuser=myuser
|
rpcuser=myuser
|
||||||
rpcpass=SomeDecentp4ssw0rd
|
rpcpass=SomeDecentp4ssw0rd
|
||||||
```
|
```
|
||||||
OR
|
OR
|
||||||
```
|
```
|
||||||
[Application Options]
|
[Application Options]
|
||||||
rpclimituser=mylimituser
|
rpclimituser=mylimituser
|
||||||
rpclimitpass=Limitedp4ssw0rd
|
rpclimitpass=Limitedp4ssw0rd
|
||||||
```
|
```
|
||||||
For a list of available options, run: `$ btcctl --help`
|
For a list of available options, run: `$ btcctl --help`
|
||||||
|
|
||||||
<a name="Mining" />
|
<a name="Mining" />
|
||||||
|
|
||||||
**2.4 Mining**
|
**2.4 Mining**
|
||||||
|
|
||||||
btcd supports the `getblocktemplate` RPC.
|
btcd supports the `getblocktemplate` RPC.
|
||||||
The limited user cannot access this RPC.
|
The limited user cannot access this RPC.
|
||||||
|
|
||||||
|
|
||||||
**1. Add the payment addresses with the `miningaddr` option.**
|
**1. Add the payment addresses with the `miningaddr` option.**
|
||||||
|
|
||||||
```
|
```
|
||||||
[Application Options]
|
[Application Options]
|
||||||
rpcuser=myuser
|
rpcuser=myuser
|
||||||
rpcpass=SomeDecentp4ssw0rd
|
rpcpass=SomeDecentp4ssw0rd
|
||||||
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
|
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
|
||||||
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
|
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
|
||||||
```
|
```
|
||||||
|
|
||||||
**2. Add btcd's RPC TLS certificate to system Certificate Authority list.**
|
**2. Add btcd's RPC TLS certificate to system Certificate Authority list.**
|
||||||
|
|
||||||
`cgminer` uses [curl](http://curl.haxx.se/) to fetch data from the RPC server.
|
`cgminer` uses [curl](http://curl.haxx.se/) to fetch data from the RPC server.
|
||||||
Since curl validates the certificate by default, we must install the `btcd` RPC
|
Since curl validates the certificate by default, we must install the `btcd` RPC
|
||||||
certificate into the default system Certificate Authority list.
|
certificate into the default system Certificate Authority list.
|
||||||
|
|
||||||
**Ubuntu**
|
**Ubuntu**
|
||||||
|
|
||||||
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt`
|
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt`
|
||||||
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf`
|
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf`
|
||||||
3. Update the CA certificate list: `# update-ca-certificates`
|
3. Update the CA certificate list: `# update-ca-certificates`
|
||||||
|
|
||||||
**3. Set your mining software url to use https.**
|
**3. Set your mining software url to use https.**
|
||||||
|
|
||||||
`$ cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword`
|
`$ cgminer -o https://127.0.0.1:16110 -u rpcuser -p rpcpassword`
|
||||||
|
|
||||||
<a name="Help" />
|
<a name="Help" />
|
||||||
|
|
||||||
### 3. Help
|
### 3. Help
|
||||||
|
|
||||||
<a name="Startup" />
|
<a name="Startup" />
|
||||||
|
|
||||||
**3.1 Startup**
|
**3.1 Startup**
|
||||||
|
|
||||||
Typically btcd will run and start downloading the block chain with no extra
|
Typically btcd will run and start downloading the block chain with no extra
|
||||||
configuration necessary, however, there is an optional method to use a
|
configuration necessary, however, there is an optional method to use a
|
||||||
`bootstrap.dat` file that may speed up the initial block chain download process.
|
`bootstrap.dat` file that may speed up the initial block chain download process.
|
||||||
|
|
||||||
<a name="BootstrapDat" />
|
<a name="BootstrapDat" />
|
||||||
|
|
||||||
**3.1.1 bootstrap.dat**
|
**3.1.1 bootstrap.dat**
|
||||||
|
|
||||||
* [Using bootstrap.dat](https://github.com/kaspanet/kaspad/tree/master/docs/using_bootstrap_dat.md)
|
* [Using bootstrap.dat](https://github.com/kaspanet/kaspad/tree/master/docs/using_bootstrap_dat.md)
|
||||||
|
|
||||||
<a name="NetworkConfig" />
|
<a name="NetworkConfig" />
|
||||||
|
|
||||||
**3.1.2 Network Configuration**
|
**3.1.2 Network Configuration**
|
||||||
|
|
||||||
* [What Ports Are Used by Default?](https://github.com/kaspanet/kaspad/tree/master/docs/default_ports.md)
|
* [What Ports Are Used by Default?](https://github.com/kaspanet/kaspad/tree/master/docs/default_ports.md)
|
||||||
* [How To Listen on Specific Interfaces](https://github.com/kaspanet/kaspad/tree/master/docs/configure_peer_server_listen_interfaces.md)
|
* [How To Listen on Specific Interfaces](https://github.com/kaspanet/kaspad/tree/master/docs/configure_peer_server_listen_interfaces.md)
|
||||||
* [How To Configure RPC Server to Listen on Specific Interfaces](https://github.com/kaspanet/kaspad/tree/master/docs/configure_rpc_server_listen_interfaces.md)
|
* [How To Configure RPC Server to Listen on Specific Interfaces](https://github.com/kaspanet/kaspad/tree/master/docs/configure_rpc_server_listen_interfaces.md)
|
||||||
* [Configuring btcd with Tor](https://github.com/kaspanet/kaspad/tree/master/docs/configuring_tor.md)
|
* [Configuring btcd with Tor](https://github.com/kaspanet/kaspad/tree/master/docs/configuring_tor.md)
|
||||||
|
|
||||||
<a name="Wallet" />
|
<a name="Wallet" />
|
||||||
|
|
||||||
**3.1 Wallet**
|
**3.1 Wallet**
|
||||||
|
|
||||||
btcd was intentionally developed without an integrated wallet for security
|
btcd was intentionally developed without an integrated wallet for security
|
||||||
reasons. Please see [btcwallet](https://github.com/btcsuite/btcwallet) for more
|
reasons. Please see [btcwallet](https://github.com/btcsuite/btcwallet) for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
|
|
||||||
<a name="Contact" />
|
<a name="Contact" />
|
||||||
|
|
||||||
### 4. Contact
|
### 4. Contact
|
||||||
|
|
||||||
<a name="ContactIRC" />
|
<a name="ContactIRC" />
|
||||||
|
|
||||||
**4.1 IRC**
|
**4.1 IRC**
|
||||||
|
|
||||||
* [irc.freenode.net](irc://irc.freenode.net), channel `#btcd`
|
* [irc.freenode.net](irc://irc.freenode.net), channel `#btcd`
|
||||||
|
|
||||||
<a name="MailingLists" />
|
<a name="MailingLists" />
|
||||||
|
|
||||||
**4.2 Mailing Lists**
|
**4.2 Mailing Lists**
|
||||||
|
|
||||||
* <a href="mailto:btcd+subscribe@opensource.conformal.com">btcd</a>: discussion
|
* <a href="mailto:btcd+subscribe@opensource.conformal.com">btcd</a>: discussion
|
||||||
of btcd and its packages.
|
of btcd and its packages.
|
||||||
* <a href="mailto:btcd-commits+subscribe@opensource.conformal.com">btcd-commits</a>:
|
* <a href="mailto:btcd-commits+subscribe@opensource.conformal.com">btcd-commits</a>:
|
||||||
readonly mail-out of source code changes.
|
readonly mail-out of source code changes.
|
||||||
|
|
||||||
<a name="DeveloperResources" />
|
<a name="DeveloperResources" />
|
||||||
|
|
||||||
### 5. Developer Resources
|
### 5. Developer Resources
|
||||||
|
|
||||||
<a name="ContributionGuidelines" />
|
<a name="ContributionGuidelines" />
|
||||||
|
|
||||||
* [Code Contribution Guidelines](https://github.com/kaspanet/kaspad/tree/master/docs/code_contribution_guidelines.md)
|
* [Code Contribution Guidelines](https://github.com/kaspanet/kaspad/tree/master/docs/code_contribution_guidelines.md)
|
||||||
|
|
||||||
<a name="JSONRPCReference" />
|
<a name="JSONRPCReference" />
|
||||||
|
|
||||||
* [JSON-RPC Reference](https://github.com/kaspanet/kaspad/tree/master/docs/json_rpc_api.md)
|
* [JSON-RPC Reference](https://github.com/kaspanet/kaspad/tree/master/docs/json_rpc_api.md)
|
||||||
* [RPC Examples](https://github.com/kaspanet/kaspad/tree/master/docs/json_rpc_api.md#ExampleCode)
|
* [RPC Examples](https://github.com/kaspanet/kaspad/tree/master/docs/json_rpc_api.md#ExampleCode)
|
||||||
|
|
||||||
<a name="GoPackages" />
|
<a name="GoPackages" />
|
||||||
|
|
||||||
* The btcsuite Bitcoin-related Go Packages:
|
* The btcsuite Bitcoin-related Go Packages:
|
||||||
* [btcrpcclient](https://github.com/kaspanet/kaspad/tree/master/rpcclient) - Implements a
|
* [btcrpcclient](https://github.com/kaspanet/kaspad/tree/master/rpcclient) - Implements a
|
||||||
robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
|
robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
|
||||||
* [btcjson](https://github.com/kaspanet/kaspad/tree/master/btcjson) - Provides an extensive API
|
* [btcjson](https://github.com/kaspanet/kaspad/tree/master/btcjson) - Provides an extensive API
|
||||||
for the underlying JSON-RPC command and return values
|
for the underlying JSON-RPC command and return values
|
||||||
* [wire](https://github.com/kaspanet/kaspad/tree/master/wire) - Implements the
|
* [wire](https://github.com/kaspanet/kaspad/tree/master/wire) - Implements the
|
||||||
Bitcoin wire protocol
|
Bitcoin wire protocol
|
||||||
* [peer](https://github.com/kaspanet/kaspad/tree/master/peer) -
|
* [peer](https://github.com/kaspanet/kaspad/tree/master/peer) -
|
||||||
Provides a common base for creating and managing Bitcoin network peers.
|
Provides a common base for creating and managing Bitcoin network peers.
|
||||||
* [blockchain](https://github.com/kaspanet/kaspad/tree/master/blockchain) -
|
* [blockchain](https://github.com/kaspanet/kaspad/tree/master/blockchain) -
|
||||||
Implements Bitcoin block handling and chain selection rules
|
Implements Bitcoin block handling and chain selection rules
|
||||||
* [blockchain/fullblocktests](https://github.com/kaspanet/kaspad/tree/master/blockchain/fullblocktests) -
|
* [blockchain/fullblocktests](https://github.com/kaspanet/kaspad/tree/master/blockchain/fullblocktests) -
|
||||||
Provides a set of block tests for testing the consensus validation rules
|
Provides a set of block tests for testing the consensus validation rules
|
||||||
* [txscript](https://github.com/kaspanet/kaspad/tree/master/txscript) -
|
* [txscript](https://github.com/kaspanet/kaspad/tree/master/txscript) -
|
||||||
Implements the Bitcoin transaction scripting language
|
Implements the Bitcoin transaction scripting language
|
||||||
* [btcec](https://github.com/kaspanet/kaspad/tree/master/btcec) - Implements
|
* [btcec](https://github.com/kaspanet/kaspad/tree/master/btcec) - Implements
|
||||||
support for the elliptic curve cryptographic functions needed for the
|
support for the elliptic curve cryptographic functions needed for the
|
||||||
Bitcoin scripts
|
Bitcoin scripts
|
||||||
* [database](https://github.com/kaspanet/kaspad/tree/master/database) -
|
* [database](https://github.com/kaspanet/kaspad/tree/master/database) -
|
||||||
Provides a database interface for the Bitcoin block chain
|
Provides a database interface for the Bitcoin block chain
|
||||||
* [mempool](https://github.com/kaspanet/kaspad/tree/master/mempool) -
|
* [mempool](https://github.com/kaspanet/kaspad/tree/master/mempool) -
|
||||||
Package mempool provides a policy-enforced pool of unmined bitcoin
|
Package mempool provides a policy-enforced pool of unmined bitcoin
|
||||||
transactions.
|
transactions.
|
||||||
* [btcutil](https://github.com/daglabs/btcutil) - Provides Bitcoin-specific
|
* [btcutil](https://github.com/daglabs/btcutil) - Provides Bitcoin-specific
|
||||||
convenience functions and types
|
convenience functions and types
|
||||||
* [chainhash](https://github.com/kaspanet/kaspad/tree/master/chaincfg/chainhash) -
|
* [chainhash](https://github.com/kaspanet/kaspad/tree/master/chaincfg/chainhash) -
|
||||||
Provides a generic hash type and associated functions that allows the
|
Provides a generic hash type and associated functions that allows the
|
||||||
specific hash algorithm to be abstracted.
|
specific hash algorithm to be abstracted.
|
||||||
* [connmgr](https://github.com/kaspanet/kaspad/tree/master/connmgr) -
|
* [connmgr](https://github.com/kaspanet/kaspad/tree/master/connmgr) -
|
||||||
Package connmgr implements a generic Bitcoin network connection manager.
|
Package connmgr implements a generic Bitcoin network connection manager.
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
btcd allows you to bind to specific interfaces which enables you to setup
|
btcd allows you to bind to specific interfaces which enables you to setup
|
||||||
configurations with varying levels of complexity. The listen parameter can be
|
configurations with varying levels of complexity. The listen parameter can be
|
||||||
specified on the command line as shown below with the -- prefix or in the
|
specified on the command line as shown below with the -- prefix or in the
|
||||||
configuration file without the -- prefix (as can all long command line options).
|
configuration file without the -- prefix (as can all long command line options).
|
||||||
The configuration file takes one entry per line.
|
The configuration file takes one entry per line.
|
||||||
|
|
||||||
**NOTE:** The listen flag can be specified multiple times to listen on multiple
|
**NOTE:** The listen flag can be specified multiple times to listen on multiple
|
||||||
interfaces as a couple of the examples below illustrate.
|
interfaces as a couple of the examples below illustrate.
|
||||||
|
|
||||||
Command Line Examples:
|
Command Line Examples:
|
||||||
|
|
||||||
|Flags|Comment|
|
|Flags|Comment|
|
||||||
|----------|------------|
|
|----------|------------|
|
||||||
|--listen=|all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**)|
|
|--listen=|all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**)|
|
||||||
|--listen=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest`|
|
|--listen=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest`|
|
||||||
|--listen=::|all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest`|
|
|--listen=::|all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest`|
|
||||||
|--listen=:8333|all interfaces on port 8333|
|
|--listen=:16111|all interfaces on port 16111|
|
||||||
|--listen=0.0.0.0:8333|all IPv4 interfaces on port 8333|
|
|--listen=0.0.0.0:16111|all IPv4 interfaces on port 16111|
|
||||||
|--listen=[::]:8333|all IPv6 interfaces on port 8333|
|
|--listen=[::]:16111|all IPv6 interfaces on port 16111|
|
||||||
|--listen=127.0.0.1:8333|only IPv4 localhost on port 8333|
|
|--listen=127.0.0.1:16111|only IPv4 localhost on port 16111|
|
||||||
|--listen=[::1]:8333|only IPv6 localhost on port 8333|
|
|--listen=[::1]:16111|only IPv6 localhost on port 16111|
|
||||||
|--listen=:8336|all interfaces on non-standard port 8336|
|
|--listen=:8336|all interfaces on non-standard port 8336|
|
||||||
|--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|
|--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|
||||||
|--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|
|--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|
||||||
|--listen=127.0.0.1:8337 --listen=[::1]:8333|IPv4 localhost on port 8337 and IPv6 localhost on port 8333|
|
|--listen=127.0.0.1:8337 --listen=[::1]:16111|IPv4 localhost on port 8337 and IPv6 localhost on port 16111|
|
||||||
|--listen=:8333 --listen=:8337|all interfaces on ports 8333 and 8337|
|
|--listen=:16111 --listen=:8337|all interfaces on ports 16111 and 8337|
|
||||||
|
|
||||||
The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6:
|
The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
[Application Options]
|
[Application Options]
|
||||||
|
|
||||||
listen=127.0.0.1:8333
|
listen=127.0.0.1:16111
|
||||||
listen=[::1]:8333
|
listen=[::1]:16111
|
||||||
```
|
```
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
btcd allows you to bind the RPC server to specific interfaces which enables you
|
btcd allows you to bind the RPC server to specific interfaces which enables you
|
||||||
to setup configurations with varying levels of complexity. The `rpclisten`
|
to setup configurations with varying levels of complexity. The `rpclisten`
|
||||||
parameter can be specified on the command line as shown below with the -- prefix
|
parameter can be specified on the command line as shown below with the -- prefix
|
||||||
or in the configuration file without the -- prefix (as can all long command line
|
or in the configuration file without the -- prefix (as can all long command line
|
||||||
options). The configuration file takes one entry per line.
|
options). The configuration file takes one entry per line.
|
||||||
|
|
||||||
A few things to note regarding the RPC server:
|
A few things to note regarding the RPC server:
|
||||||
* The RPC server will **not** be enabled unless the `rpcuser` and `rpcpass`
|
* The RPC server will **not** be enabled unless the `rpcuser` and `rpcpass`
|
||||||
options are specified.
|
options are specified.
|
||||||
* When the `rpcuser` and `rpcpass` and/or `rpclimituser` and `rpclimitpass`
|
* When the `rpcuser` and `rpcpass` and/or `rpclimituser` and `rpclimitpass`
|
||||||
options are specified, the RPC server will only listen on localhost IPv4 and
|
options are specified, the RPC server will only listen on localhost IPv4 and
|
||||||
IPv6 interfaces by default. You will need to override the RPC listen
|
IPv6 interfaces by default. You will need to override the RPC listen
|
||||||
interfaces to include external interfaces if you want to connect from a remote
|
interfaces to include external interfaces if you want to connect from a remote
|
||||||
machine.
|
machine.
|
||||||
* The RPC server has TLS enabled by default, even for localhost. You may use
|
* The RPC server has TLS enabled by default, even for localhost. You may use
|
||||||
the `--notls` option to disable it, but only when all listeners are on
|
the `--notls` option to disable it, but only when all listeners are on
|
||||||
localhost interfaces.
|
localhost interfaces.
|
||||||
* The `--rpclisten` flag can be specified multiple times to listen on multiple
|
* The `--rpclisten` flag can be specified multiple times to listen on multiple
|
||||||
interfaces as a couple of the examples below illustrate.
|
interfaces as a couple of the examples below illustrate.
|
||||||
* The RPC server is disabled by default when using the `--regtest` and
|
* The RPC server is disabled by default when using the `--regtest` and
|
||||||
`--simnet` networks. You can override this by specifying listen interfaces.
|
`--simnet` networks. You can override this by specifying listen interfaces.
|
||||||
|
|
||||||
Command Line Examples:
|
Command Line Examples:
|
||||||
|
|
||||||
|Flags|Comment|
|
|Flags|Comment|
|
||||||
|----------|------------|
|
|----------|------------|
|
||||||
|--rpclisten=|all interfaces on default port which is changed by `--testnet`|
|
|--rpclisten=|all interfaces on default port which is changed by `--testnet`|
|
||||||
|--rpclisten=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet`|
|
|--rpclisten=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet`|
|
||||||
|--rpclisten=::|all IPv6 interfaces on default port which is changed by `--testnet`|
|
|--rpclisten=::|all IPv6 interfaces on default port which is changed by `--testnet`|
|
||||||
|--rpclisten=:8334|all interfaces on port 8334|
|
|--rpclisten=:16110|all interfaces on port 16110|
|
||||||
|--rpclisten=0.0.0.0:8334|all IPv4 interfaces on port 8334|
|
|--rpclisten=0.0.0.0:16110|all IPv4 interfaces on port 16110|
|
||||||
|--rpclisten=[::]:8334|all IPv6 interfaces on port 8334|
|
|--rpclisten=[::]:16110|all IPv6 interfaces on port 16110|
|
||||||
|--rpclisten=127.0.0.1:8334|only IPv4 localhost on port 8334|
|
|--rpclisten=127.0.0.1:16110|only IPv4 localhost on port 16110|
|
||||||
|--rpclisten=[::1]:8334|only IPv6 localhost on port 8334|
|
|--rpclisten=[::1]:16110|only IPv6 localhost on port 16110|
|
||||||
|--rpclisten=:8336|all interfaces on non-standard port 8336|
|
|--rpclisten=:8336|all interfaces on non-standard port 8336|
|
||||||
|--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|
|--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|
||||||
|--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|
|--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|
||||||
|--rpclisten=127.0.0.1:8337 --listen=[::1]:8334|IPv4 localhost on port 8337 and IPv6 localhost on port 8334|
|
|--rpclisten=127.0.0.1:8337 --listen=[::1]:16110|IPv4 localhost on port 8337 and IPv6 localhost on port 16110|
|
||||||
|--rpclisten=:8334 --listen=:8337|all interfaces on ports 8334 and 8337|
|
|--rpclisten=:16110 --listen=:8337|all interfaces on ports 16110 and 8337|
|
||||||
|
|
||||||
The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:
|
The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
[Application Options]
|
[Application Options]
|
||||||
|
|
||||||
rpclisten=
|
rpclisten=
|
||||||
```
|
```
|
||||||
|
@ -97,7 +97,7 @@ address.
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
HiddenServiceDir /var/tor/btcd
|
HiddenServiceDir /var/tor/btcd
|
||||||
HiddenServicePort 8333 127.0.0.1:8333
|
HiddenServicePort 16111 127.0.0.1:16111
|
||||||
```
|
```
|
||||||
|
|
||||||
Once Tor is configured to provide the hidden service and you have obtained your
|
Once Tor is configured to provide the hidden service and you have obtained your
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
While btcd is highly configurable when it comes to the network configuration,
|
While btcd is highly configurable when it comes to the network configuration,
|
||||||
the following is intended to be a quick reference for the default ports used so
|
the following is intended to be a quick reference for the default ports used so
|
||||||
port forwarding can be configured as required.
|
port forwarding can be configured as required.
|
||||||
|
|
||||||
btcd provides a `--upnp` flag which can be used to automatically map the bitcoin
|
btcd provides a `--upnp` flag which can be used to automatically map the bitcoin
|
||||||
peer-to-peer listening port if your router supports UPnP. If your router does
|
peer-to-peer listening port if your router supports UPnP. If your router does
|
||||||
not support UPnP, or you don't wish to use it, please note that only the bitcoin
|
not support UPnP, or you don't wish to use it, please note that only the bitcoin
|
||||||
peer-to-peer port should be forwarded unless you specifically want to allow RPC
|
peer-to-peer port should be forwarded unless you specifically want to allow RPC
|
||||||
access to your btcd from external sources such as in more advanced network
|
access to your btcd from external sources such as in more advanced network
|
||||||
configurations.
|
configurations.
|
||||||
|
|
||||||
|Name|Port|
|
|Name|Port|
|
||||||
|----|----|
|
|----|----|
|
||||||
|Default Bitcoin peer-to-peer port|TCP 8333|
|
|Default Bitcoin peer-to-peer port|TCP 16111|
|
||||||
|Default RPC port|TCP 8334|
|
|Default RPC port|TCP 16110|
|
||||||
|
@ -46,7 +46,7 @@ differences between btcd and bitcoind as far as how RPCs are serviced:
|
|||||||
Websockets are the preferred transport for btcd RPC and are used by applications
|
Websockets are the preferred transport for btcd RPC and are used by applications
|
||||||
such as [btcwallet](https://github.com/btcsuite/btcwallet) for inter-process
|
such as [btcwallet](https://github.com/btcsuite/btcwallet) for inter-process
|
||||||
communication with btcd. The websocket connection endpoint for btcd is
|
communication with btcd. The websocket connection endpoint for btcd is
|
||||||
`wss://your_ip_or_domain:8334/ws`.
|
`wss://your_ip_or_domain:16110/ws`.
|
||||||
|
|
||||||
In addition to the [standard API](#Methods), an [extension API](#WSExtMethods)
|
In addition to the [standard API](#Methods), an [extension API](#WSExtMethods)
|
||||||
has been developed that is exclusive to clients using Websockets. In its current
|
has been developed that is exclusive to clients using Websockets. In its current
|
||||||
@ -71,7 +71,7 @@ indicates, the [Websocket-specific extension](#WSExtMethods) methods can only be
|
|||||||
accessed when connected via Websockets.
|
accessed when connected via Websockets.
|
||||||
|
|
||||||
As mentioned in the [overview](#Overview), the websocket connection endpoint for
|
As mentioned in the [overview](#Overview), the websocket connection endpoint for
|
||||||
btcd is `wss://your_ip_or_domain:8334/ws`.
|
btcd is `wss://your_ip_or_domain:16110/ws`.
|
||||||
|
|
||||||
The most important differences between the two transports as it pertains to the
|
The most important differences between the two transports as it pertains to the
|
||||||
JSON-RPC API are:
|
JSON-RPC API are:
|
||||||
@ -1102,7 +1102,7 @@ func main() {
|
|||||||
// not long-lived, the connection will be closed as soon as the program
|
// not long-lived, the connection will be closed as soon as the program
|
||||||
// exits.
|
// exits.
|
||||||
connCfg := &btcrpcclient.ConnConfig{
|
connCfg := &btcrpcclient.ConnConfig{
|
||||||
Host: "localhost:8334",
|
Host: "localhost:16110",
|
||||||
Endpoint: "ws",
|
Endpoint: "ws",
|
||||||
User: "yourrpcuser",
|
User: "yourrpcuser",
|
||||||
Pass: "yourrpcpass",
|
Pass: "yourrpcpass",
|
||||||
@ -1166,7 +1166,7 @@ func main() {
|
|||||||
// not long-lived, the connection will be closed as soon as the program
|
// not long-lived, the connection will be closed as soon as the program
|
||||||
// exits.
|
// exits.
|
||||||
connCfg := &btcrpcclient.ConnConfig{
|
connCfg := &btcrpcclient.ConnConfig{
|
||||||
Host: "localhost:18334",
|
Host: "localhost:16210",
|
||||||
Endpoint: "ws",
|
Endpoint: "ws",
|
||||||
User: "yourrpcuser",
|
User: "yourrpcuser",
|
||||||
Pass: "yourrpcpass",
|
Pass: "yourrpcpass",
|
||||||
@ -1267,7 +1267,7 @@ func main() {
|
|||||||
|
|
||||||
// Create a new RPC client using websockets.
|
// Create a new RPC client using websockets.
|
||||||
connCfg := &btcrpcclient.ConnConfig{
|
connCfg := &btcrpcclient.ConnConfig{
|
||||||
Host: "localhost:8334",
|
Host: "localhost:16110",
|
||||||
Endpoint: "ws",
|
Endpoint: "ws",
|
||||||
User: "yourrpcuser",
|
User: "yourrpcuser",
|
||||||
Pass: "yourrpcpass",
|
Pass: "yourrpcpass",
|
||||||
@ -1338,7 +1338,7 @@ var password = "yourpassword";
|
|||||||
// Initiate the websocket connection. The btcd generated certificate acts as
|
// Initiate the websocket connection. The btcd generated certificate acts as
|
||||||
// its own certificate authority, so it needs to be specified in the 'ca' array
|
// its own certificate authority, so it needs to be specified in the 'ca' array
|
||||||
// for the certificate to properly validate.
|
// for the certificate to properly validate.
|
||||||
var ws = new WebSocket('wss://127.0.0.1:8334/ws', {
|
var ws = new WebSocket('wss://127.0.0.1:16110/ws', {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64')
|
'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64')
|
||||||
},
|
},
|
||||||
|
@ -49,7 +49,7 @@ func newConfig(prefix, certFile, keyFile string, extra []string) (*nodeConfig, e
|
|||||||
|
|
||||||
a := &nodeConfig{
|
a := &nodeConfig{
|
||||||
listen: "127.0.0.1:18555",
|
listen: "127.0.0.1:18555",
|
||||||
rpcListen: "127.0.0.1:18556",
|
rpcListen: "127.0.0.1:16510",
|
||||||
rpcUser: "user",
|
rpcUser: "user",
|
||||||
rpcPass: "pass",
|
rpcPass: "pass",
|
||||||
extra: extra,
|
extra: extra,
|
||||||
|
@ -267,13 +267,13 @@ func TestPeerConnection(t *testing.T) {
|
|||||||
"basic handshake",
|
"basic handshake",
|
||||||
func() (*peer.Peer, *peer.Peer, error) {
|
func() (*peer.Peer, *peer.Peer, error) {
|
||||||
inConn, outConn := pipe(
|
inConn, outConn := pipe(
|
||||||
&conn{raddr: "10.0.0.1:8333"},
|
&conn{raddr: "10.0.0.1:16111"},
|
||||||
&conn{raddr: "10.0.0.2:8333"},
|
&conn{raddr: "10.0.0.2:16111"},
|
||||||
)
|
)
|
||||||
inPeer := peer.NewInboundPeer(peer1Cfg)
|
inPeer := peer.NewInboundPeer(peer1Cfg)
|
||||||
inPeer.AssociateConnection(inConn)
|
inPeer.AssociateConnection(inConn)
|
||||||
|
|
||||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333")
|
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -293,13 +293,13 @@ func TestPeerConnection(t *testing.T) {
|
|||||||
"socks proxy",
|
"socks proxy",
|
||||||
func() (*peer.Peer, *peer.Peer, error) {
|
func() (*peer.Peer, *peer.Peer, error) {
|
||||||
inConn, outConn := pipe(
|
inConn, outConn := pipe(
|
||||||
&conn{raddr: "10.0.0.1:8333", proxy: true},
|
&conn{raddr: "10.0.0.1:16111", proxy: true},
|
||||||
&conn{raddr: "10.0.0.2:8333"},
|
&conn{raddr: "10.0.0.2:16111"},
|
||||||
)
|
)
|
||||||
inPeer := peer.NewInboundPeer(peer1Cfg)
|
inPeer := peer.NewInboundPeer(peer1Cfg)
|
||||||
inPeer.AssociateConnection(inConn)
|
inPeer.AssociateConnection(inConn)
|
||||||
|
|
||||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333")
|
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -405,8 +405,8 @@ func TestPeerListeners(t *testing.T) {
|
|||||||
SelectedTip: fakeSelectedTipFn,
|
SelectedTip: fakeSelectedTipFn,
|
||||||
}
|
}
|
||||||
inConn, outConn := pipe(
|
inConn, outConn := pipe(
|
||||||
&conn{raddr: "10.0.0.1:8333"},
|
&conn{raddr: "10.0.0.1:16111"},
|
||||||
&conn{raddr: "10.0.0.2:8333"},
|
&conn{raddr: "10.0.0.2:16111"},
|
||||||
)
|
)
|
||||||
inPeer := peer.NewInboundPeer(peerCfg)
|
inPeer := peer.NewInboundPeer(peerCfg)
|
||||||
inPeer.AssociateConnection(inConn)
|
inPeer.AssociateConnection(inConn)
|
||||||
@ -416,7 +416,7 @@ func TestPeerListeners(t *testing.T) {
|
|||||||
verack <- struct{}{}
|
verack <- struct{}{}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("NewOutboundPeer: unexpected err %v\n", err)
|
t.Errorf("NewOutboundPeer: unexpected err %v\n", err)
|
||||||
return
|
return
|
||||||
@ -538,9 +538,9 @@ func TestOutboundPeer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
c := &conn{raddr: "10.0.0.1:8333", Writer: w, Reader: r}
|
c := &conn{raddr: "10.0.0.1:16111", Writer: w, Reader: r}
|
||||||
|
|
||||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||||
return
|
return
|
||||||
@ -579,8 +579,8 @@ func TestOutboundPeer(t *testing.T) {
|
|||||||
|
|
||||||
peerCfg.SelectedTip = selectedTip
|
peerCfg.SelectedTip = selectedTip
|
||||||
r1, w1 := io.Pipe()
|
r1, w1 := io.Pipe()
|
||||||
c1 := &conn{raddr: "10.0.0.1:8333", Writer: w1, Reader: r1}
|
c1 := &conn{raddr: "10.0.0.1:16111", Writer: w1, Reader: r1}
|
||||||
p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||||
return
|
return
|
||||||
@ -595,8 +595,8 @@ func TestOutboundPeer(t *testing.T) {
|
|||||||
peerCfg.DAGParams = &dagconfig.RegressionNetParams
|
peerCfg.DAGParams = &dagconfig.RegressionNetParams
|
||||||
peerCfg.Services = wire.SFNodeBloom
|
peerCfg.Services = wire.SFNodeBloom
|
||||||
r2, w2 := io.Pipe()
|
r2, w2 := io.Pipe()
|
||||||
c2 := &conn{raddr: "10.0.0.1:8333", Writer: w2, Reader: r2}
|
c2 := &conn{raddr: "10.0.0.1:16111", Writer: w2, Reader: r2}
|
||||||
p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||||
return
|
return
|
||||||
@ -649,20 +649,20 @@ func TestUnsupportedVersionPeer(t *testing.T) {
|
|||||||
|
|
||||||
localNA := wire.NewNetAddressIPPort(
|
localNA := wire.NewNetAddressIPPort(
|
||||||
net.ParseIP("10.0.0.1"),
|
net.ParseIP("10.0.0.1"),
|
||||||
uint16(8333),
|
uint16(16111),
|
||||||
wire.SFNodeNetwork,
|
wire.SFNodeNetwork,
|
||||||
)
|
)
|
||||||
remoteNA := wire.NewNetAddressIPPort(
|
remoteNA := wire.NewNetAddressIPPort(
|
||||||
net.ParseIP("10.0.0.2"),
|
net.ParseIP("10.0.0.2"),
|
||||||
uint16(8333),
|
uint16(16111),
|
||||||
wire.SFNodeNetwork,
|
wire.SFNodeNetwork,
|
||||||
)
|
)
|
||||||
localConn, remoteConn := pipe(
|
localConn, remoteConn := pipe(
|
||||||
&conn{laddr: "10.0.0.1:8333", raddr: "10.0.0.2:8333"},
|
&conn{laddr: "10.0.0.1:16111", raddr: "10.0.0.2:16111"},
|
||||||
&conn{laddr: "10.0.0.2:8333", raddr: "10.0.0.1:8333"},
|
&conn{laddr: "10.0.0.2:16111", raddr: "10.0.0.1:16111"},
|
||||||
)
|
)
|
||||||
|
|
||||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("NewOutboundPeer: unexpected err - %v\n", err)
|
t.Fatalf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
connCfg := &rpcclient.ConnConfig{
|
connCfg := &rpcclient.ConnConfig{
|
||||||
Host: "localhost:8334",
|
Host: "localhost:16110",
|
||||||
Endpoint: "ws",
|
Endpoint: "ws",
|
||||||
User: "yourrpcuser",
|
User: "yourrpcuser",
|
||||||
Pass: "yourrpcpass",
|
Pass: "yourrpcpass",
|
||||||
|
@ -86,9 +86,9 @@
|
|||||||
; You may specify each IP address with or without a port. The default port will
|
; You may specify each IP address with or without a port. The default port will
|
||||||
; be added automatically if one is not specified here.
|
; be added automatically if one is not specified here.
|
||||||
; addpeer=192.168.1.1
|
; addpeer=192.168.1.1
|
||||||
; addpeer=10.0.0.2:8333
|
; addpeer=10.0.0.2:16111
|
||||||
; addpeer=fe80::1
|
; addpeer=fe80::1
|
||||||
; addpeer=[fe80::2]:8333
|
; addpeer=[fe80::2]:16111
|
||||||
|
|
||||||
; Add persistent peers that you ONLY want to connect to as desired. One peer
|
; Add persistent peers that you ONLY want to connect to as desired. One peer
|
||||||
; per line. You may specify each IP address with or without a port. The
|
; per line. You may specify each IP address with or without a port. The
|
||||||
@ -96,9 +96,9 @@
|
|||||||
; NOTE: Specifying this option has other side effects as described above in
|
; NOTE: Specifying this option has other side effects as described above in
|
||||||
; the 'addpeer' versus 'connect' summary section.
|
; the 'addpeer' versus 'connect' summary section.
|
||||||
; connect=192.168.1.1
|
; connect=192.168.1.1
|
||||||
; connect=10.0.0.2:8333
|
; connect=10.0.0.2:16111
|
||||||
; connect=fe80::1
|
; connect=fe80::1
|
||||||
; connect=[fe80::2]:8333
|
; connect=[fe80::2]:16111
|
||||||
|
|
||||||
; Maximum number of inbound and outbound peers.
|
; Maximum number of inbound and outbound peers.
|
||||||
; maxpeers=125
|
; maxpeers=125
|
||||||
@ -135,12 +135,12 @@
|
|||||||
; listen=0.0.0.0
|
; listen=0.0.0.0
|
||||||
; All ipv6 interfaces on default port:
|
; All ipv6 interfaces on default port:
|
||||||
; listen=::
|
; listen=::
|
||||||
; All interfaces on port 8333:
|
; All interfaces on port 16111:
|
||||||
; listen=:8333
|
; listen=:16111
|
||||||
; All ipv4 interfaces on port 8333:
|
; All ipv4 interfaces on port 16111:
|
||||||
; listen=0.0.0.0:8333
|
; listen=0.0.0.0:16111
|
||||||
; All ipv6 interfaces on port 8333:
|
; All ipv6 interfaces on port 16111:
|
||||||
; listen=[::]:8333
|
; listen=[::]:16111
|
||||||
; Only ipv4 localhost on port 8333:
|
; Only ipv4 localhost on port 8333:
|
||||||
; listen=127.0.0.1:8333
|
; listen=127.0.0.1:8333
|
||||||
; Only ipv6 localhost on port 8333:
|
; Only ipv6 localhost on port 8333:
|
||||||
@ -195,16 +195,16 @@
|
|||||||
; rpclisten=0.0.0.0
|
; rpclisten=0.0.0.0
|
||||||
; All ipv6 interfaces on default port:
|
; All ipv6 interfaces on default port:
|
||||||
; rpclisten=::
|
; rpclisten=::
|
||||||
; All interfaces on port 8334:
|
; All interfaces on port 16110:
|
||||||
; rpclisten=:8334
|
; rpclisten=:16110
|
||||||
; All ipv4 interfaces on port 8334:
|
; All ipv4 interfaces on port 16110:
|
||||||
; rpclisten=0.0.0.0:8334
|
; rpclisten=0.0.0.0:16110
|
||||||
; All ipv6 interfaces on port 8334:
|
; All ipv6 interfaces on port 16110:
|
||||||
; rpclisten=[::]:8334
|
; rpclisten=[::]:16110
|
||||||
; Only ipv4 localhost on port 8334:
|
; Only ipv4 localhost on port 16110:
|
||||||
; rpclisten=127.0.0.1:8334
|
; rpclisten=127.0.0.1:16110
|
||||||
; Only ipv6 localhost on port 8334:
|
; Only ipv6 localhost on port 16110:
|
||||||
; rpclisten=[::1]:8334
|
; rpclisten=[::1]:16110
|
||||||
; Only ipv4 localhost on non-standard port 8337:
|
; Only ipv4 localhost on non-standard port 8337:
|
||||||
; rpclisten=127.0.0.1:8337
|
; rpclisten=127.0.0.1:8337
|
||||||
; All interfaces on non-standard port 8337:
|
; All interfaces on non-standard port 8337:
|
||||||
|
@ -132,7 +132,7 @@ func TestElementWire(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
KaspaNet(MainNet),
|
KaspaNet(MainNet),
|
||||||
[]byte{0xf9, 0xbe, 0xb4, 0xd9},
|
[]byte{0x1d, 0xf7, 0xdc, 0x3d},
|
||||||
},
|
},
|
||||||
// Type not supported by the "fast" path and requires reflection.
|
// Type not supported by the "fast" path and requires reflection.
|
||||||
{
|
{
|
||||||
|
@ -40,10 +40,10 @@ func TestMessage(t *testing.T) {
|
|||||||
// Create the various types of messages to test.
|
// Create the various types of messages to test.
|
||||||
|
|
||||||
// MsgVersion.
|
// MsgVersion.
|
||||||
addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 8333}
|
addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 16111}
|
||||||
you := NewNetAddress(addrYou, SFNodeNetwork)
|
you := NewNetAddress(addrYou, SFNodeNetwork)
|
||||||
you.Timestamp = time.Time{} // Version message has zero value timestamp.
|
you.Timestamp = time.Time{} // Version message has zero value timestamp.
|
||||||
addrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
addrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 16111}
|
||||||
me := NewNetAddress(addrMe, SFNodeNetwork)
|
me := NewNetAddress(addrMe, SFNodeNetwork)
|
||||||
me.Timestamp = time.Time{} // Version message has zero value timestamp.
|
me.Timestamp = time.Time{} // Version message has zero value timestamp.
|
||||||
msgVersion := NewMsgVersion(me, you, 123123, &daghash.ZeroHash, nil)
|
msgVersion := NewMsgVersion(me, you, 123123, &daghash.ZeroHash, nil)
|
||||||
|
@ -39,7 +39,7 @@ func TestAddr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure NetAddresses are added properly.
|
// Ensure NetAddresses are added properly.
|
||||||
tcpAddr := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
tcpAddr := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 16111}
|
||||||
na := NewNetAddress(tcpAddr, SFNodeNetwork)
|
na := NewNetAddress(tcpAddr, SFNodeNetwork)
|
||||||
err := msg.AddAddress(na)
|
err := msg.AddAddress(na)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -82,13 +82,13 @@ func TestAddrWire(t *testing.T) {
|
|||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
}
|
}
|
||||||
na2 := &NetAddress{
|
na2 := &NetAddress{
|
||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("192.168.0.1"),
|
IP: net.ParseIP("192.168.0.1"),
|
||||||
Port: 8334,
|
Port: 16110,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty address message.
|
// Empty address message.
|
||||||
@ -109,12 +109,12 @@ func TestAddrWire(t *testing.T) {
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||||
0x20, 0x8e, // Port 8334 in big-endian
|
0x3e, 0xee, // Port 16110 in big-endian
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address message with multiple addresses and subnetworkID.
|
// Address message with multiple addresses and subnetworkID.
|
||||||
@ -131,12 +131,12 @@ func TestAddrWire(t *testing.T) {
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||||
0x20, 0x8e, // Port 8334 in big-endian
|
0x3e, 0xee, // Port 16110 in big-endian
|
||||||
}
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -212,13 +212,13 @@ func TestAddrWireErrors(t *testing.T) {
|
|||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
}
|
}
|
||||||
na2 := &NetAddress{
|
na2 := &NetAddress{
|
||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("192.168.0.1"),
|
IP: net.ParseIP("192.168.0.1"),
|
||||||
Port: 8334,
|
Port: 16110,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address message with multiple addresses.
|
// Address message with multiple addresses.
|
||||||
@ -231,12 +231,12 @@ func TestAddrWireErrors(t *testing.T) {
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||||
0x20, 0x8e, // Port 8334 in big-endian
|
0x3e, 0xee, // Port 16110 in big-endian
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message that forces an error by having more than the max allowed
|
// Message that forces an error by having more than the max allowed
|
||||||
|
@ -24,9 +24,9 @@ func TestVersion(t *testing.T) {
|
|||||||
|
|
||||||
// Create version message data.
|
// Create version message data.
|
||||||
selectedTip := &daghash.Hash{12, 34}
|
selectedTip := &daghash.Hash{12, 34}
|
||||||
tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 16111}
|
||||||
me := NewNetAddress(tcpAddrMe, SFNodeNetwork)
|
me := NewNetAddress(tcpAddrMe, SFNodeNetwork)
|
||||||
tcpAddrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 8333}
|
tcpAddrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 16111}
|
||||||
you := NewNetAddress(tcpAddrYou, SFNodeNetwork)
|
you := NewNetAddress(tcpAddrYou, SFNodeNetwork)
|
||||||
nonce, err := random.Uint64()
|
nonce, err := random.Uint64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -313,13 +313,13 @@ var baseVersion = &MsgVersion{
|
|||||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("192.168.0.1"),
|
IP: net.ParseIP("192.168.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
},
|
},
|
||||||
AddrMe: NetAddress{
|
AddrMe: NetAddress{
|
||||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
},
|
},
|
||||||
Nonce: 123123, // 0x1e0f3
|
Nonce: 123123, // 0x1e0f3
|
||||||
UserAgent: "/kaspadtest:0.0.1/",
|
UserAgent: "/kaspadtest:0.0.1/",
|
||||||
@ -337,12 +337,12 @@ var baseVersionEncoded = []byte{
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
// AddrMe -- No timestamp for NetAddress in version message
|
// AddrMe -- No timestamp for NetAddress in version message
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce
|
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce
|
||||||
0x12, // Varint for user agent length
|
0x12, // Varint for user agent length
|
||||||
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,
|
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,
|
||||||
@ -363,13 +363,13 @@ var baseVersionWithRelayTx = &MsgVersion{
|
|||||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("192.168.0.1"),
|
IP: net.ParseIP("192.168.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
},
|
},
|
||||||
AddrMe: NetAddress{
|
AddrMe: NetAddress{
|
||||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
},
|
},
|
||||||
Nonce: 123123, // 0x1e0f3
|
Nonce: 123123, // 0x1e0f3
|
||||||
UserAgent: "/kaspadtest:0.0.1/",
|
UserAgent: "/kaspadtest:0.0.1/",
|
||||||
@ -387,12 +387,12 @@ var baseVersionWithRelayTxEncoded = []byte{
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
// AddrMe -- No timestamp for NetAddress in version message
|
// AddrMe -- No timestamp for NetAddress in version message
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce
|
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce
|
||||||
0x12, // Varint for user agent length
|
0x12, // Varint for user agent length
|
||||||
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,
|
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
// TestNetAddress tests the NetAddress API.
|
// TestNetAddress tests the NetAddress API.
|
||||||
func TestNetAddress(t *testing.T) {
|
func TestNetAddress(t *testing.T) {
|
||||||
ip := net.ParseIP("127.0.0.1")
|
ip := net.ParseIP("127.0.0.1")
|
||||||
port := 8333
|
port := 16111
|
||||||
|
|
||||||
// Test NewNetAddress.
|
// Test NewNetAddress.
|
||||||
na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port}, 0)
|
na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port}, 0)
|
||||||
@ -68,7 +68,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
}
|
}
|
||||||
|
|
||||||
// baseNetAddrNoTS is baseNetAddr with a zero value for the timestamp.
|
// baseNetAddrNoTS is baseNetAddr with a zero value for the timestamp.
|
||||||
@ -81,7 +81,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
}
|
}
|
||||||
|
|
||||||
// baseNetAddrNoTSEncoded is the wire encoded bytes of baseNetAddrNoTS.
|
// baseNetAddrNoTSEncoded is the wire encoded bytes of baseNetAddrNoTS.
|
||||||
@ -90,7 +90,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||||
0x20, 0x8d, // Port 8333 in big-endian
|
0x3e, 0xef, // Port 16111 in big-endian
|
||||||
}
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -160,7 +160,7 @@ func TestNetAddressWireErrors(t *testing.T) {
|
|||||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||||
Services: SFNodeNetwork,
|
Services: SFNodeNetwork,
|
||||||
IP: net.ParseIP("127.0.0.1"),
|
IP: net.ParseIP("127.0.0.1"),
|
||||||
Port: 8333,
|
Port: 16111,
|
||||||
}
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -98,19 +98,19 @@ type KaspaNet uint32
|
|||||||
// better idea to simply disconnect clients that are misbehaving over TCP.
|
// better idea to simply disconnect clients that are misbehaving over TCP.
|
||||||
const (
|
const (
|
||||||
// MainNet represents the main kaspa network.
|
// MainNet represents the main kaspa network.
|
||||||
MainNet KaspaNet = 0xd9b4bef9
|
MainNet KaspaNet = 0x3ddcf71d
|
||||||
|
|
||||||
// TestNet represents the test network.
|
// TestNet represents the test network.
|
||||||
TestNet KaspaNet = 0x0709110b
|
TestNet KaspaNet = 0xddb8af8f
|
||||||
|
|
||||||
// RegTest represents the regression test network.
|
// RegTest represents the regression test network.
|
||||||
RegTest KaspaNet = 0xdab5bffa
|
RegTest KaspaNet = 0xf396cdd6
|
||||||
|
|
||||||
// SimNet represents the simulation test network.
|
// SimNet represents the simulation test network.
|
||||||
SimNet KaspaNet = 0x12141c16
|
SimNet KaspaNet = 0x374dcf1c
|
||||||
|
|
||||||
// DevNet represents the development test network.
|
// DevNet represents the development test network.
|
||||||
DevNet KaspaNet = 0x01020304
|
DevNet KaspaNet = 0x732d87e1
|
||||||
)
|
)
|
||||||
|
|
||||||
// bnStrings is a map of kaspa networks back to their constant names for
|
// bnStrings is a map of kaspa networks back to their constant names for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user