Add Ritocoin support
This commit is contained in:
parent
ce91b9e0f8
commit
e87fb62b1d
@ -26,6 +26,7 @@ import (
|
||||
"blockbook/bchain/coins/polis"
|
||||
"blockbook/bchain/coins/qtum"
|
||||
"blockbook/bchain/coins/ravencoin"
|
||||
"blockbook/bchain/coins/ritocoin"
|
||||
"blockbook/bchain/coins/vertcoin"
|
||||
"blockbook/bchain/coins/viacoin"
|
||||
"blockbook/bchain/coins/vipstarcoin"
|
||||
@ -92,6 +93,7 @@ func init() {
|
||||
BlockChainFactories["VIPSTARCOIN"] = vipstarcoin.NewVIPSTARCOINRPC
|
||||
BlockChainFactories["ZelCash"] = zec.NewZCashRPC
|
||||
BlockChainFactories["Ravencoin"] = ravencoin.NewRavencoinRPC
|
||||
BlockChainFactories["Ritocoin"] = ritocoin.NewRitocoinRPC
|
||||
}
|
||||
|
||||
// GetCoinNameFromConfig gets coin name and coin shortcut from config file
|
||||
|
||||
91
bchain/coins/ritocoin/ritocoinparser.go
Normal file
91
bchain/coins/ritocoin/ritocoinparser.go
Normal file
@ -0,0 +1,91 @@
|
||||
package ritocoin
|
||||
|
||||
import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"blockbook/bchain/coins/utils"
|
||||
"bytes"
|
||||
|
||||
"github.com/martinboehm/btcd/wire"
|
||||
"github.com/martinboehm/btcutil/chaincfg"
|
||||
)
|
||||
|
||||
const (
|
||||
MainnetMagic wire.BitcoinNet = 0x2a7bc0a1
|
||||
TestnetMagic wire.BitcoinNet = 0x514E5352
|
||||
)
|
||||
|
||||
var (
|
||||
MainNetParams chaincfg.Params
|
||||
TestNetParams chaincfg.Params
|
||||
)
|
||||
|
||||
func init() {
|
||||
MainNetParams = chaincfg.MainNetParams
|
||||
MainNetParams.Net = MainnetMagic
|
||||
MainNetParams.PubKeyHashAddrID = []byte{25}
|
||||
MainNetParams.ScriptHashAddrID = []byte{105}
|
||||
|
||||
TestNetParams = chaincfg.TestNet3Params
|
||||
TestNetParams.Net = TestnetMagic
|
||||
TestNetParams.PubKeyHashAddrID = []byte{111}
|
||||
TestNetParams.ScriptHashAddrID = []byte{196}
|
||||
}
|
||||
|
||||
// RitocoinParser handle
|
||||
type RitocoinParser struct {
|
||||
*btc.BitcoinParser
|
||||
}
|
||||
|
||||
// NewRitocoinParser returns new RitocoinParser instance
|
||||
func NewRitocoinParser(params *chaincfg.Params, c *btc.Configuration) *RitocoinParser {
|
||||
return &RitocoinParser{BitcoinParser: btc.NewBitcoinParser(params, c)}
|
||||
}
|
||||
|
||||
// GetChainParams contains network parameters
|
||||
func GetChainParams(chain string) *chaincfg.Params {
|
||||
if !chaincfg.IsRegistered(&MainNetParams) {
|
||||
err := chaincfg.Register(&MainNetParams)
|
||||
if err == nil {
|
||||
err = chaincfg.Register(&TestNetParams)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
switch chain {
|
||||
case "test":
|
||||
return &TestNetParams
|
||||
default:
|
||||
return &MainNetParams
|
||||
}
|
||||
}
|
||||
|
||||
// ParseBlock parses raw block to our Block struct
|
||||
func (p *RitocoinParser) ParseBlock(b []byte) (*bchain.Block, error) {
|
||||
r := bytes.NewReader(b)
|
||||
w := wire.MsgBlock{}
|
||||
h := wire.BlockHeader{}
|
||||
err := h.Deserialize(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = utils.DecodeTransactions(r, 0, wire.WitnessEncoding, &w)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
txs := make([]bchain.Tx, len(w.Transactions))
|
||||
for ti, t := range w.Transactions {
|
||||
txs[ti] = p.TxFromMsgTx(t, false)
|
||||
}
|
||||
|
||||
return &bchain.Block{
|
||||
BlockHeader: bchain.BlockHeader{
|
||||
Size: len(b),
|
||||
Time: h.Timestamp.Unix(),
|
||||
},
|
||||
Txs: txs,
|
||||
}, nil
|
||||
}
|
||||
267
bchain/coins/ritocoin/ritocoinparser_test.go
Normal file
267
bchain/coins/ritocoin/ritocoinparser_test.go
Normal file
@ -0,0 +1,267 @@
|
||||
// +build unittest
|
||||
|
||||
package ritocoin
|
||||
|
||||
import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"encoding/hex"
|
||||
"math/big"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/martinboehm/btcutil/chaincfg"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
c := m.Run()
|
||||
chaincfg.ResetParams()
|
||||
os.Exit(c)
|
||||
}
|
||||
|
||||
func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) {
|
||||
type args struct {
|
||||
address string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "P2PKH1",
|
||||
args: args{address: "BPXJUs9jo15TTJA6EhS6WAJkEMWtXtWqGf"},
|
||||
want: "76a914d136cae89e81911acd8c7b47b4cfc7ea7e56537188ac",
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "P2PKH2",
|
||||
args: args{address: "BGmHxkXaaRMNdNin7a13MipcbZNHZzeEsi"},
|
||||
want: "76a91487134d5b626c428db9518f7e83f839852b0947c588ac",
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "P2SH1",
|
||||
args: args{address: "jdRbWCgeJ6hJXbPLLvABkydaBWkS73rX8J"},
|
||||
want: "a914f09db8fe493b1f36806e90de7bde9a4e6c1f57d787",
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
parser := NewRitocoinParser(GetChainParams("main"), &btc.Configuration{})
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := parser.GetAddrDescFromAddress(tt.args.address)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("GetAddrDescFromAddress() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
h := hex.EncodeToString(got)
|
||||
if !reflect.DeepEqual(h, tt.want) {
|
||||
t.Errorf("GetAddrDescFromAddress() = %v, want %v", h, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
testTx1 bchain.Tx
|
||||
testTxPacked1 = "0003d1478bceb6c13802000000019d5b660bcf1e33116fc5b7991da0cbdd848d3bb8fe2d98fd8efb1c2002f5acdc010000006b483045022100e97ac763e605e9605159ef7a12279e275cc455dbb7db54511e41384f49918b1c0220470f11c765a8262d4b941a87cbc3407f175ba0f3465f44dfdcf29977e2aea259012103eabae25fd82dfa35f66490a8ad5619ccd2492092c8653a79a3fb7a97f2153f43feffffff0240ac8b460e0000001976a9148f87576aad8ba0b42387b6c46f4ec3701eae1b6288ac82c89c40010000001976a914adeec4782f2d95082ceb04d34be90063bc2f221088ac46d10300"
|
||||
|
||||
testTx2 bchain.Tx
|
||||
testTxPacked2 = "0003d10d8bceb69108020000000213aa0749de3e9139cd5352d7037b2cc0ee1eedc89bd74cd698d87f2a62b41127010000006b483045022100a64c3a3df8d5e74e28a19401e0eab65c713ddf04ba9666584e9157ed4648bf4a022009d857df4b8a36d371316daf72db4bcaa002bcf7318f898baa71039b52330095012102355d477bfe43e3a884f3fc81e4c81bd7a79371457974479f901222392c883cadfeffffffac4ebcdaa62454a2bf77e73db68e81452dc2e63f01bb787c63f62a9abd4a7406010000006b483045022100f0fa2cf9134acfdd0124543fc5bc1db7bc7f60023dffdca0f6f87bdd8849cb6e0220319840af61ad2b37294e3532ffd191c57954982a2f1d4738cc639999e9752622012103a7e716d712aa4d6075507daf9b62717d89c2e624236a4bdee7a97c4cf34b6b69feffffff0260b9b543ba0000001976a91456b3aa9d5d2bdc1658406d3e8272d92f1cb05a2088ac06502200000000001976a914b328e94bb96666f774d387afe329588b5e2fc35d88ac0cd10300"
|
||||
)
|
||||
|
||||
func init() {
|
||||
testTx1 = bchain.Tx{
|
||||
Hex: "02000000019d5b660bcf1e33116fc5b7991da0cbdd848d3bb8fe2d98fd8efb1c2002f5acdc010000006b483045022100e97ac763e605e9605159ef7a12279e275cc455dbb7db54511e41384f49918b1c0220470f11c765a8262d4b941a87cbc3407f175ba0f3465f44dfdcf29977e2aea259012103eabae25fd82dfa35f66490a8ad5619ccd2492092c8653a79a3fb7a97f2153f43feffffff0240ac8b460e0000001976a9148f87576aad8ba0b42387b6c46f4ec3701eae1b6288ac82c89c40010000001976a914adeec4782f2d95082ceb04d34be90063bc2f221088ac46d10300",
|
||||
Blocktime: 1558630492,
|
||||
Txid: "535e470daf1a4eb2097e6adaddd81972b010e33417747536f19ed29371f9713f",
|
||||
LockTime: 250182,
|
||||
Version: 2,
|
||||
Vin: []bchain.Vin{
|
||||
{
|
||||
ScriptSig: bchain.ScriptSig{
|
||||
Hex: "483045022100e97ac763e605e9605159ef7a12279e275cc455dbb7db54511e41384f49918b1c0220470f11c765a8262d4b941a87cbc3407f175ba0f3465f44dfdcf29977e2aea259012103eabae25fd82dfa35f66490a8ad5619ccd2492092c8653a79a3fb7a97f2153f43",
|
||||
},
|
||||
Txid: "dcacf502201cfb8efd982dfeb83b8d84ddcba01d99b7c56f11331ecf0b665b9d",
|
||||
Vout: 1,
|
||||
Sequence: 4294967294,
|
||||
},
|
||||
},
|
||||
Vout: []bchain.Vout{
|
||||
{
|
||||
ValueSat: *big.NewInt(61313100864),
|
||||
N: 0,
|
||||
ScriptPubKey: bchain.ScriptPubKey{
|
||||
Hex: "76a9148f87576aad8ba0b42387b6c46f4ec3701eae1b6288ac",
|
||||
Addresses: []string{
|
||||
"BHXzNqXn3rj8WCKg3mzdZCha7YPyXJnqta",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ValueSat: *big.NewInt(5378984066),
|
||||
N: 1,
|
||||
ScriptPubKey: bchain.ScriptPubKey{
|
||||
Hex: "76a914adeec4782f2d95082ceb04d34be90063bc2f221088ac",
|
||||
Addresses: []string{
|
||||
"BLJkYkobSHGonwfRpo3Tu9bAFHoZpTSbfH",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
testTx2 = bchain.Tx{
|
||||
Hex: "020000000213aa0749de3e9139cd5352d7037b2cc0ee1eedc89bd74cd698d87f2a62b41127010000006b483045022100a64c3a3df8d5e74e28a19401e0eab65c713ddf04ba9666584e9157ed4648bf4a022009d857df4b8a36d371316daf72db4bcaa002bcf7318f898baa71039b52330095012102355d477bfe43e3a884f3fc81e4c81bd7a79371457974479f901222392c883cadfeffffffac4ebcdaa62454a2bf77e73db68e81452dc2e63f01bb787c63f62a9abd4a7406010000006b483045022100f0fa2cf9134acfdd0124543fc5bc1db7bc7f60023dffdca0f6f87bdd8849cb6e0220319840af61ad2b37294e3532ffd191c57954982a2f1d4738cc639999e9752622012103a7e716d712aa4d6075507daf9b62717d89c2e624236a4bdee7a97c4cf34b6b69feffffff0260b9b543ba0000001976a91456b3aa9d5d2bdc1658406d3e8272d92f1cb05a2088ac06502200000000001976a914b328e94bb96666f774d387afe329588b5e2fc35d88ac0cd10300",
|
||||
Blocktime: 1558627396,
|
||||
Txid: "7f0745611b4cf48f611a26873cc3c5c01eff7bdf8df7427f379bc7963792f966",
|
||||
LockTime: 250124,
|
||||
Version: 2,
|
||||
Vin: []bchain.Vin{
|
||||
{
|
||||
ScriptSig: bchain.ScriptSig{
|
||||
Hex: "483045022100a64c3a3df8d5e74e28a19401e0eab65c713ddf04ba9666584e9157ed4648bf4a022009d857df4b8a36d371316daf72db4bcaa002bcf7318f898baa71039b52330095012102355d477bfe43e3a884f3fc81e4c81bd7a79371457974479f901222392c883cad",
|
||||
},
|
||||
Txid: "2711b4622a7fd898d64cd79bc8ed1eeec02c7b03d75253cd39913ede4907aa13",
|
||||
Vout: 1,
|
||||
Sequence: 4294967294,
|
||||
},
|
||||
{
|
||||
ScriptSig: bchain.ScriptSig{
|
||||
Hex: "483045022100f0fa2cf9134acfdd0124543fc5bc1db7bc7f60023dffdca0f6f87bdd8849cb6e0220319840af61ad2b37294e3532ffd191c57954982a2f1d4738cc639999e9752622012103a7e716d712aa4d6075507daf9b62717d89c2e624236a4bdee7a97c4cf34b6b69",
|
||||
},
|
||||
Txid: "06744abd9a2af6637c78bb013fe6c22d45818eb63de777bfa25424a6dabc4eac",
|
||||
Vout: 1,
|
||||
Sequence: 4294967294,
|
||||
},
|
||||
},
|
||||
Vout: []bchain.Vout{
|
||||
{
|
||||
ValueSat: *big.NewInt(799999900000),
|
||||
N: 0,
|
||||
ScriptPubKey: bchain.ScriptPubKey{
|
||||
Hex: "76a91456b3aa9d5d2bdc1658406d3e8272d92f1cb05a2088ac",
|
||||
Addresses: []string{
|
||||
"BCMWxf6dvLXQv3ZNXAxeQLMvrXvSVYfubt",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ValueSat: *big.NewInt(2248710),
|
||||
N: 1,
|
||||
ScriptPubKey: bchain.ScriptPubKey{
|
||||
Hex: "76a914b328e94bb96666f774d387afe329588b5e2fc35d88ac",
|
||||
Addresses: []string{
|
||||
"BLnPacy2LCSEgBT2Wi2WgjGhaMfpV1ykf3",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func Test_PackTx(t *testing.T) {
|
||||
type args struct {
|
||||
tx bchain.Tx
|
||||
height uint32
|
||||
blockTime int64
|
||||
parser *RitocoinParser
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "ritocoin-1",
|
||||
args: args{
|
||||
tx: testTx1,
|
||||
height: 250183,
|
||||
blockTime: 1558630492,
|
||||
parser: NewRitocoinParser(GetChainParams("main"), &btc.Configuration{}),
|
||||
},
|
||||
want: testTxPacked1,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "ritocoin-2",
|
||||
args: args{
|
||||
tx: testTx2,
|
||||
height: 250125,
|
||||
blockTime: 1558627396,
|
||||
parser: NewRitocoinParser(GetChainParams("main"), &btc.Configuration{}),
|
||||
},
|
||||
want: testTxPacked2,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := tt.args.parser.PackTx(&tt.args.tx, tt.args.height, tt.args.blockTime)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("packTx() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
h := hex.EncodeToString(got)
|
||||
if !reflect.DeepEqual(h, tt.want) {
|
||||
t.Errorf("packTx() = %v, want %v", h, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_UnpackTx(t *testing.T) {
|
||||
type args struct {
|
||||
packedTx string
|
||||
parser *RitocoinParser
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want *bchain.Tx
|
||||
want1 uint32
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "ritocoin-1",
|
||||
args: args{
|
||||
packedTx: testTxPacked1,
|
||||
parser: NewRitocoinParser(GetChainParams("main"), &btc.Configuration{}),
|
||||
},
|
||||
want: &testTx1,
|
||||
want1: 250183,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "ritocoin-2",
|
||||
args: args{
|
||||
packedTx: testTxPacked2,
|
||||
parser: NewRitocoinParser(GetChainParams("main"), &btc.Configuration{}),
|
||||
},
|
||||
want: &testTx2,
|
||||
want1: 250125,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
b, _ := hex.DecodeString(tt.args.packedTx)
|
||||
got, got1, err := tt.args.parser.UnpackTx(b)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("unpackTx() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
if got1 != tt.want1 {
|
||||
t.Errorf("unpackTx() got1 = %v, want %v", got1, tt.want1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
58
bchain/coins/ritocoin/ritocoinrpc.go
Normal file
58
bchain/coins/ritocoin/ritocoinrpc.go
Normal file
@ -0,0 +1,58 @@
|
||||
package ritocoin
|
||||
|
||||
import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// RitocoinRPC is an interface to JSON-RPC bitcoind service.
|
||||
type RitocoinRPC struct {
|
||||
*btc.BitcoinRPC
|
||||
}
|
||||
|
||||
// NewRitocoinRPC returns new RitocoinRPC instance.
|
||||
func NewRitocoinRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) {
|
||||
b, err := btc.NewBitcoinRPC(config, pushHandler)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s := &RitocoinRPC{
|
||||
b.(*btc.BitcoinRPC),
|
||||
}
|
||||
s.RPCMarshaler = btc.JSONMarshalerV1{}
|
||||
s.ChainConfig.SupportsEstimateFee = false
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// Initialize initializes RitocoinRPC instance.
|
||||
func (b *RitocoinRPC) Initialize() error {
|
||||
ci, err := b.GetChainInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
chainName := ci.Chain
|
||||
|
||||
glog.Info("Chain name ", chainName)
|
||||
params := GetChainParams(chainName)
|
||||
|
||||
// always create parser
|
||||
b.Parser = NewRitocoinParser(params, b.ChainConfig)
|
||||
|
||||
// parameters for getInfo request
|
||||
if params.Net == MainnetMagic {
|
||||
b.Testnet = false
|
||||
b.Network = "livenet"
|
||||
} else {
|
||||
b.Testnet = true
|
||||
b.Network = "testnet"
|
||||
}
|
||||
|
||||
glog.Info("rpc: block chain ", params.Name)
|
||||
|
||||
return nil
|
||||
}
|
||||
67
configs/coins/ritocoin.json
Normal file
67
configs/coins/ritocoin.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"coin": {
|
||||
"name": "Ritocoin",
|
||||
"shortcut": "RITO",
|
||||
"label": "Ritocoin",
|
||||
"alias": "ritocoin"
|
||||
},
|
||||
"ports": {
|
||||
"backend_rpc": 8060,
|
||||
"backend_message_queue": 38360,
|
||||
"blockbook_internal": 9060,
|
||||
"blockbook_public": 9160
|
||||
},
|
||||
"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-ritocoin",
|
||||
"package_revision": "satoshilabs-1",
|
||||
"system_user": "ritocoin",
|
||||
"version": "2.2.2.0",
|
||||
"binary_url": "https://github.com/RitoProject/Ritocoin/releases/download/v2.2.2.0/rito-2.2.2.0-x86_64-linux-gnu.tar.gz",
|
||||
"verification_type": "sha256",
|
||||
"verification_source": "fd0e2c36f05ff59f97ed425e04dd16b589f12994d4f32aabf491783f98101aa6",
|
||||
"extract_command": "tar -C backend --strip 1 -xf",
|
||||
"exclude_files": [
|
||||
"bin/rito-qt"
|
||||
],
|
||||
"exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/ritod -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid",
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"server_config_file": "bitcoin_like.conf",
|
||||
"client_config_file": "bitcoin_like_client.conf",
|
||||
"additional_params": {
|
||||
"deprecatedrpc": "estimatefee"
|
||||
}
|
||||
},
|
||||
"blockbook": {
|
||||
"package_name": "blockbook-ritocoin",
|
||||
"system_user": "blockbook-ritocoin",
|
||||
"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": 87353290,
|
||||
"slip44": 19169,
|
||||
"additional_params": {}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"package_maintainer": "Scotty",
|
||||
"package_maintainer_email": "scotty.rvn@gmail.com"
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,7 @@
|
||||
| MonetaryUnit | 9057 | 9157 | 8057 | 38357 |
|
||||
| ZelCash | 9058 | 9158 | 8058 | 38358 |
|
||||
| Ravencoin | 9059 | 9159 | 8059 | 38359 |
|
||||
| Ritocoin | 9060 | 9160 | 8060 | 38360 |
|
||||
| Flo | 9066 | 9166 | 8066 | 38366 |
|
||||
| Polis | 9067 | 9167 | 8067 | 38367 |
|
||||
| Qtum | 9088 | 9188 | 8088 | 38388 |
|
||||
|
||||
96
tests/rpc/testdata/ritocoin.json
vendored
Normal file
96
tests/rpc/testdata/ritocoin.json
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"blockHeight": 250567,
|
||||
"blockHash": "000000000063732fe43aa186a706840650e1ca8d5518dedcc604102009092d64",
|
||||
"blockTime": 1558652720,
|
||||
"blockTxs": [
|
||||
"547b7b60419826cda46c97ad95b8679fc5a3ef1ef8749ed97bf7080502154937",
|
||||
"ad3e7e11991bafa0740cc17f3fe82e855000c7232122a11a66b27ba50884c71b",
|
||||
"1a395298cc0ec3100eb0bda8f10c8d4250ddd54b3ed9af5d3f76b9c88e2b729a"
|
||||
],
|
||||
"txDetails": {
|
||||
"ad3e7e11991bafa0740cc17f3fe82e855000c7232122a11a66b27ba50884c71b": {
|
||||
"hex": "0200000002e7a41b106da1d8357084474789f01ec65cf6a2ef4a58a19af97ee2ef03fd15b2010000006a47304402202f8ce8b00ab0c171c8a03d0d4bc65fc8f01d8c3038c3b606aa12d8816401ef7002204f2fc6a420d145668a6e3938a6adb378d49f0522c5c8d411e648600f90fb456e0121038860094e22ebae773256eb3e8a60754d05d12bd3ce6c1c77e37140713049ea0ffeffffffe88d7bdb44740939e74fffbb20db4abdf6dc964431692fbb105a32d916e83e391e0000006b483045022100839e7bf9c4eccaac0bb5a0f8eaaf9e72cbc4240207474e3d99d74115de6f6485022036d3816b1ac6569c373651370025c9dc69e879b494cdb80cb9bf46169b2c6ffc0121024822b76de8e48d8341df11da5b811c36a93b4956c90051405b6ae3e9f61ddd17feffffff020d420539000000001976a914b6accf94c24319889682506eeee546b4d413ea4588ac2f695000000000001976a91493e725537f01c352f28c6a307778800ae024b79688acc6d20300",
|
||||
"txid": "ad3e7e11991bafa0740cc17f3fe82e855000c7232122a11a66b27ba50884c71b",
|
||||
"blocktime": 1558652720,
|
||||
"time": 1558652720,
|
||||
"locktime": 250566,
|
||||
"version": 2,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "b215fd03efe27ef99aa1584aefa2f65cc61ef0894747847035d8a16d101ba4e7",
|
||||
"vout": 1,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "47304402202f8ce8b00ab0c171c8a03d0d4bc65fc8f01d8c3038c3b606aa12d8816401ef7002204f2fc6a420d145668a6e3938a6adb378d49f0522c5c8d411e648600f90fb456e0121038860094e22ebae773256eb3e8a60754d05d12bd3ce6c1c77e37140713049ea0f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"txid": "393ee816d9325a10bb2f69314496dcf6bd4adb20bbff4fe739097444db7b8de8",
|
||||
"vout": 30,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "483045022100839e7bf9c4eccaac0bb5a0f8eaaf9e72cbc4240207474e3d99d74115de6f6485022036d3816b1ac6569c373651370025c9dc69e879b494cdb80cb9bf46169b2c6ffc0121024822b76de8e48d8341df11da5b811c36a93b4956c90051405b6ae3e9f61ddd17"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": 9.56645901,
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914b6accf94c24319889682506eeee546b4d413ea4588ac"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.05269807,
|
||||
"n": 1,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a91493e725537f01c352f28c6a307778800ae024b79688ac"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"1a395298cc0ec3100eb0bda8f10c8d4250ddd54b3ed9af5d3f76b9c88e2b729a": {
|
||||
"hex": "0200000002610a01e927b3c771e545c73312bd1e8cbcdcce4bb5e4cfa528f7acaaaaeb5007000000006b483045022100f0deb144cf2f8a4a3c99acce5208d2b4a93cd8c5d870905a2e71c4dd80e3ca8b022046d7a612043c610eaca100097960cf202751d4c0598c41063cf51c7648e56b43012103d0804494a2616ea51b39f047b6ede43660874b511cb1c5f75ad2a8c208c3c887feffffff72d03c659bd35d40818411eeced6525d6c15cdc7f55533e253d7961eee2c1f14000000006b4830450221008c2773819fd972eee4d51105f4b43a363dfb9c45eb897f97e5780f93d685dd9a0220049fd5eb3856a26c39698f53cc8ae1e701894680b556cce5202077a266f0447801210219c8273f88355218bcd57f41b1e1af97826cf98a63ec2559d6a4a1002e198bb1feffffff02486cfe52110400001976a914b6accf94c24319889682506eeee546b4d413ea4588accd841100000000001976a91483b5b7c1b97fbe29d83b0171ebe4f4d05fb7869b88acc6d20300",
|
||||
"txid": "1a395298cc0ec3100eb0bda8f10c8d4250ddd54b3ed9af5d3f76b9c88e2b729a",
|
||||
"blocktime": 1558652720,
|
||||
"time": 1558652720,
|
||||
"locktime": 250566,
|
||||
"version": 2,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "0750ebaaaaacf728a5cfe4b54bcedcbc8c1ebd1233c745e571c7b327e9010a61",
|
||||
"vout": 0,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "483045022100f0deb144cf2f8a4a3c99acce5208d2b4a93cd8c5d870905a2e71c4dd80e3ca8b022046d7a612043c610eaca100097960cf202751d4c0598c41063cf51c7648e56b43012103d0804494a2616ea51b39f047b6ede43660874b511cb1c5f75ad2a8c208c3c887"
|
||||
}
|
||||
},
|
||||
{
|
||||
"txid": "141f2cee1e96d753e23355f5c7cd156c5d52d6ceee118481405dd39b653cd072",
|
||||
"vout": 0,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "4830450221008c2773819fd972eee4d51105f4b43a363dfb9c45eb897f97e5780f93d685dd9a0220049fd5eb3856a26c39698f53cc8ae1e701894680b556cce5202077a266f0447801210219c8273f88355218bcd57f41b1e1af97826cf98a63ec2559d6a4a1002e198bb1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": 44724.53360712,
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914b6accf94c24319889682506eeee546b4d413ea4588ac"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.01148109,
|
||||
"n": 1,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a91483b5b7c1b97fbe29d83b0171ebe4f4d05fb7869b88ac"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
156
tests/sync/testdata/ritocoin.json
vendored
Normal file
156
tests/sync/testdata/ritocoin.json
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"connectBlocks": {
|
||||
"syncRanges": [
|
||||
{"lower": 250225, "upper": 250235},
|
||||
{"lower": 250508, "upper": 250516}
|
||||
],
|
||||
"blocks": {
|
||||
"250235": {
|
||||
"height": 250235,
|
||||
"hash": "00000000009ad0e7aef5e20c6b0d82a03d192d78f29242e49cb71993ddde3fd4",
|
||||
"noTxs": 4,
|
||||
"txDetails": [
|
||||
{
|
||||
"hex": "02000000023ad2103928d207dee33dc6a91fb986de32002348bb25470fecfa1d174d526d4a000000006a47304402206e51a569bf613823d78b57b8f625bc0e1c8a064b9fcb5d72a6ce46ca451172e4022065559744c37efea1d67bbee85dcdc8e891ceaf0ade1b834df1a1f59032f9643e0121039aec3503954b465d7e53c84b30b7b02a438bdd6be3e089e8ae0ee8f509f4690ffeffffffc562c40fe5fd1080a7c4aaded68378f2a6eb5b9acd0a96be00b6fa5a3b066edc060000006b483045022100f0febc6b97ee11f6500a1275ad478a87e73605a1873c8992d8c7d08c5afd3cc502203d28064a20cdbb9fb36a2165fca38ef6beff0e0b1e79e227a3d673cc33aa74d0012102343a746feabd28bb7c16577a753f021ba1c5d472a476c8293bcba4d617ccf664feffffff0284c3ae1a3a0000001976a914b6accf94c24319889682506eeee546b4d413ea4588ac465e1d00000000001976a914919a340bb20df48f85f1036939a926139f203b1d88ac79d10300",
|
||||
"txid": "3e75934dda5cabb1837fc238656bc28f657668f575764dbc6910a17b5654f392",
|
||||
"blocktime": 1558633722,
|
||||
"time": 1558633722,
|
||||
"version": 2,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "4a6d524d171dfaec0f4725bb48230032de86b91fa9c63de3de07d2283910d23a",
|
||||
"vout": 0,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "47304402206e51a569bf613823d78b57b8f625bc0e1c8a064b9fcb5d72a6ce46ca451172e4022065559744c37efea1d67bbee85dcdc8e891ceaf0ade1b834df1a1f59032f9643e0121039aec3503954b465d7e53c84b30b7b02a438bdd6be3e089e8ae0ee8f509f4690f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"txid": "dc6e063b5afab600be960acd9a5beba6f27883d6deaac4a78010fde50fc462c5",
|
||||
"vout": 6,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "483045022100f0febc6b97ee11f6500a1275ad478a87e73605a1873c8992d8c7d08c5afd3cc502203d28064a20cdbb9fb36a2165fca38ef6beff0e0b1e79e227a3d673cc33aa74d0012102343a746feabd28bb7c16577a753f021ba1c5d472a476c8293bcba4d617ccf664"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": 2495.55764100,
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914b6accf94c24319889682506eeee546b4d413ea4588ac"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.01924678,
|
||||
"n": 1,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914919a340bb20df48f85f1036939a926139f203b1d88ac"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"250508": {
|
||||
"height": 250508,
|
||||
"hash": "000000000040c9bbdeedb0ee6b0ba641af6412cc2491f30e55042207e8293368",
|
||||
"noTxs": 2,
|
||||
"txDetails": [
|
||||
{
|
||||
"hex": "020000000610c1477afaf3fa2dc757070bfb84de159e4bfa286d72cc532e3f6053792cb7bc540000006a47304402206792cb2398b602b4f8a10723130f8d0d04f0ac48cfb658b5f68d21307044094702206e07cc83cf7e8d75f5792c91c2711e1d5a3d4405cd8de82312ec9f218973e12e012102ecb8b9e8759a08e422bd4c7264c250769258c7889d0ce372582a3ceebc916d32feffffff184d8bf958babf2f847087f94d2b4500112e3de346901f7fd65ff89c2d0d6c1acc0000006b483045022100afcf085509205cc87b6377de805cc9bc4b469b69dc46118a7083a608265ee00b02206ed1bcaee3e98575ada99755a6034c0bf2ec658e1578d00cc63cfb2597afb7ca01210280c3785adedb05ca95ba1d1dddbe45199edce0ce4a5691ccbb1a0b2f4427fdc8feffffff1bd28c38be44c3c8c7b1c459939868bf15c9f5e700ed0b66c547d272926b5e864e0000006a4730440220440a05bfe3a07de440359a3e63e3f87031c6487ca438b8e4db668d9c68f082f90220078fefebb2dfae8359e518049f5fb006197589613b9e456622e36350f17ef70c012102ed4614c49483739865061b044709bd207b3f0045f9a625756eb3c6021e8580b1feffffff553a1f8281630a8ea1838567b03cda5366035e7a3926624425739d79b8cc689d010000006a473044022012bd571f5f0967c16f1b34af575fb95719fa77e54305af65d95ce6712b26010b02200be0af877aea91e9a510981b525306820dc07ec57909a7a20f43708d271de098012102d74a16c2e336e0391dd118d7df3ad950fcd3c2fd486d7a0d0be539a5abc2599dfeffffff700f1137417b22a7505a18260db9e2c0f859041af7dfa3d4b77d777a71b329cb350000006a47304402205d87742eb9f1da149354686967c065e528d88c88ee3f8480c2499783f2dc3de202200e3333e2b8c7f9b6e3b283c3d82cd092dac62da24701e7b761a4d46c35bf965f012102e93473ace0ab50d16f5dd0f0f8ab854b6820633ae6fb972c8dd7649bf321b22dfeffffff8a3f2b869e3fbfa631266dcf85f9e895219c8b2c0f4ceb7720c69205094bd7db010000006a473044022049cdacdb7b2099c97ac7e5ad7f0e93ac7bace7a373311545e562f03197e73ff002207e85e276d182ba07e4bf82c690de01c7373e175c0105d47dbba229be85f61006012103b0032cddf41c5902a20222e2ae51aa255b9f569db2af80acd78348c72ef9f7bffeffffff026ab42a61240000001976a9141072de28a4415c4d492a5e9c3c684adc59aabd8988ac54cf0d00000000001976a914c30dae1c5362b3c8cb4f262c1acd714394b27a1f88ac8ad20300",
|
||||
"txid": "0e5eecbcea34789c0edae0c20e3026414b4ce317fae948f31a335bae50971798",
|
||||
"blocktime": 1558649298,
|
||||
"time": 1558649298,
|
||||
"version": 2,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "bcb72c7953603f2e53cc726d28fa4b9e15de84fb0b0757c72dfaf3fa7a47c110",
|
||||
"vout": 84,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "47304402206792cb2398b602b4f8a10723130f8d0d04f0ac48cfb658b5f68d21307044094702206e07cc83cf7e8d75f5792c91c2711e1d5a3d4405cd8de82312ec9f218973e12e012102ecb8b9e8759a08e422bd4c7264c250769258c7889d0ce372582a3ceebc916d32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"txid": "865e6b9272d247c5660bed00e7f5c915bf68989359c4b1c7c8c344be388cd21b",
|
||||
"vout": 6,
|
||||
"sequence": 4294967294,
|
||||
"scriptSig": {
|
||||
"hex": "4730440220440a05bfe3a07de440359a3e63e3f87031c6487ca438b8e4db668d9c68f082f90220078fefebb2dfae8359e518049f5fb006197589613b9e456622e36350f17ef70c012102ed4614c49483739865061b044709bd207b3f0045f9a625756eb3c6021e8580b1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": 1562.49011306,
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a9141072de28a4415c4d492a5e9c3c684adc59aabd8988ac"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.00905044,
|
||||
"n": 1,
|
||||
"scriptPubkey": {
|
||||
"hex": "76a914c30dae1c5362b3c8cb4f262c1acd714394b27a1f88ac"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"handleFork": {
|
||||
"syncRanges": [
|
||||
{"lower": 240025, "upper": 240035},
|
||||
{"lower": 240418, "upper": 240426}
|
||||
],
|
||||
"fakeBlocks": {
|
||||
"240033": {
|
||||
"height": 240033,
|
||||
"hash": "0000000001bc4b78d3280501b9e1c246d888fd2d06039beca5082db009993ad1"
|
||||
},
|
||||
"240034": {
|
||||
"height": 240034,
|
||||
"hash": "0000000001dad74967cbda6a2f5539ed4867f85191c149a4c34903ae26af0f5b"
|
||||
},
|
||||
"240035": {
|
||||
"height": 240035,
|
||||
"hash": "00000000016545c48a8a6314f377e56ed111603deec87678840d4928de27f81b"
|
||||
},
|
||||
"240425": {
|
||||
"height": 240425,
|
||||
"hash": "000000000050552bae9d27a9a4ff59714821fdf24bc3e58695a3751697d9ff57"
|
||||
},
|
||||
"240426": {
|
||||
"height": 240426,
|
||||
"hash": "0000000000af0016836419da70eeeaed82d1cef2c8b56a85b569f38e47699a96"
|
||||
}
|
||||
},
|
||||
"realBlocks": {
|
||||
"240033": {
|
||||
"height": 240033,
|
||||
"hash": "0000000000e41ec1ad18b12bc656ac1e5795d4590ee0a4314718685af2718cf6"
|
||||
},
|
||||
"240034": {
|
||||
"height": 240034,
|
||||
"hash": "0000000000de0cb061fb214123353814e4b31bf3ba462a9c6291fa645a25ded2"
|
||||
},
|
||||
"240035": {
|
||||
"height": 240035,
|
||||
"hash": "000000000102c23087b77aac13f7b492793547d782db9854165925da6369edc7"
|
||||
},
|
||||
"240425": {
|
||||
"height": 240425,
|
||||
"hash": "000000000051ed9335d302eb74082e1c7979f29641a038222ed6ccc30f10e47b"
|
||||
},
|
||||
"240426": {
|
||||
"height": 240426,
|
||||
"hash": "0000000000b829bed648f725f7ef1f4d6f756e02d0f1acfcf9afe7c3fb3a2ae3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -160,5 +160,10 @@
|
||||
"rpc": ["GetBlock", "GetBlockHash", "GetTransaction", "GetTransactionForMempool", "MempoolSync",
|
||||
"EstimateSmartFee", "GetBestBlockHash", "GetBestBlockHeight", "GetBlockHeader"],
|
||||
"sync": ["ConnectBlocksParallel", "ConnectBlocks", "HandleFork"]
|
||||
},
|
||||
"ritocoin": {
|
||||
"rpc": ["GetBlock", "GetBlockHash", "GetTransaction", "GetTransactionForMempool", "MempoolSync",
|
||||
"EstimateSmartFee", "GetBestBlockHash", "GetBestBlockHeight", "GetBlockHeader"],
|
||||
"sync": ["ConnectBlocksParallel", "ConnectBlocks", "HandleFork"]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user