Add support for DigiByte Testnet (#432)
This commit is contained in:
parent
bad9f992e1
commit
3ebe99edb2
@ -86,6 +86,7 @@ func init() {
|
|||||||
BlockChainFactories["Monacoin Testnet"] = monacoin.NewMonacoinRPC
|
BlockChainFactories["Monacoin Testnet"] = monacoin.NewMonacoinRPC
|
||||||
BlockChainFactories["MonetaryUnit"] = monetaryunit.NewMonetaryUnitRPC
|
BlockChainFactories["MonetaryUnit"] = monetaryunit.NewMonetaryUnitRPC
|
||||||
BlockChainFactories["DigiByte"] = digibyte.NewDigiByteRPC
|
BlockChainFactories["DigiByte"] = digibyte.NewDigiByteRPC
|
||||||
|
BlockChainFactories["DigiByte Testnet"] = digibyte.NewDigiByteRPC
|
||||||
BlockChainFactories["Myriad"] = myriad.NewMyriadRPC
|
BlockChainFactories["Myriad"] = myriad.NewMyriadRPC
|
||||||
BlockChainFactories["Liquid"] = liquid.NewLiquidRPC
|
BlockChainFactories["Liquid"] = liquid.NewLiquidRPC
|
||||||
BlockChainFactories["Groestlcoin"] = grs.NewGroestlcoinRPC
|
BlockChainFactories["Groestlcoin"] = grs.NewGroestlcoinRPC
|
||||||
|
|||||||
@ -9,11 +9,13 @@ import (
|
|||||||
const (
|
const (
|
||||||
// MainnetMagic is mainnet network constant
|
// MainnetMagic is mainnet network constant
|
||||||
MainnetMagic wire.BitcoinNet = 0xdab6c3fa
|
MainnetMagic wire.BitcoinNet = 0xdab6c3fa
|
||||||
|
TestnetMagic wire.BitcoinNet = 0xddbdc8fd
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// MainNetParams are parser parameters for mainnet
|
// MainNetParams are parser parameters for mainnet
|
||||||
MainNetParams chaincfg.Params
|
MainNetParams chaincfg.Params
|
||||||
|
TestNetParams chaincfg.Params
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -22,6 +24,12 @@ func init() {
|
|||||||
MainNetParams.PubKeyHashAddrID = []byte{30}
|
MainNetParams.PubKeyHashAddrID = []byte{30}
|
||||||
MainNetParams.ScriptHashAddrID = []byte{63}
|
MainNetParams.ScriptHashAddrID = []byte{63}
|
||||||
MainNetParams.Bech32HRPSegwit = "dgb"
|
MainNetParams.Bech32HRPSegwit = "dgb"
|
||||||
|
|
||||||
|
TestNetParams = chaincfg.TestNet3Params
|
||||||
|
TestNetParams.Net = TestnetMagic
|
||||||
|
TestNetParams.PubKeyHashAddrID = []byte{126}
|
||||||
|
TestNetParams.ScriptHashAddrID = []byte{140}
|
||||||
|
TestNetParams.Bech32HRPSegwit = "dgbt"
|
||||||
}
|
}
|
||||||
|
|
||||||
// DigiByteParser handle
|
// DigiByteParser handle
|
||||||
@ -29,18 +37,27 @@ type DigiByteParser struct {
|
|||||||
*btc.BitcoinParser
|
*btc.BitcoinParser
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDigiByteParser returns new VertcoinParser instance
|
// NewDigiByteParser returns new DigiByteParser instance
|
||||||
func NewDigiByteParser(params *chaincfg.Params, c *btc.Configuration) *DigiByteParser {
|
func NewDigiByteParser(params *chaincfg.Params, c *btc.Configuration) *DigiByteParser {
|
||||||
return &DigiByteParser{BitcoinParser: btc.NewBitcoinParser(params, c)}
|
return &DigiByteParser{BitcoinParser: btc.NewBitcoinParser(params, c)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetChainParams contains network parameters for the main DigiByte network
|
// GetChainParams contains network parameters for the main DigiByte network
|
||||||
|
// and the DigiByte Testnet network
|
||||||
func GetChainParams(chain string) *chaincfg.Params {
|
func GetChainParams(chain string) *chaincfg.Params {
|
||||||
if !chaincfg.IsRegistered(&MainNetParams) {
|
if !chaincfg.IsRegistered(&MainNetParams) {
|
||||||
err := chaincfg.Register(&MainNetParams)
|
err := chaincfg.Register(&MainNetParams)
|
||||||
|
if err == nil {
|
||||||
|
err = chaincfg.Register(&TestNetParams)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &MainNetParams
|
switch chain {
|
||||||
|
case "test":
|
||||||
|
return &TestNetParams
|
||||||
|
default:
|
||||||
|
return &MainNetParams
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
configs/coins/digibyte_testnet.json
Normal file
69
configs/coins/digibyte_testnet.json
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"coin": {
|
||||||
|
"name": "DigiByte Testnet",
|
||||||
|
"shortcut": "TDGB",
|
||||||
|
"label": "DigiByte Testnet",
|
||||||
|
"alias": "digibyte_testnet"
|
||||||
|
},
|
||||||
|
"ports": {
|
||||||
|
"backend_rpc": 18042,
|
||||||
|
"backend_message_queue": 38342,
|
||||||
|
"blockbook_internal": 19042,
|
||||||
|
"blockbook_public": 19142
|
||||||
|
},
|
||||||
|
"ipc": {
|
||||||
|
"rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}",
|
||||||
|
"rpc_user": "rpc",
|
||||||
|
"rpc_pass": "rpc",
|
||||||
|
"rpc_timeout": 25,
|
||||||
|
"message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}"
|
||||||
|
},
|
||||||
|
"backend": {
|
||||||
|
"package_name": "backend-digibyte-testnet",
|
||||||
|
"package_revision": "satoshilabs-1",
|
||||||
|
"system_user": "digibyte",
|
||||||
|
"version": "7.17.2",
|
||||||
|
"binary_url": "https://github.com/digibyte/digibyte/releases/download/v7.17.2/digibyte-7.17.2-x86_64-linux-gnu.tar.gz",
|
||||||
|
"verification_type": "sha256",
|
||||||
|
"verification_source": "caa8ecc42cbebbd2c43e742c7ecc2dd21d76a9e2db23676af428b67b131f6413",
|
||||||
|
"extract_command": "tar -C backend --strip 1 -xf",
|
||||||
|
"exclude_files": [
|
||||||
|
"bin/digibyte-qt"
|
||||||
|
],
|
||||||
|
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/digibyted -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid -rpcport=18042",
|
||||||
|
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log",
|
||||||
|
"postinst_script_template": "",
|
||||||
|
"service_type": "forking",
|
||||||
|
"service_additional_params_template": "",
|
||||||
|
"protect_memory": true,
|
||||||
|
"mainnet": false,
|
||||||
|
"server_config_file": "bitcoin_like.conf",
|
||||||
|
"client_config_file": "bitcoin_like_client.conf",
|
||||||
|
"additional_params": {
|
||||||
|
"whitelist": "127.0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"blockbook": {
|
||||||
|
"package_name": "blockbook-digibyte-testnet",
|
||||||
|
"system_user": "blockbook-digibyte-testnet",
|
||||||
|
"internal_binding_template": ":{{.Ports.BlockbookInternal}}",
|
||||||
|
"public_binding_template": ":{{.Ports.BlockbookPublic}}",
|
||||||
|
"explorer_url": "",
|
||||||
|
"additional_params": "",
|
||||||
|
"block_chain": {
|
||||||
|
"parse": true,
|
||||||
|
"mempool_workers": 8,
|
||||||
|
"mempool_sub_workers": 2,
|
||||||
|
"block_addresses_to_keep": 300,
|
||||||
|
"xpub_magic": 70617039,
|
||||||
|
"xpub_magic_segwit_p2sh": 71979618,
|
||||||
|
"xpub_magic_segwit_native": 73342198,
|
||||||
|
"slip44": 1,
|
||||||
|
"additional_params": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"package_maintainer": "Martin Bohm",
|
||||||
|
"package_maintainer_email": "martin.bohm@satoshilabs.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user