Merge branch 'btg'
This commit is contained in:
commit
5d84b0affa
@ -4,6 +4,7 @@ import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/bch"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"blockbook/bchain/coins/btg"
|
||||
"blockbook/bchain/coins/eth"
|
||||
"blockbook/bchain/coins/zec"
|
||||
"blockbook/common"
|
||||
@ -30,6 +31,7 @@ func init() {
|
||||
blockChainFactories["Ethereum Testnet Ropsten"] = eth.NewEthereumRPC
|
||||
blockChainFactories["Bcash"] = bch.NewBCashRPC
|
||||
blockChainFactories["Bcash Testnet"] = bch.NewBCashRPC
|
||||
blockChainFactories["Bgold"] = btg.NewBGoldRPC
|
||||
}
|
||||
|
||||
// GetCoinNameFromConfig gets coin name from config file
|
||||
|
||||
@ -85,7 +85,7 @@ func outputScriptToAddresses(script []byte, params *chaincfg.Params) ([]string,
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
func (p *BitcoinParser) txFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx {
|
||||
func (p *BitcoinParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx {
|
||||
vin := make([]bchain.Vin, len(t.TxIn))
|
||||
for i, in := range t.TxIn {
|
||||
if blockchain.IsCoinBaseTx(t) {
|
||||
@ -145,7 +145,7 @@ func (p *BitcoinParser) ParseTx(b []byte) (*bchain.Tx, error) {
|
||||
if err := t.Deserialize(r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tx := p.txFromMsgTx(&t, true)
|
||||
tx := p.TxFromMsgTx(&t, true)
|
||||
tx.Hex = hex.EncodeToString(b)
|
||||
|
||||
for i, vout := range tx.Vout {
|
||||
@ -172,7 +172,7 @@ func (p *BitcoinParser) ParseBlock(b []byte) (*bchain.Block, error) {
|
||||
|
||||
txs := make([]bchain.Tx, len(w.Transactions))
|
||||
for ti, t := range w.Transactions {
|
||||
txs[ti] = p.txFromMsgTx(t, false)
|
||||
txs[ti] = p.TxFromMsgTx(t, false)
|
||||
}
|
||||
|
||||
return &bchain.Block{Txs: txs}, nil
|
||||
|
||||
159
bchain/coins/btg/bgoldparser.go
Normal file
159
bchain/coins/btg/bgoldparser.go
Normal file
@ -0,0 +1,159 @@
|
||||
package btg
|
||||
|
||||
import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
const (
|
||||
MainnetMagic wire.BitcoinNet = 0x446d47e1
|
||||
TestnetMagic wire.BitcoinNet = 0x456e48e2
|
||||
)
|
||||
|
||||
var (
|
||||
MainNetParams chaincfg.Params
|
||||
TestNetParams chaincfg.Params
|
||||
)
|
||||
|
||||
func init() {
|
||||
MainNetParams = chaincfg.MainNetParams
|
||||
MainNetParams.Net = MainnetMagic
|
||||
|
||||
// Address encoding magics
|
||||
MainNetParams.PubKeyHashAddrID = 38 // base58 prefix: G
|
||||
MainNetParams.ScriptHashAddrID = 23 // base58 prefix: A
|
||||
|
||||
TestNetParams = chaincfg.TestNet3Params
|
||||
TestNetParams.Net = TestnetMagic
|
||||
|
||||
// Human-readable part for Bech32 encoded segwit addresses, as defined in
|
||||
// BIP 173.
|
||||
// see https://github.com/satoshilabs/slips/blob/master/slip-0173.md
|
||||
MainNetParams.Bech32HRPSegwit = "btg"
|
||||
TestNetParams.Bech32HRPSegwit = "tbtg"
|
||||
|
||||
err := chaincfg.Register(&MainNetParams)
|
||||
if err == nil {
|
||||
err = chaincfg.Register(&TestNetParams)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// BGoldParser handle
|
||||
type BGoldParser struct {
|
||||
*btc.BitcoinParser
|
||||
}
|
||||
|
||||
// NewBCashParser returns new BGoldParser instance
|
||||
func NewBGoldParser(params *chaincfg.Params, c *btc.Configuration) *BGoldParser {
|
||||
return &BGoldParser{BitcoinParser: btc.NewBitcoinParser(params, c)}
|
||||
}
|
||||
|
||||
// GetChainParams contains network parameters for the main Bitcoin Cash network,
|
||||
// the regression test Bitcoin Cash network, the test Bitcoin Cash network and
|
||||
// the simulation test Bitcoin Cash network, in this order
|
||||
func GetChainParams(chain string) *chaincfg.Params {
|
||||
switch chain {
|
||||
case "test":
|
||||
return &TestNetParams
|
||||
case "regtest":
|
||||
return &chaincfg.RegressionNetParams
|
||||
default:
|
||||
return &MainNetParams
|
||||
}
|
||||
}
|
||||
|
||||
// minTxPayload is the minimum payload size for a transaction. Note
|
||||
// that any realistically usable transaction must have at least one
|
||||
// input or output, but that is a rule enforced at a higher layer, so
|
||||
// it is intentionally not included here.
|
||||
// Version 4 bytes + Varint number of transaction inputs 1 byte + Varint
|
||||
// number of transaction outputs 1 byte + LockTime 4 bytes + min input
|
||||
// payload + min output payload.
|
||||
const minTxPayload = 10
|
||||
|
||||
// maxTxPerBlock is the maximum number of transactions that could
|
||||
// possibly fit into a block.
|
||||
const maxTxPerBlock = (wire.MaxBlockPayload / minTxPayload) + 1
|
||||
|
||||
// headerFixedLength is the length of fixed fields of a block (i.e. without solution)
|
||||
// see https://github.com/BTCGPU/BTCGPU/wiki/Technical-Spec#block-header
|
||||
const headerFixedLength = 44 + (chainhash.HashSize * 3)
|
||||
|
||||
// ParseBlock parses raw block to our Block struct
|
||||
func (p *BGoldParser) ParseBlock(b []byte) (*bchain.Block, error) {
|
||||
r := bytes.NewReader(b)
|
||||
err := skipHeader(r, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w := wire.MsgBlock{}
|
||||
err = 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{Txs: txs}, nil
|
||||
}
|
||||
|
||||
func skipHeader(r io.ReadSeeker, pver uint32) error {
|
||||
_, err := r.Seek(headerFixedLength, io.SeekStart)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
size, err := wire.ReadVarInt(r, pver)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = r.Seek(int64(size), io.SeekCurrent)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeTransactions(r io.Reader, pver uint32, enc wire.MessageEncoding, blk *wire.MsgBlock) error {
|
||||
txCount, err := wire.ReadVarInt(r, pver)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent more transactions than could possibly fit into a block.
|
||||
// It would be possible to cause memory exhaustion and panics without
|
||||
// a sane upper bound on this count.
|
||||
if txCount > maxTxPerBlock {
|
||||
str := fmt.Sprintf("too many transactions to fit into a block "+
|
||||
"[count %d, max %d]", txCount, maxTxPerBlock)
|
||||
return &wire.MessageError{Func: "btg.decodeTransactions", Description: str}
|
||||
}
|
||||
|
||||
blk.Transactions = make([]*wire.MsgTx, 0, txCount)
|
||||
for i := uint64(0); i < txCount; i++ {
|
||||
tx := wire.MsgTx{}
|
||||
err := tx.BtcDecode(r, pver, enc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
blk.Transactions = append(blk.Transactions, &tx)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
123
bchain/coins/btg/bgoldparser_test.go
Normal file
123
bchain/coins/btg/bgoldparser_test.go
Normal file
@ -0,0 +1,123 @@
|
||||
package btg
|
||||
|
||||
import (
|
||||
"blockbook/bchain/coins/btc"
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testParseBlockTxs = map[int][]string{
|
||||
104000: []string{
|
||||
"331d4ef64118e9e5be75f0f51f1a4c5057550c3320e22ff7206f3e1101f113d0",
|
||||
"1f4817d8e91c21d8c8d163dabccdd1875f760fd2dc34a1c2b7b8fa204e103597",
|
||||
"268163b1a1092aa0996d118a6027b0b6f1076627e02addc4e66ae30239936818",
|
||||
"27277a1049fafa2a46368ad02961d37da633416b014bcd42a1f1391753cbf559",
|
||||
"276d2d331585d0968762d9788f71ae71524ccba3494f638b2328ac51e52edd3d",
|
||||
"28d9f85089834c20507cc5e4ec54aaaf5b79feab80cad24a48b8296b6d327a43",
|
||||
"2a2d66d3d9e8b6f154958a388377f681abd82ce98785a5bbf2e27d0ca454da3f",
|
||||
"39c9e995a12b638b541d21ed9f9e555716709add6a97c8ba63fe26e4d26bdc3f",
|
||||
"4a768efc6cc0716932800115989376c2ce3e5e17668b08bd2f43031105a6ac6e",
|
||||
"4bc41fa0188d988d853a176eb847a541c5adf35348eab21d128904aab36e8574",
|
||||
"4cad1bd38cc7be880f3a968af6f13a3aeb5dbdb51a774b7d1ae3d6d6bfd114e4",
|
||||
"6bc558801583bfdb656106889c4b8bd783168133784666338c57e5b2a675a922",
|
||||
"75eb5c1aa89b18ce71f363f95147942b46645ca9b1e472784fcb8c9a096f4f5c",
|
||||
"91755365cff22c4eed09a57a8fb7b2faa5c1caa5fa750c89f830a2bb56fa4c68",
|
||||
"9417d34969891f2a0b9aa3a1226505edf3b429fa1acd21a140d358a217d11d55",
|
||||
"950fbb5f413af9f7c6e5dabfacf68b715c9851b5cf6ab6806960f7cc7cad2f9d",
|
||||
"99b134dae55ddfab1f5d5243c2e60030a9ed969ba5915f98840b877f8af28ce0",
|
||||
"9d7b15eaaccce66e25efe7e2979454ae4968b61281d50f32be9872d2d256c244",
|
||||
"a54df5296f1d1a6101cee0869ffda03502e417fc72475b7902a6dfd5b9329399",
|
||||
"adba400f14b476f0c2b11340ee1fa440208b49fd99c1072136198b5c43664826",
|
||||
"bd7d8fee068bd45b06b4c17ccdf577b4bc2b21c9c4e0cee8453409b0e63b4f5d",
|
||||
"beabd2d68b66a9b47b6aff23b569c1b59e429074f06bdd4993e9d3c2cb69c992",
|
||||
"bfa81174d549eb7ed15be3f965686aff3084f22523c52fbed03c3fc3e18b7cda",
|
||||
"e42472099cb039b1c2248b611ce212580338550977e02bd77accdf29bfd86e96",
|
||||
"f056e02b12d99377f724a4987cde68ecf6f234fd7e2bdf4324172c03d015ba25",
|
||||
"f1815cfb1ef4cfe13ff5ec2c15b5bc55fde043db85daca1bb34cc1b491193308",
|
||||
"f225abce64f75383686fa08abe47242e59e97809a31c8fd7a88acce1e6cbcd27",
|
||||
"f93f1b125bfa2da5ccaaf30ff96635b905b657d48a5962c24be93884a82ef354",
|
||||
"fef75d015f2e9926d1d4bf82e567b91e51af66a6e636d03a072f203dd3062ae5",
|
||||
"051b60a6accead85da54b8d18f4b2360ea946da948d3a27836306d2927fed13e",
|
||||
"28e47b050ec4064cdbd3364f3be9445d52635e9730691ef71ed1db0f0147afd6",
|
||||
"446ebde2457102bcbc2c86cac6ff582c595b00346fd0b27ea5a645240020504b",
|
||||
"46c8fafe2b7bb1646aeefa229b18fa7ffe20fee0a30c4a9ef3e63c36c808f6f7",
|
||||
"550d96cf82fbe91dcc9b96e7aa404f392ee47400c22a98a7631d29eee43fceaa",
|
||||
"59b6b78a72cc33cd29741894b3007b1330fc7f7945bdc0a7a4044ed1dd289c19",
|
||||
"5a3aa07474338cf193c1d7aacdc37f3311c971857ba8cfd308e8fabf5e473882",
|
||||
"82e014b1a9c6cb7729274653ce748c66953de6abb3d1411471515b41b727cf75",
|
||||
"8d70af4f135696da396c9aa9f936b54195bfbe6ff0e08b3b210ca0b52bc167d2",
|
||||
"9949c2f2f3b96a557ef6e14004cbd239a0744c056faca34bdff01e125b4380e8",
|
||||
"d09a8c83123ce1cb6ff837e7670aab5f50c5155d9706dd26f7e0761fd20c5536",
|
||||
"f601482efc5b2dd3d0031e318e840cd06f7cab0ffff8cc37a5bf471b515ddfb7",
|
||||
"f88d3c0ebe8b294f11e70d2ae6d2f0048437bfb20dae7e69d545a4c72d3432dd",
|
||||
"2b9e574b90556250b20a79d9c94ceaff3dfd062291c34c3fa79c7ca8d85a3500",
|
||||
"b9484ef8e38ceafe8d2b09ecf59562d262b15d185844b2d00db362718d52b2c2",
|
||||
"07a4af0a81b55313a1c16da7d808829d689436fd078fa9559b6d1603dd72474e",
|
||||
"3393bdcc3a7232b37d0fb6b56d603a2b9b0419e461bf989f1c375859a5d0156a",
|
||||
"33ad36d79d63b575c7532c516f16b19541f5c637caf7073beb7ddf604c3f39cc",
|
||||
},
|
||||
532144: []string{
|
||||
"574348e23301cc89535408b6927bf75f2ac88fadf8fdfb181c17941a5de02fe0",
|
||||
"9f048446401e7fac84963964df045b1f3992eda330a87b02871e422ff0a3fd28",
|
||||
"9516c320745a227edb07c98087b1febea01c3ba85122a34387896fc82ba965e4",
|
||||
"9d37e1ab5a28c49ce5e7ece4a2b9df740fb4c3a84bdec93b3023148cf20f0de7",
|
||||
"a3cd0481b983ba402fed8805ef9daf5063d6d4e5085b82eca5b4781c9e362d6a",
|
||||
"7f2c2567e8de0321744817cfeb751922d7e8d82ef71aa01164c84fb74a463a53",
|
||||
"cd064315e3f5d07920b3d159160c218d0bb5b7b4be606265767b208ae7e256eb",
|
||||
"a9523400f341aa425b0fcc00656ec1fa5421bf3545433bff98a8614fc9a99d1f",
|
||||
"ec766daacbb05a8f48a3205e5c6494a7c817bd35eefff9aaf55e0dd47fe6e8fc",
|
||||
"0837a4116872abf52caa52d1ff7608674ba5b09a239a1f43f3a25ba4052e4c77",
|
||||
"a3e23a0344fe6ba7083fc6afb940517cdb666dce00389cbd8598bd599199cdda",
|
||||
"048d951cef84d35d68f0bc3b575662caf23fee692e8035bd5efe38ab67e0d6c2",
|
||||
"11307491b24d42ddd7ea27fc795d444b65c3936be31b904a97da68fabc85e5b8",
|
||||
"84ad99dc0884e03fc71f163eebf515a1eb79d00b1aad7a1126b22747960a8275",
|
||||
"728c8d0858e506d4a1a9b506f7b974b335e6c54047af9f40d4cb1a0561f783e1",
|
||||
},
|
||||
}
|
||||
|
||||
func helperLoadBlock(t *testing.T, height int) []byte {
|
||||
name := fmt.Sprintf("block_dump.%d", height)
|
||||
path := filepath.Join("testdata", name)
|
||||
|
||||
d, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
d = bytes.TrimSpace(d)
|
||||
|
||||
b := make([]byte, hex.DecodedLen(len(d)))
|
||||
_, err = hex.Decode(b, d)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
func TestParseBlock(t *testing.T) {
|
||||
p := NewBGoldParser(GetChainParams("main"), &btc.Configuration{})
|
||||
|
||||
for height, txs := range testParseBlockTxs {
|
||||
b := helperLoadBlock(t, height)
|
||||
|
||||
blk, err := p.ParseBlock(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(blk.Txs) != len(txs) {
|
||||
t.Errorf("ParseBlock() number of transactions: got %d, want %d", len(blk.Txs), len(txs))
|
||||
}
|
||||
|
||||
for ti, tx := range txs {
|
||||
if blk.Txs[ti].Txid != tx {
|
||||
t.Errorf("ParseBlock() transaction %d: got %s, want %s", ti, blk.Txs[ti].Txid, tx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
bchain/coins/btg/bgoldrpc.go
Normal file
54
bchain/coins/btg/bgoldrpc.go
Normal file
@ -0,0 +1,54 @@
|
||||
package btg
|
||||
|
||||
import (
|
||||
"blockbook/bchain"
|
||||
"blockbook/bchain/coins/btc"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// BGoldRPC is an interface to JSON-RPC bitcoind service.
|
||||
type BGoldRPC struct {
|
||||
*btc.BitcoinRPC
|
||||
}
|
||||
|
||||
// NewBCashRPC returns new BGoldRPC instance.
|
||||
func NewBGoldRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) {
|
||||
b, err := btc.NewBitcoinRPC(config, pushHandler)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s := &BGoldRPC{
|
||||
b.(*btc.BitcoinRPC),
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// Initialize initializes BGoldRPC instance.
|
||||
func (b *BGoldRPC) Initialize() error {
|
||||
chainName, err := b.GetChainInfoAndInitializeMempool(b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params := GetChainParams(chainName)
|
||||
|
||||
// always create parser
|
||||
b.Parser = NewBGoldParser(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
|
||||
}
|
||||
1
bchain/coins/btg/testdata/block_dump.104000
vendored
Normal file
1
bchain/coins/btg/testdata/block_dump.104000
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bchain/coins/btg/testdata/block_dump.532144
vendored
Normal file
1
bchain/coins/btg/testdata/block_dump.532144
vendored
Normal file
File diff suppressed because one or more lines are too long
1
build/deb/debian/blockbook-bgold.conffiles
Normal file
1
build/deb/debian/blockbook-bgold.conffiles
Normal file
@ -0,0 +1 @@
|
||||
/opt/coins/blockbook/bgold/config/blockchaincfg.json
|
||||
2
build/deb/debian/blockbook-bgold.cron.daily
Normal file
2
build/deb/debian/blockbook-bgold.cron.daily
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/opt/coins/blockbook/bgold/bin/logrotate.sh
|
||||
2
build/deb/debian/blockbook-bgold.dirs
Normal file
2
build/deb/debian/blockbook-bgold.dirs
Normal file
@ -0,0 +1,2 @@
|
||||
/opt/coins/data/bgold/blockbook
|
||||
/opt/coins/blockbook/bgold/logs
|
||||
6
build/deb/debian/blockbook-bgold.install
Executable file
6
build/deb/debian/blockbook-bgold.install
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/dh-exec
|
||||
blockbook /opt/coins/blockbook/bgold/bin
|
||||
cert /opt/coins/blockbook/bgold
|
||||
static /opt/coins/blockbook/bgold
|
||||
configs/bgold.json => /opt/coins/blockbook/bgold/config/blockchaincfg.json
|
||||
logrotate.sh /opt/coins/blockbook/bgold/bin
|
||||
2
build/deb/debian/blockbook-bgold.links
Normal file
2
build/deb/debian/blockbook-bgold.links
Normal file
@ -0,0 +1,2 @@
|
||||
/opt/coins/blockbook/bgold/cert/testcert.crt /opt/coins/blockbook/bgold/cert/blockbook.crt
|
||||
/opt/coins/blockbook/bgold/cert/testcert.key /opt/coins/blockbook/bgold/cert/blockbook.key
|
||||
23
build/deb/debian/blockbook-bgold.postinst
Normal file
23
build/deb/debian/blockbook-bgold.postinst
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
if ! id -u blockbook-bgold &> /dev/null
|
||||
then
|
||||
useradd --system -M -U blockbook-bgold -s /bin/false
|
||||
fi
|
||||
|
||||
for dir in /opt/coins/data/bgold/blockbook /opt/coins/blockbook/bgold/logs
|
||||
do
|
||||
if [ "$(stat -c '%U' $dir)" != "blockbook-bgold" ]
|
||||
then
|
||||
chown -R blockbook-bgold:blockbook-bgold $dir
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
43
build/deb/debian/blockbook-bgold.service
Normal file
43
build/deb/debian/blockbook-bgold.service
Normal file
@ -0,0 +1,43 @@
|
||||
# It is not recommended to modify this file in-place, because it will
|
||||
# be overwritten during package upgrades. If you want to add further
|
||||
# options or overwrite existing ones then use
|
||||
# $ systemctl edit blockbook-bgold.service
|
||||
# See "man systemd.service" for details.
|
||||
|
||||
[Unit]
|
||||
Description=Blockbook daemon (Bitcoin Gold mainnet)
|
||||
After=network.target
|
||||
Wants=bgold.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/coins/blockbook/bgold/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bgold/config/blockchaincfg.json -datadir=/opt/coins/data/bgold/blockbook/db -sync -httpserver=:9035 -socketio=:9135 -certfile=/opt/coins/blockbook/bgold/cert/blockbook -explorer=https://btg-bitcore1.trezor.io/ -log_dir=/opt/coins/blockbook/bgold/logs
|
||||
User=blockbook-bgold
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
WorkingDirectory=/opt/coins/blockbook/bgold
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=500000
|
||||
|
||||
# Hardening measures
|
||||
####################
|
||||
|
||||
# Provide a private /tmp and /var/tmp.
|
||||
PrivateTmp=true
|
||||
|
||||
# Mount /usr, /boot/ and /etc read-only for the process.
|
||||
ProtectSystem=full
|
||||
|
||||
# Disallow the process and all of its children to gain
|
||||
# new privileges through execve().
|
||||
NoNewPrivileges=true
|
||||
|
||||
# Use a new /dev namespace only populated with API pseudo devices
|
||||
# such as /dev/null, /dev/zero and /dev/random.
|
||||
PrivateDevices=true
|
||||
|
||||
# Deny the creation of writable and executable memory mappings.
|
||||
MemoryDenyWriteExecute=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -39,3 +39,8 @@ Package: blockbook-bcash-testnet
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bcash-testnet
|
||||
Description: Satoshilabs blockbook server (Bitcoin Cash testnet)
|
||||
|
||||
Package: blockbook-bgold
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bgold
|
||||
Description: Satoshilabs blockbook server (Bitcoin Gold mainnet)
|
||||
|
||||
13
configs/bgold.json
Normal file
13
configs/bgold.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"coin_name": "Bgold",
|
||||
"rpcURL": "http://127.0.0.1:8035",
|
||||
"rpcUser": "rpc",
|
||||
"rpcPass": "rpc",
|
||||
"rpcTimeout": 25,
|
||||
"parse": true,
|
||||
"zeroMQBinding": "tcp://127.0.0.1:38335",
|
||||
"subversion": "/Bitcoin Gold:0.15.0.2/",
|
||||
"mempoolWorkers": 8,
|
||||
"mempoolSubWorkers": 2,
|
||||
"blockAddressesToKeep": 300
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
TARGETS = bitcoin zcash bcash ethereum
|
||||
TARGETS = bitcoin zcash bcash ethereum bgold
|
||||
IMAGE = blockbook-backend-build-deb
|
||||
NO_CACHE = false
|
||||
|
||||
|
||||
13
contrib/backends/bgold/Makefile
Normal file
13
contrib/backends/bgold/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
BGOLD_VERSION := 0.15.0
|
||||
BUILD_VERSION := .2
|
||||
|
||||
all:
|
||||
wget https://github.com/BTCGPU/BTCGPU/releases/download/v${BGOLD_VERSION}${BUILD_VERSION}/bitcoin-gold-${BGOLD_VERSION}-x86_64-linux-gnu.tar.gz
|
||||
tar -xf bitcoin-gold-${BGOLD_VERSION}-x86_64-linux-gnu.tar.gz
|
||||
mv bitcoin-gold-${BGOLD_VERSION} bgold
|
||||
rm bgold/bin/bitcoin-qt
|
||||
rm bgold/bin/test_bitcoin
|
||||
|
||||
clean:
|
||||
rm -rf bgold
|
||||
rm -f bitcoin-gold-${BGOLD_VERSION}-x86_64-linux-gnu.tar.gz*
|
||||
209
contrib/backends/bgold/bgold.conf
Normal file
209
contrib/backends/bgold/bgold.conf
Normal file
@ -0,0 +1,209 @@
|
||||
daemon=1
|
||||
server=1
|
||||
nolisten=1
|
||||
rpcuser=rpc
|
||||
rpcpassword=rpc
|
||||
rpcport=8035
|
||||
txindex=1
|
||||
|
||||
zmqpubhashtx=tcp://127.0.0.1:38335
|
||||
zmqpubhashblock=tcp://127.0.0.1:38335
|
||||
zmqpubrawblock=tcp://127.0.0.1:38335
|
||||
zmqpubrawtx=tcp://127.0.0.1:38335
|
||||
|
||||
mempoolexpiry=72
|
||||
rpcworkqueue=1100
|
||||
maxmempool=2000
|
||||
dbcache=1000
|
||||
|
||||
timeout=768
|
||||
maxconnections=250
|
||||
addnode=188.126.0.134
|
||||
addnode=45.56.84.44
|
||||
|
||||
addnode=109.201.133.93:8338
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=188.120.223.153:8338
|
||||
addnode=79.137.64.158:8338
|
||||
addnode=78.193.221.106:8338
|
||||
addnode=139.59.151.13:8338
|
||||
addnode=76.16.12.81:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=43.207.67.209:8338
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=79.137.64.158:8338
|
||||
addnode=78.193.221.106:8338
|
||||
addnode=139.59.151.13:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=178.158.247.119:8338
|
||||
addnode=109.201.133.93:8338
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=139.59.151.13:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=188.120.223.153:8338
|
||||
addnode=178.158.247.119:8338
|
||||
addnode=78.193.221.106:8338
|
||||
addnode=79.137.64.158:8338
|
||||
addnode=76.16.12.81:8338
|
||||
addnode=176.12.32.153:8338
|
||||
addnode=178.158.247.122:8338
|
||||
addnode=81.37.147.185:8338
|
||||
addnode=176.12.32.153:8338
|
||||
addnode=79.137.64.158:8338
|
||||
addnode=178.158.247.122:8338
|
||||
addnode=66.70.247.151:8338
|
||||
addnode=89.18.27.165:8338
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=91.222.17.86:8338
|
||||
addnode=37.59.50.143:8338
|
||||
addnode=91.50.219.221:8338
|
||||
addnode=154.16.63.17:8338
|
||||
addnode=213.136.76.42:8338
|
||||
addnode=176.99.4.140:8338
|
||||
addnode=176.9.48.36:8338
|
||||
addnode=78.193.221.106:8338
|
||||
addnode=34.236.228.99:8338
|
||||
addnode=213.154.230.107:8338
|
||||
addnode=111.231.66.252:8338
|
||||
addnode=188.120.223.153:8338
|
||||
addnode=219.89.122.82:8338
|
||||
addnode=109.192.23.101:8338
|
||||
addnode=98.114.91.222:8338
|
||||
addnode=217.66.156.41:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=114.44.222.73:8338
|
||||
addnode=91.224.140.216:8338
|
||||
addnode=149.154.71.96:8338
|
||||
addnode=107.181.183.242:8338
|
||||
addnode=36.78.96.92:8338
|
||||
addnode=46.22.7.74:8338
|
||||
addnode=89.110.53.186:8338
|
||||
addnode=73.243.220.85:8338
|
||||
addnode=109.86.137.8:8338
|
||||
addnode=77.78.12.89:8338
|
||||
addnode=87.92.116.26:8338
|
||||
addnode=93.78.122.48:8338
|
||||
addnode=35.195.83.0:8338
|
||||
addnode=46.147.75.220:8338
|
||||
addnode=212.47.236.104:8338
|
||||
addnode=95.220.100.230:8338
|
||||
addnode=178.70.142.247:8338
|
||||
addnode=45.76.136.149:8338
|
||||
addnode=94.155.74.206:8338
|
||||
addnode=178.70.142.247:8338
|
||||
addnode=128.199.228.97:8338
|
||||
addnode=77.171.144.207:8338
|
||||
addnode=159.89.192.119:8338
|
||||
addnode=136.63.238.170:8338
|
||||
addnode=31.27.193.105:8338
|
||||
addnode=176.107.192.240:8338
|
||||
addnode=94.140.241.96:8338
|
||||
addnode=66.108.15.5:8338
|
||||
addnode=81.177.127.204:8338
|
||||
addnode=88.18.69.174:8338
|
||||
addnode=178.70.130.94:8338
|
||||
addnode=78.98.162.140:8338
|
||||
addnode=95.133.156.224:8338
|
||||
addnode=46.188.16.96:8338
|
||||
addnode=94.247.16.21:8338
|
||||
addnode=eunode.pool.gold:8338
|
||||
addnode=asianode.pool.gold:8338
|
||||
addnode=45.56.84.44:8338
|
||||
addnode=176.9.48.36:8338
|
||||
addnode=93.57.253.121:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=176.12.32.153:8338
|
||||
addnode=pool.serverpower.net:8338
|
||||
addnode=213.154.229.126:8338
|
||||
addnode=213.154.230.106:8338
|
||||
addnode=213.154.230.107:8338
|
||||
addnode=213.154.229.50:8338
|
||||
addnode=145.239.0.50:8338
|
||||
addnode=107.181.183.242:8338
|
||||
addnode=109.201.133.93:8338
|
||||
addnode=120.41.190.109:8338
|
||||
addnode=120.41.191.224:8338
|
||||
addnode=138.68.249.79:8338
|
||||
addnode=13.95.223.202:8338
|
||||
addnode=145.239.0.50:8338
|
||||
addnode=149.56.95.26:8338
|
||||
addnode=158.69.103.228:8338
|
||||
addnode=159.89.192.119:8338
|
||||
addnode=164.132.207.143:8338
|
||||
addnode=171.100.141.106:8338
|
||||
addnode=172.104.157.62:8338
|
||||
addnode=173.176.95.92:8338
|
||||
addnode=176.12.32.153:8338
|
||||
addnode=178.239.54.250:8338
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=185.139.2.140:8338
|
||||
addnode=188.120.223.153:8338
|
||||
addnode=190.46.2.92:8338
|
||||
addnode=192.99.194.113:8338
|
||||
addnode=199.229.248.218:8338
|
||||
addnode=213.154.229.126:8338
|
||||
addnode=213.154.229.50:8338
|
||||
addnode=213.154.230.106:8338
|
||||
addnode=213.154.230.107:8338
|
||||
addnode=217.182.199.21
|
||||
addnode=35.189.127.200:8338
|
||||
addnode=35.195.83.0:8338
|
||||
addnode=35.197.197.166:8338
|
||||
addnode=35.200.168.155:8338
|
||||
addnode=35.203.167.11:8338
|
||||
addnode=37.59.50.143:8338
|
||||
addnode=45.27.161.195:8338
|
||||
addnode=45.32.234.160:8338
|
||||
addnode=45.56.84.44:8338
|
||||
addnode=46.188.16.96:8338
|
||||
addnode=46.251.19.171:8338
|
||||
addnode=5.157.119.109:8338
|
||||
addnode=52.28.162.48:8338
|
||||
addnode=54.153.140.202:8338
|
||||
addnode=54.68.81.2:83388338
|
||||
addnode=62.195.190.190:8338
|
||||
addnode=62.216.5.136:8338
|
||||
addnode=65.110.125.175:8338
|
||||
addnode=67.68.226.130:8338
|
||||
addnode=73.243.220.85:8338
|
||||
addnode=77.78.12.89:8338
|
||||
addnode=78.193.221.106:8338
|
||||
addnode=78.98.162.140:8338
|
||||
addnode=79.137.64.158:8338
|
||||
addnode=84.144.177.238:8338
|
||||
addnode=87.92.116.26:8338
|
||||
addnode=89.115.139.117:8338
|
||||
addnode=89.18.27.165:8338
|
||||
addnode=91.50.219.221:8338
|
||||
addnode=93.88.74.26
|
||||
addnode=93.88.74.26:8338
|
||||
addnode=94.155.74.206:8338
|
||||
addnode=95.154.201.132:8338
|
||||
addnode=98.29.248.131:8338
|
||||
addnode=u2.my.to:8338
|
||||
addnode=[2001:470:b:ce:dc70:83ff:fe7a:1e74]:8338
|
||||
addnode=2001:7b8:61d:1:250:56ff:fe90:c89f:8338
|
||||
addnode=2001:7b8:63a:1002:213:154:230:106:8338
|
||||
addnode=2001:7b8:63a:1002:213:154:230:107:8338
|
||||
addnode=45.56.84.44
|
||||
addnode=109.201.133.93:8338
|
||||
addnode=120.41.191.224:30607
|
||||
addnode=138.68.249.79:50992
|
||||
addnode=138.68.249.79:51314
|
||||
addnode=172.104.157.62
|
||||
addnode=178.63.11.246:8338
|
||||
addnode=185.139.2.140:8338
|
||||
addnode=199.229.248.218:28830
|
||||
addnode=35.189.127.200:41220
|
||||
addnode=35.189.127.200:48244
|
||||
addnode=35.195.83.0:35172
|
||||
addnode=35.195.83.0:35576
|
||||
addnode=35.195.83.0:35798
|
||||
addnode=35.197.197.166:32794
|
||||
addnode=35.197.197.166:33112
|
||||
addnode=35.197.197.166:33332
|
||||
addnode=35.203.167.11:52158
|
||||
addnode=37.59.50.143:35254
|
||||
addnode=45.27.161.195:33852
|
||||
addnode=45.27.161.195:36738
|
||||
addnode=45.27.161.195:58628
|
||||
1
contrib/backends/bgold/debian/bgold.conffiles
Normal file
1
contrib/backends/bgold/debian/bgold.conffiles
Normal file
@ -0,0 +1 @@
|
||||
/opt/coins/nodes/bgold/bgold.conf
|
||||
1
contrib/backends/bgold/debian/bgold.dirs
Normal file
1
contrib/backends/bgold/debian/bgold.dirs
Normal file
@ -0,0 +1 @@
|
||||
/opt/coins/data/bgold/backend
|
||||
2
contrib/backends/bgold/debian/bgold.install
Normal file
2
contrib/backends/bgold/debian/bgold.install
Normal file
@ -0,0 +1,2 @@
|
||||
bgold/* /opt/coins/nodes/bgold
|
||||
bgold.conf /opt/coins/nodes/bgold
|
||||
10
contrib/backends/bgold/debian/bgold.logrotate
Normal file
10
contrib/backends/bgold/debian/bgold.logrotate
Normal file
@ -0,0 +1,10 @@
|
||||
/opt/coins/data/bgold/backend/debug.log
|
||||
/opt/coins/data/bgold/backend/db.log
|
||||
{
|
||||
rotate 7
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
20
contrib/backends/bgold/debian/bgold.postinst
Normal file
20
contrib/backends/bgold/debian/bgold.postinst
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
if ! id -u bgold &> /dev/null
|
||||
then
|
||||
useradd --system -M -U bgold -s /bin/false
|
||||
fi
|
||||
|
||||
if [ "$(stat -c '%U' /opt/coins/data/bgold/backend)" != "bgold" ]
|
||||
then
|
||||
chown -R bgold:bgold /opt/coins/data/bgold/backend
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
47
contrib/backends/bgold/debian/bgold.service
Normal file
47
contrib/backends/bgold/debian/bgold.service
Normal file
@ -0,0 +1,47 @@
|
||||
# It is not recommended to modify this file in-place, because it will
|
||||
# be overwritten during package upgrades. If you want to add further
|
||||
# options or overwrite existing ones then use
|
||||
# $ systemctl edit bgold.service
|
||||
# See "man systemd.service" for details.
|
||||
|
||||
# Note that almost all daemon options could be specified in
|
||||
# /opt/coins/nodes/bgold/bgold.conf
|
||||
|
||||
[Unit]
|
||||
Description=Bitcoin Gold daemon (mainnet)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/coins/nodes/bgold/bin/bgoldd -datadir=/opt/coins/data/bgold/backend -conf=/opt/coins/nodes/bgold/bgold.conf -pid=/run/bgold/bgold.pid
|
||||
# Creates /run/bitcoind owned by bgold
|
||||
RuntimeDirectory=bgold
|
||||
User=bgold
|
||||
Type=forking
|
||||
PIDFile=/run/bgold/bgold.pid
|
||||
Restart=on-failure
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=500000
|
||||
|
||||
# Hardening measures
|
||||
####################
|
||||
|
||||
# Provide a private /tmp and /var/tmp.
|
||||
PrivateTmp=true
|
||||
|
||||
# Mount /usr, /boot/ and /etc read-only for the process.
|
||||
ProtectSystem=full
|
||||
|
||||
# Disallow the process and all of its children to gain
|
||||
# new privileges through execve().
|
||||
NoNewPrivileges=true
|
||||
|
||||
# Use a new /dev namespace only populated with API pseudo devices
|
||||
# such as /dev/null, /dev/zero and /dev/random.
|
||||
PrivateDevices=true
|
||||
|
||||
# Deny the creation of writable and executable memory mappings.
|
||||
MemoryDenyWriteExecute=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
11
contrib/backends/bgold/debian/changelog
Normal file
11
contrib/backends/bgold/debian/changelog
Normal file
@ -0,0 +1,11 @@
|
||||
bgold (0.15.0-satoshilabs2) unstable; urgency=medium
|
||||
|
||||
* Renamed package and paths
|
||||
|
||||
-- Jakub Matys <jakub.matys@satoshilabs.com> Wed, 06 Jun 2018 14:07:15 +0200
|
||||
|
||||
bgold (0.15.0-satoshilabs1) unstable; urgency=medium
|
||||
|
||||
* Initial build
|
||||
|
||||
-- Jakub Matys <jakub.matys@satoshilabs.com> Thu, 31 May 2018 11:46:34 +0200
|
||||
1
contrib/backends/bgold/debian/compat
Normal file
1
contrib/backends/bgold/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
||||
11
contrib/backends/bgold/debian/control
Normal file
11
contrib/backends/bgold/debian/control
Normal file
@ -0,0 +1,11 @@
|
||||
Source: bgold
|
||||
Section: satoshilabs
|
||||
Priority: optional
|
||||
Maintainer: jakub.matys@satoshilabs.com
|
||||
Build-Depends: debhelper, wget, tar, gzip, make, dh-systemd, dh-exec
|
||||
Standards-Version: 3.9.5
|
||||
|
||||
Package: bgold
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate
|
||||
Description: Satoshilabs packaged bitcoin-gold server
|
||||
11
contrib/backends/bgold/debian/rules
Executable file
11
contrib/backends/bgold/debian/rules
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
DH_VERBOSE = 1
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd
|
||||
|
||||
override_dh_systemd_start:
|
||||
dh_systemd_start --no-start
|
||||
|
||||
override_dh_installinit:
|
||||
Loading…
Reference in New Issue
Block a user