Merge branch 'master' into internal-state

This commit is contained in:
Martin Boehm 2018-06-08 11:50:35 +02:00
commit 31dc1d9c00
199 changed files with 1310 additions and 460 deletions

View File

@ -74,14 +74,14 @@ Blockbook logs only to stderr, logging to files is disabled. Verbosity of logs c
# Supported coins
- [BTC](bchain/coins/btc/btc.md)
- [BTC Testnet](bchain/coins/btc/btctestnet.md)
- BCH
- BCH Testnet
- [Bitcoin](bchain/coins/btc/btc.md)
- [Bitcoin Testnet](bchain/coins/btc/btctestnet.md)
- Bcash
- Bcash Testnet
- [ZCash](bchain/coins/zec/zec.md)
- ZCash Testnet
- [Ethereum](bchain/coins/eth/eth.md)
- [Ethereum Ropsten Testnet](bchain/coins/eth/ethropsten.md)
- [Ethereum Testnet Ropsten](bchain/coins/eth/ethropsten.md)
# Data storage in RocksDB
@ -129,21 +129,21 @@ The data are separated to different column families:
## Registry of ports
| coin | blockbook http port | blockbook socket.io port | RPC port | zmq port |
|-------------|---------------------|--------------------------|----------|----------|
| btc | 9030 | 9130 | 8030 | 38330 |
| bch | 9031 | 9131 | 8031 | 38331 |
| zec | 9032 | 9132 | 8032 | 38332 |
| dash | 9033 | 9133 | 8033 | 38333 |
| ltc | 9034 | 9134 | 8034 | 38334 |
| btg | 9035 | 9135 | 8035 | 38335 |
| eth | 9036 | 9136 | 8036 | 38336* |
| etc | 9037 | 9137 | 8037 | |
| xem | 9038 | 9138 | 8038 | 38336 |
| btc-testnet | 19030 | 19130 | 18030 | 48330 |
| bch-testnet | 19031 | 19131 | 18031 | 48331 |
| zec-testnet | 19032 | 19132 | 18032 | 48332 |
| eth-ropsten | 19036 | 19136 | 18036 | 48333* |
| coin | blockbook http port | blockbook socket.io port | backend rpc port | zmq port |
|--------------------------|---------------------|--------------------------|------------------|----------|
| Bitcoin | 9030 | 9130 | 8030 | 38330 |
| Bcash | 9031 | 9131 | 8031 | 38331 |
| Zcash | 9032 | 9132 | 8032 | 38332 |
| dash | 9033 | 9133 | 8033 | 38333 |
| ltc | 9034 | 9134 | 8034 | 38334 |
| btg | 9035 | 9135 | 8035 | 38335 |
| Ethereum | 9036 | 9136 | 8036 | 38336* |
| etc | 9037 | 9137 | 8037 | 38337* |
| xem | 9038 | 9138 | 8038 | 38338 |
| Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 |
| Bcash Testnet | 19031 | 19131 | 18031 | 48331 |
| Zcash Testnet | 19032 | 19132 | 18032 | 48332 |
| Ethereum Testnet Ropsten | 19036 | 19136 | 18036 | 48333* |
\* geth listens on this port, however not as zmq service
## Todo

View File

@ -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"
@ -22,22 +23,35 @@ type blockChainFactory func(config json.RawMessage, pushHandler func(bchain.Noti
var blockChainFactories = make(map[string]blockChainFactory)
func init() {
blockChainFactories["btc"] = btc.NewBitcoinRPC
blockChainFactories["btc-testnet"] = btc.NewBitcoinRPC
blockChainFactories["zec"] = zec.NewZCashRPC
blockChainFactories["zec-testnet"] = zec.NewZCashRPC
blockChainFactories["eth"] = eth.NewEthereumRPC
blockChainFactories["eth-testnet"] = eth.NewEthereumRPC
blockChainFactories["bch"] = bch.NewBCashRPC
blockChainFactories["bch-testnet"] = bch.NewBCashRPC
blockChainFactories["Bitcoin"] = btc.NewBitcoinRPC
blockChainFactories["Testnet"] = btc.NewBitcoinRPC
blockChainFactories["Zcash"] = zec.NewZCashRPC
blockChainFactories["Zcash Testnet"] = zec.NewZCashRPC
blockChainFactories["Ethereum"] = eth.NewEthereumRPC
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
func GetCoinNameFromConfig(configfile string) (string, error) {
data, err := ioutil.ReadFile(configfile)
if err != nil {
return "", errors.Annotatef(err, "Error reading file %v", configfile)
}
var cn struct {
CoinName string `json:"coin_name"`
}
err = json.Unmarshal(data, &cn)
if err != nil {
return "", errors.Annotatef(err, "Error parsing file %v", configfile)
}
return cn.CoinName, nil
}
// NewBlockChain creates bchain.BlockChain of type defined by parameter coin
func NewBlockChain(coin string, configfile string, pushHandler func(bchain.NotificationType), metrics *common.Metrics) (bchain.BlockChain, error) {
bcf, ok := blockChainFactories[coin]
if !ok {
return nil, errors.New(fmt.Sprint("Unsupported coin ", coin, ". Must be one of ", reflect.ValueOf(blockChainFactories).MapKeys()))
}
data, err := ioutil.ReadFile(configfile)
if err != nil {
return nil, errors.Annotatef(err, "Error reading file %v", configfile)
@ -47,6 +61,10 @@ func NewBlockChain(coin string, configfile string, pushHandler func(bchain.Notif
if err != nil {
return nil, errors.Annotatef(err, "Error parsing file %v", configfile)
}
bcf, ok := blockChainFactories[coin]
if !ok {
return nil, errors.New(fmt.Sprint("Unsupported coin '", coin, "'. Must be one of ", reflect.ValueOf(blockChainFactories).MapKeys()))
}
bc, err := bcf(config, pushHandler)
if err != nil {
return nil, err
@ -87,6 +105,10 @@ func (c *blockChainWithMetrics) GetNetworkName() string {
return c.b.GetNetworkName()
}
func (c *blockChainWithMetrics) GetCoinName() string {
return c.b.GetCoinName()
}
func (c *blockChainWithMetrics) GetSubversion() string {
return c.b.GetSubversion()
}

View 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

View File

@ -35,6 +35,7 @@ type BitcoinRPC struct {
}
type Configuration struct {
CoinName string `json:"coin_name"`
RPCURL string `json:"rpcURL"`
RPCUser string `json:"rpcUser"`
RPCPass string `json:"rpcPass"`
@ -154,6 +155,10 @@ func (b *BitcoinRPC) GetNetworkName() string {
return b.Network
}
func (b *BitcoinRPC) GetCoinName() string {
return b.ChainConfig.CoinName
}
func (b *BitcoinRPC) GetSubversion() string {
return b.ChainConfig.Subversion
}

View 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
}

View 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)
}
}
}
}

View 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
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,12 @@ const (
TestNet EthereumNet = 3
)
type Configuration struct {
CoinName string `json:"coin_name"`
RPCURL string `json:"rpcURL"`
RPCTimeout int `json:"rpcTimeout"`
}
// EthereumRPC is an interface to JSON-RPC eth service.
type EthereumRPC struct {
client *ethclient.Client
@ -36,6 +42,7 @@ type EthereumRPC struct {
timeout time.Duration
rpcURL string
Parser *EthereumParser
CoinName string
Testnet bool
Network string
Mempool *bchain.NonUTXOMempool
@ -45,17 +52,13 @@ type EthereumRPC struct {
newBlockSubscription *rpc.ClientSubscription
chanNewTx chan ethcommon.Hash
newTxSubscription *rpc.ClientSubscription
}
type configuration struct {
RPCURL string `json:"rpcURL"`
RPCTimeout int `json:"rpcTimeout"`
ChainConfig *Configuration
}
// NewEthereumRPC returns new EthRPC instance.
func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) {
var err error
var c configuration
var c Configuration
err = json.Unmarshal(config, &c)
if err != nil {
return nil, errors.Annotatef(err, "Invalid configuration file")
@ -67,9 +70,9 @@ func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.Notification
ec := ethclient.NewClient(rc)
s := &EthereumRPC{
client: ec,
rpc: rc,
rpcURL: c.RPCURL,
client: ec,
rpc: rc,
ChainConfig: &c,
}
// always create parser
@ -240,6 +243,10 @@ func (b *EthereumRPC) GetNetworkName() string {
return b.Network
}
func (b *EthereumRPC) GetCoinName() string {
return b.ChainConfig.CoinName
}
func (b *EthereumRPC) GetSubversion() string {
return ""
}

View File

@ -121,6 +121,7 @@ type BlockChain interface {
IsTestnet() bool
GetNetworkName() string
GetSubversion() string
GetCoinName() string
// requests
GetBlockChainInfo() (string, error)
GetBestBlockHash() (string, error)

View File

@ -67,8 +67,6 @@ var (
explorerURL = flag.String("explorer", "", "address of blockchain explorer")
coin = flag.String("coin", "btc", "coin name")
noTxCache = flag.Bool("notxcache", false, "disable tx cache")
computeColumnStats = flag.Bool("computedbstats", false, "compute column stats and exit")
@ -143,16 +141,21 @@ func main() {
return
}
metrics, err := common.GetMetrics(*coin)
if err != nil {
glog.Fatal("GetMetrics: ", err)
}
if *blockchain == "" {
glog.Fatal("Missing blockchaincfg configuration parameter")
}
if chain, err = getBlockChainWithRetry(*coin, *blockchain, pushSynchronizationHandler, metrics, 60); err != nil {
coin, err := coins.GetCoinNameFromConfig(*blockchain)
if err != nil {
glog.Fatal("config: ", err)
}
metrics, err := common.GetMetrics(coin)
if err != nil {
glog.Fatal("metrics: ", err)
}
if chain, err = getBlockChainWithRetry(coin, *blockchain, pushSynchronizationHandler, metrics, 60); err != nil {
glog.Fatal("rpc: ", err)
}
@ -162,7 +165,7 @@ func main() {
}
defer index.Close()
internalState, err = newInternalState(*coin, index)
internalState, err = newInternalState(coin, index)
if err != nil {
glog.Error("internalState: ", err)
return

View File

@ -0,0 +1 @@
/opt/coins/blockbook/bcash_testnet/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/bcash_testnet/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/bcash_testnet/blockbook
/opt/coins/blockbook/bcash_testnet/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bcash_testnet/bin
cert /opt/coins/blockbook/bcash_testnet
static /opt/coins/blockbook/bcash_testnet
configs/bcash_testnet.json => /opt/coins/blockbook/bcash_testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bcash_testnet/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/bcash_testnet/cert/testcert.crt /opt/coins/blockbook/bcash_testnet/cert/blockbook.crt
/opt/coins/blockbook/bcash_testnet/cert/testcert.key /opt/coins/blockbook/bcash_testnet/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bcash &> /dev/null
then
useradd --system -M -U blockbook-bcash -s /bin/false
fi
for dir in /opt/coins/data/bcash_testnet/blockbook /opt/coins/blockbook/bcash_testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bcash" ]
then
chown -R blockbook-bcash:blockbook-bcash $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,20 +1,20 @@
# 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-bch-testnet.service
# $ systemctl edit blockbook-bcash-testnet.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (BCH testnet)
Description=Blockbook daemon (Bcash testnet)
After=network.target
Wants=bcash-testnet.service
[Service]
ExecStart=/opt/coins/blockbook/bch-testnet/bin/blockbook -coin=bch-testnet -blockchaincfg=/opt/coins/blockbook/bch-testnet/config/blockchaincfg.json -datadir=/opt/coins/data/bch-testnet/blockbook/db -sync -httpserver=:19031 -socketio=:19131 -certfile=/opt/coins/blockbook/bch-testnet/cert/blockbook -explorer=https://bitcoincash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/bch-testnet/logs
User=blockbook-bch
ExecStart=/opt/coins/blockbook/bcash_testnet/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bcash_testnet/config/blockchaincfg.json -datadir=/opt/coins/data/bcash_testnet/blockbook/db -sync -httpserver=:19031 -socketio=:19131 -certfile=/opt/coins/blockbook/bcash_testnet/cert/blockbook -explorer=https://bitcoincash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/bcash_testnet/logs
User=blockbook-bcash
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/bch-testnet
WorkingDirectory=/opt/coins/blockbook/bcash_testnet
# Resource limits
LimitNOFILE=500000

View File

@ -0,0 +1 @@
/opt/coins/blockbook/bcash/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/bcash/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/bcash/blockbook
/opt/coins/blockbook/bcash/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bcash/bin
cert /opt/coins/blockbook/bcash
static /opt/coins/blockbook/bcash
configs/bcash.json => /opt/coins/blockbook/bcash/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bcash/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/bcash/cert/testcert.crt /opt/coins/blockbook/bcash/cert/blockbook.crt
/opt/coins/blockbook/bcash/cert/testcert.key /opt/coins/blockbook/bcash/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bcash &> /dev/null
then
useradd --system -M -U blockbook-bcash -s /bin/false
fi
for dir in /opt/coins/data/bcash/blockbook /opt/coins/blockbook/bcash/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bcash" ]
then
chown -R blockbook-bcash:blockbook-bcash $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,20 +1,20 @@
# 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-bch.service
# $ systemctl edit blockbook-bcash.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (BCH mainnet)
Description=Blockbook daemon (Bcash mainnet)
After=network.target
Wants=bcash-bch.service
Wants=bcash.service
[Service]
ExecStart=/opt/coins/blockbook/bch/bin/blockbook -coin=bch -blockchaincfg=/opt/coins/blockbook/bch/config/blockchaincfg.json -datadir=/opt/coins/data/bch/blockbook/db -sync -httpserver=:9031 -socketio=:9131 -certfile=/opt/coins/blockbook/bch/cert/blockbook -explorer=https://bitcoincash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/bch/logs
User=blockbook-bch
ExecStart=/opt/coins/blockbook/bcash/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bcash/config/blockchaincfg.json -datadir=/opt/coins/data/bcash/blockbook/db -sync -httpserver=:9031 -socketio=:9131 -certfile=/opt/coins/blockbook/bcash/cert/blockbook -explorer=https://bitcoincash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/bcash/logs
User=blockbook-bcash
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/bch
WorkingDirectory=/opt/coins/blockbook/bcash
# Resource limits
LimitNOFILE=500000

View File

@ -1 +0,0 @@
/opt/coins/blockbook/bch-testnet/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/bch-testnet/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/bch-testnet/blockbook
/opt/coins/blockbook/bch-testnet/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bch-testnet/bin
cert /opt/coins/blockbook/bch-testnet
static /opt/coins/blockbook/bch-testnet
configs/bch-testnet.json => /opt/coins/blockbook/bch-testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bch-testnet/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/bch-testnet/cert/testcert.crt /opt/coins/blockbook/bch-testnet/cert/blockbook.crt
/opt/coins/blockbook/bch-testnet/cert/testcert.key /opt/coins/blockbook/bch-testnet/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bch &> /dev/null
then
useradd --system -M -U blockbook-bch -s /bin/false
fi
for dir in /opt/coins/data/bch-testnet/blockbook /opt/coins/blockbook/bch-testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bch" ]
then
chown -R blockbook-bch:blockbook-bch $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1 +0,0 @@
/opt/coins/blockbook/bch/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/bch/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/bch/blockbook
/opt/coins/blockbook/bch/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bch/bin
cert /opt/coins/blockbook/bch
static /opt/coins/blockbook/bch
configs/bch.json => /opt/coins/blockbook/bch/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bch/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/bch/cert/testcert.crt /opt/coins/blockbook/bch/cert/blockbook.crt
/opt/coins/blockbook/bch/cert/testcert.key /opt/coins/blockbook/bch/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bch &> /dev/null
then
useradd --system -M -U blockbook-bch -s /bin/false
fi
for dir in /opt/coins/data/bch/blockbook /opt/coins/blockbook/bch/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bch" ]
then
chown -R blockbook-bch:blockbook-bch $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -0,0 +1 @@
/opt/coins/blockbook/bgold/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/bgold/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/bgold/blockbook
/opt/coins/blockbook/bgold/logs

View 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

View 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

View 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#

View File

@ -1,20 +1,20 @@
# 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-btc.service
# $ systemctl edit blockbook-bgold.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (BTC mainnet)
Description=Blockbook daemon (Bitcoin Gold mainnet)
After=network.target
Wants=bitcoin-btc.service
Wants=bgold.service
[Service]
ExecStart=/opt/coins/blockbook/btc/bin/blockbook -coin=btc -blockchaincfg=/opt/coins/blockbook/btc/config/blockchaincfg.json -datadir=/opt/coins/data/btc/blockbook/db -sync -httpserver=:9030 -socketio=:9130 -certfile=/opt/coins/blockbook/btc/cert/blockbook -explorer=https://btc-explorer.trezor.io/ -log_dir=/opt/coins/blockbook/btc/logs
User=blockbook-btc
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/btc
WorkingDirectory=/opt/coins/blockbook/bgold
# Resource limits
LimitNOFILE=500000

View File

@ -0,0 +1 @@
/opt/coins/blockbook/bitcoin_testnet/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/bitcoin_testnet/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/bitcoin_testnet/blockbook
/opt/coins/blockbook/bitcoin_testnet/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bitcoin_testnet/bin
cert /opt/coins/blockbook/bitcoin_testnet
static /opt/coins/blockbook/bitcoin_testnet
configs/bitcoin_testnet.json => /opt/coins/blockbook/bitcoin_testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bitcoin_testnet/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/bitcoin_testnet/cert/testcert.crt /opt/coins/blockbook/bitcoin_testnet/cert/blockbook.crt
/opt/coins/blockbook/bitcoin_testnet/cert/testcert.key /opt/coins/blockbook/bitcoin_testnet/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bitcoin &> /dev/null
then
useradd --system -M -U blockbook-bitcoin -s /bin/false
fi
for dir in /opt/coins/data/bitcoin_testnet/blockbook /opt/coins/blockbook/bitcoin_testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bitcoin" ]
then
chown -R blockbook-bitcoin:blockbook-bitcoin $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,20 +1,20 @@
# 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-btc-testnet.service
# $ systemctl edit blockbook-bitcoin-testnet.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (BTC testnet)
Description=Blockbook daemon (Bitcoin testnet)
After=network.target
Wants=bitcoin-testnet.service
[Service]
ExecStart=/opt/coins/blockbook/btc-testnet/bin/blockbook -coin=btc-testnet -blockchaincfg=/opt/coins/blockbook/btc-testnet/config/blockchaincfg.json -datadir=/opt/coins/data/btc-testnet/blockbook/db -sync -httpserver=:19030 -socketio=:19130 -certfile=/opt/coins/blockbook/btc-testnet/cert/blockbook -explorer=https://btc-testnet-explorer.trezor.io/ -log_dir=/opt/coins/blockbook/btc-testnet/logs
User=blockbook-btc
ExecStart=/opt/coins/blockbook/bitcoin_testnet/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bitcoin_testnet/config/blockchaincfg.json -datadir=/opt/coins/data/bitcoin_testnet/blockbook/db -sync -httpserver=:19030 -socketio=:19130 -certfile=/opt/coins/blockbook/bitcoin_testnet/cert/blockbook -explorer=https://btc-testnet-explorer.trezor.io/ -log_dir=/opt/coins/blockbook/bitcoin_testnet/logs
User=blockbook-bitcoin
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/btc-testnet
WorkingDirectory=/opt/coins/blockbook/bitcoin_testnet
# Resource limits
LimitNOFILE=500000

View File

@ -0,0 +1 @@
/opt/coins/blockbook/bitcoin/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/bitcoin/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/bitcoin/blockbook
/opt/coins/blockbook/bitcoin/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/bitcoin/bin
cert /opt/coins/blockbook/bitcoin
static /opt/coins/blockbook/bitcoin
configs/bitcoin.json => /opt/coins/blockbook/bitcoin/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/bitcoin/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/bitcoin/cert/testcert.crt /opt/coins/blockbook/bitcoin/cert/blockbook.crt
/opt/coins/blockbook/bitcoin/cert/testcert.key /opt/coins/blockbook/bitcoin/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-bitcoin &> /dev/null
then
useradd --system -M -U blockbook-bitcoin -s /bin/false
fi
for dir in /opt/coins/data/bitcoin/blockbook /opt/coins/blockbook/bitcoin/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-bitcoin" ]
then
chown -R blockbook-bitcoin:blockbook-bitcoin $dir
fi
done
;;
esac
#DEBHELPER#

View 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-bitcoin.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (Bitcoin mainnet)
After=network.target
Wants=bitcoin.service
[Service]
ExecStart=/opt/coins/blockbook/bitcoin/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bitcoin/config/blockchaincfg.json -datadir=/opt/coins/data/bitcoin/blockbook/db -sync -httpserver=:9030 -socketio=:9130 -certfile=/opt/coins/blockbook/bitcoin/cert/blockbook -explorer=https://btc-explorer.trezor.io/ -log_dir=/opt/coins/blockbook/bitcoin/logs
User=blockbook-bitcoin
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/bitcoin
# 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

View File

@ -1 +0,0 @@
/opt/coins/blockbook/btc-testnet/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/btc-testnet/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/btc-testnet/blockbook
/opt/coins/blockbook/btc-testnet/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/btc-testnet/bin
cert /opt/coins/blockbook/btc-testnet
static /opt/coins/blockbook/btc-testnet
configs/btc-testnet.json => /opt/coins/blockbook/btc-testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/btc-testnet/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/btc-testnet/cert/testcert.crt /opt/coins/blockbook/btc-testnet/cert/blockbook.crt
/opt/coins/blockbook/btc-testnet/cert/testcert.key /opt/coins/blockbook/btc-testnet/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-btc &> /dev/null
then
useradd --system -M -U blockbook-btc -s /bin/false
fi
for dir in /opt/coins/data/btc-testnet/blockbook /opt/coins/blockbook/btc-testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-btc" ]
then
chown -R blockbook-btc:blockbook-btc $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1 +0,0 @@
/opt/coins/blockbook/btc/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/btc/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/btc/blockbook
/opt/coins/blockbook/btc/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec
blockbook /opt/coins/blockbook/btc/bin
cert /opt/coins/blockbook/btc
static /opt/coins/blockbook/btc
configs/btc.json => /opt/coins/blockbook/btc/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/btc/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/btc/cert/testcert.crt /opt/coins/blockbook/btc/cert/blockbook.crt
/opt/coins/blockbook/btc/cert/testcert.key /opt/coins/blockbook/btc/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-btc &> /dev/null
then
useradd --system -M -U blockbook-btc -s /bin/false
fi
for dir in /opt/coins/data/btc/blockbook /opt/coins/blockbook/btc/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-btc" ]
then
chown -R blockbook-btc:blockbook-btc $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -0,0 +1 @@
/opt/coins/blockbook/zcash_testnet/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/zcash_testnet/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/zcash_testnet/blockbook
/opt/coins/blockbook/zcash_testnet/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec --with=install
blockbook /opt/coins/blockbook/zcash_testnet/bin
cert /opt/coins/blockbook/zcash_testnet
static /opt/coins/blockbook/zcash_testnet
configs/zcash_testnet.json => /opt/coins/blockbook/zcash_testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/zcash_testnet/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/zcash_testnet/cert/testcert.crt /opt/coins/blockbook/zcash_testnet/cert/blockbook.crt
/opt/coins/blockbook/zcash_testnet/cert/testcert.key /opt/coins/blockbook/zcash_testnet/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-zcash &> /dev/null
then
useradd --system -M -U blockbook-zcash -s /bin/false
fi
for dir in /opt/coins/data/zcash_testnet/blockbook /opt/coins/blockbook/zcash_testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-zcash" ]
then
chown -R blockbook-zcash:blockbook-zcash $dir
fi
done
;;
esac
#DEBHELPER#

View 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-zcash-testnet.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (Zcash Testnet)
After=network.target
Wants=zcash-testnet.service
[Service]
ExecStart=/opt/coins/blockbook/zcash_testnet/bin/blockbook -blockchaincfg=/opt/coins/blockbook/zcash_testnet/config/blockchaincfg.json -datadir=/opt/coins/data/zcash_testnet/blockbook/db -sync -httpserver=:19032 -socketio=:19132 -certfile=/opt/coins/blockbook/zcash_testnet/cert/blockbook -explorer=https://zcash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/zcash_testnet/logs
User=blockbook-zcash
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/zcash_testnet
# 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

View File

@ -0,0 +1 @@
/opt/coins/blockbook/zcash/config/blockchaincfg.json

View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/coins/blockbook/zcash/bin/logrotate.sh

View File

@ -0,0 +1,2 @@
/opt/coins/data/zcash/blockbook
/opt/coins/blockbook/zcash/logs

View File

@ -0,0 +1,6 @@
#!/usr/bin/dh-exec --with=install
blockbook /opt/coins/blockbook/zcash/bin
cert /opt/coins/blockbook/zcash
static /opt/coins/blockbook/zcash
configs/zcash.json => /opt/coins/blockbook/zcash/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/zcash/bin

View File

@ -0,0 +1,2 @@
/opt/coins/blockbook/zcash/cert/testcert.crt /opt/coins/blockbook/zcash/cert/blockbook.crt
/opt/coins/blockbook/zcash/cert/testcert.key /opt/coins/blockbook/zcash/cert/blockbook.key

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-zcash &> /dev/null
then
useradd --system -M -U blockbook-zcash -s /bin/false
fi
for dir in /opt/coins/data/zcash/blockbook /opt/coins/blockbook/zcash/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-zcash" ]
then
chown -R blockbook-zcash:blockbook-zcash $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,20 +1,20 @@
# 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-zec.service
# $ systemctl edit blockbook-zcash.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (ZEC mainnet)
Description=Blockbook daemon (Zcash mainnet)
After=network.target
Wants=zcash-zec.service
Wants=zcash.service
[Service]
ExecStart=/opt/coins/blockbook/zec/bin/blockbook -coin=zec -blockchaincfg=/opt/coins/blockbook/zec/config/blockchaincfg.json -datadir=/opt/coins/data/zec/blockbook/db -sync -httpserver=:9032 -socketio=:9132 -certfile=/opt/coins/blockbook/zec/cert/blockbook -explorer=https://zec-bitcore1.trezor.io/ -log_dir=/opt/coins/blockbook/zec/logs
User=blockbook-zec
ExecStart=/opt/coins/blockbook/zcash/bin/blockbook -blockchaincfg=/opt/coins/blockbook/zcash/config/blockchaincfg.json -datadir=/opt/coins/data/zcash/blockbook/db -sync -httpserver=:9032 -socketio=:9132 -certfile=/opt/coins/blockbook/zcash/cert/blockbook -explorer=https://zcash.blockexplorer.com/ -log_dir=/opt/coins/blockbook/zcash/logs
User=blockbook-zcash
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/zec
WorkingDirectory=/opt/coins/blockbook/zcash
# Resource limits
LimitNOFILE=500000

View File

@ -1 +0,0 @@
/opt/coins/blockbook/zec-testnet/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/zec-testnet/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/zec-testnet/blockbook
/opt/coins/blockbook/zec-testnet/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec --with=install
blockbook /opt/coins/blockbook/zec-testnet/bin
cert /opt/coins/blockbook/zec-testnet
static /opt/coins/blockbook/zec-testnet
configs/zec-testnet.json => /opt/coins/blockbook/zec-testnet/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/zec-testnet/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/zec-testnet/cert/testcert.crt /opt/coins/blockbook/zec-testnet/cert/blockbook.crt
/opt/coins/blockbook/zec-testnet/cert/testcert.key /opt/coins/blockbook/zec-testnet/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-zec &> /dev/null
then
useradd --system -M -U blockbook-zec -s /bin/false
fi
for dir in /opt/coins/data/zec-testnet/blockbook /opt/coins/blockbook/zec-testnet/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-zec" ]
then
chown -R blockbook-zec:blockbook-zec $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,43 +0,0 @@
# 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-zec-testnet.service
# See "man systemd.service" for details.
[Unit]
Description=Blockbook daemon (ZEC testnet)
After=network.target
Wants=zcash-zec-testnet.service
[Service]
ExecStart=/opt/coins/blockbook/zec-testnet/bin/blockbook -coin=zec-testnet -blockchaincfg=/opt/coins/blockbook/zec-testnet/config/blockchaincfg.json -datadir=/opt/coins/data/zec-testnet/blockbook/db -sync -httpserver=:19032 -socketio=:19132 -certfile=/opt/coins/blockbook/zec-testnet/cert/blockbook -explorer=https://zec-testnet-bitcore1.trezor.io/ -log_dir=/opt/coins/blockbook/zec-testnet/logs
User=blockbook-zec
Type=simple
Restart=on-failure
WorkingDirectory=/opt/coins/blockbook/zec-testnet
# 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

View File

@ -1 +0,0 @@
/opt/coins/blockbook/zec/config/blockchaincfg.json

View File

@ -1,2 +0,0 @@
#!/bin/sh
/opt/coins/blockbook/zec/bin/logrotate.sh

View File

@ -1,2 +0,0 @@
/opt/coins/data/zec/blockbook
/opt/coins/blockbook/zec/logs

View File

@ -1,6 +0,0 @@
#!/usr/bin/dh-exec --with=install
blockbook /opt/coins/blockbook/zec/bin
cert /opt/coins/blockbook/zec
static /opt/coins/blockbook/zec
configs/zec.json => /opt/coins/blockbook/zec/config/blockchaincfg.json
logrotate.sh /opt/coins/blockbook/zec/bin

View File

@ -1,2 +0,0 @@
/opt/coins/blockbook/zec/cert/testcert.crt /opt/coins/blockbook/zec/cert/blockbook.crt
/opt/coins/blockbook/zec/cert/testcert.key /opt/coins/blockbook/zec/cert/blockbook.key

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u blockbook-zec &> /dev/null
then
useradd --system -M -U blockbook-zec -s /bin/false
fi
for dir in /opt/coins/data/zec/blockbook /opt/coins/blockbook/zec/logs
do
if [ "$(stat -c '%U' $dir)" != "blockbook-zec" ]
then
chown -R blockbook-zec:blockbook-zec $dir
fi
done
;;
esac
#DEBHELPER#

View File

@ -1,3 +1,9 @@
blockbook (0.0.5) unstable; urgency=medium
* v0.0.5, renamed packages and coins
-- Martin Bohm <martin.bohm@satoshilabs.com> Wed, 06 Jun 2018 11:12:13 +0200
blockbook (0.0.4) unstable; urgency=medium
* v0.0.4

View File

@ -10,32 +10,37 @@ Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Satoshilabs blockbook server (tools)
Package: blockbook-btc
Package: blockbook-bitcoin
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bitcoin-btc
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bitcoin
Description: Satoshilabs blockbook server (Bitcoin mainnet)
Package: blockbook-btc-testnet
Package: blockbook-bitcoin-testnet
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bitcoin-testnet
Description: Satoshilabs blockbook server (Bitcoin testnet)
Package: blockbook-zec
Package: blockbook-zcash
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, zcash-zec
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, zcash
Description: Satoshilabs blockbook server (ZCash mainnet)
Package: blockbook-zec-testnet
Package: blockbook-zcash-testnet
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, zcash-testnet
Description: Satoshilabs blockbook server (ZCash testnet)
Package: blockbook-bch
Package: blockbook-bcash
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bcash-bch
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bcash
Description: Satoshilabs blockbook server (Bitcoin Cash mainnet)
Package: blockbook-bch-testnet
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)

Some files were not shown because too many files have changed in this diff Show More