diff --git a/README.md b/README.md index 586f43e8..5a2f7240 100644 --- a/README.md +++ b/README.md @@ -146,12 +146,14 @@ The data are separated to different column families: | Ethereum Classic | 9037 | 9137 | 8037 | 38337* | | Dogecoin | 9038 | 9138 | 8038 | 38338 | | Namecoin | 9039 | 9139 | 8039 | 38339 | +| Vertcoin | 9040 | 9140 | 8040 | 38340 | | Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 | | Bcash Testnet | 19031 | 19131 | 18031 | 48331 | | Zcash Testnet | 19032 | 19132 | 18032 | 48332 | | Dash Testnet | 19033 | 19133 | 18033 | 48333 | | Litecoin Testnet | 19034 | 19134 | 18034 | 48334 | | Ethereum Testnet Ropsten | 19036 | 19136 | 18036 | 48336* | +| Vertcoin Testnet | 19040 | 19140 | 18040 | 48340 | \* geth listens on this port, however not as zmq service diff --git a/bchain/coins/blockchain.go b/bchain/coins/blockchain.go index 605d80b3..84e08655 100644 --- a/bchain/coins/blockchain.go +++ b/bchain/coins/blockchain.go @@ -9,6 +9,7 @@ import ( "blockbook/bchain/coins/dogecoin" "blockbook/bchain/coins/eth" "blockbook/bchain/coins/litecoin" + "blockbook/bchain/coins/vertcoin" "blockbook/bchain/coins/namecoin" "blockbook/bchain/coins/zec" "blockbook/common" @@ -41,6 +42,8 @@ func init() { blockChainFactories["Litecoin"] = litecoin.NewLitecoinRPC blockChainFactories["Litecoin Testnet"] = litecoin.NewLitecoinRPC blockChainFactories["Dogecoin"] = dogecoin.NewDogecoinRPC + blockChainFactories["Vertcoin"] = vertcoin.NewVertcoinRPC + blockChainFactories["Vertcoin Testnet"] = vertcoin.NewVertcoinRPC blockChainFactories["Namecoin"] = namecoin.NewNamecoinRPC } diff --git a/bchain/coins/vertcoin/vertcoinparser.go b/bchain/coins/vertcoin/vertcoinparser.go new file mode 100644 index 00000000..6f33a9ae --- /dev/null +++ b/bchain/coins/vertcoin/vertcoinparser.go @@ -0,0 +1,62 @@ +package vertcoin + +import ( + "blockbook/bchain/coins/btc" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/wire" +) + +const ( + MainnetMagic wire.BitcoinNet = 0xdab5bffb + TestnetMagic wire.BitcoinNet = 0x74726576 // "vert" word + RegtestMagic wire.BitcoinNet = 0xdab5bffc +) + +var ( + MainNetParams chaincfg.Params + TestNetParams chaincfg.Params +) + +func init() { + MainNetParams = chaincfg.MainNetParams + MainNetParams.Net = MainnetMagic + MainNetParams.PubKeyHashAddrID = 71 + MainNetParams.ScriptHashAddrID = 5 + MainNetParams.Bech32HRPSegwit = "vtc" + + TestNetParams = chaincfg.TestNet3Params + TestNetParams.Net = TestnetMagic + TestNetParams.PubKeyHashAddrID = 74 + TestNetParams.ScriptHashAddrID = 196 + TestNetParams.Bech32HRPSegwit = "tvtc" + + err := chaincfg.Register(&MainNetParams) + if err == nil { + err = chaincfg.Register(&TestNetParams) + } + if err != nil { + panic(err) + } +} + +// VertcoinParser handle +type VertcoinParser struct { + *btc.BitcoinParser +} + +// NewVertcoinParser returns new VertcoinParser instance +func NewVertcoinParser(params *chaincfg.Params, c *btc.Configuration) *VertcoinParser { + return &VertcoinParser{BitcoinParser: btc.NewBitcoinParser(params, c)} +} + +// GetChainParams contains network parameters for the main Vertcoin network, +// and the test Vertcoin network +func GetChainParams(chain string) *chaincfg.Params { + switch chain { + case "test": + return &TestNetParams + default: + return &MainNetParams + } +} diff --git a/bchain/coins/vertcoin/vertcoinrpc.go b/bchain/coins/vertcoin/vertcoinrpc.go new file mode 100644 index 00000000..878b9682 --- /dev/null +++ b/bchain/coins/vertcoin/vertcoinrpc.go @@ -0,0 +1,61 @@ +package vertcoin + +import ( + "blockbook/bchain" + "blockbook/bchain/coins/btc" + "encoding/json" + + "github.com/golang/glog" +) + +// VertcoinRPC is an interface to JSON-RPC bitcoind service. +type VertcoinRPC struct { + *btc.BitcoinRPC +} + +// NewVertcoinRPC returns new VertcoinRPC instance. +func NewVertcoinRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + b, err := btc.NewBitcoinRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &VertcoinRPC{ + b.(*btc.BitcoinRPC), + } + s.RPCMarshaler = btc.JSONMarshalerV2{} + + return s, nil +} + +// Initialize initializes VertcoinRPC instance. +func (b *VertcoinRPC) Initialize() error { + chainName, err := b.GetChainInfoAndInitializeMempool(b) + if err != nil { + return err + } + + glog.Info("Chain name ", chainName) + params := GetChainParams(chainName) + + // always create parser + b.Parser = NewVertcoinParser(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 +} + +// EstimateFee returns fee estimation. +func (b *VertcoinRPC) EstimateFee(blocks int) (float64, error) { + return b.EstimateSmartFee(blocks, true) +} diff --git a/build/deb/debian/blockbook-vertcoin-testnet.conffiles b/build/deb/debian/blockbook-vertcoin-testnet.conffiles new file mode 100644 index 00000000..bd430e24 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.conffiles @@ -0,0 +1 @@ +/opt/coins/blockbook/vertcoin_testnet/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-vertcoin-testnet.cron.daily b/build/deb/debian/blockbook-vertcoin-testnet.cron.daily new file mode 100644 index 00000000..fa2948c5 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.cron.daily @@ -0,0 +1,2 @@ +#!/bin/sh +/opt/coins/blockbook/vertcoin_testnet/bin/logrotate.sh diff --git a/build/deb/debian/blockbook-vertcoin-testnet.dirs b/build/deb/debian/blockbook-vertcoin-testnet.dirs new file mode 100644 index 00000000..56e480b5 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.dirs @@ -0,0 +1,2 @@ +/opt/coins/data/vertcoin_testnet/blockbook +/opt/coins/blockbook/vertcoin_testnet/logs diff --git a/build/deb/debian/blockbook-vertcoin-testnet.install b/build/deb/debian/blockbook-vertcoin-testnet.install new file mode 100755 index 00000000..31fd887c --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.install @@ -0,0 +1,6 @@ +#!/usr/bin/dh-exec +blockbook /opt/coins/blockbook/vertcoin_testnet/bin +cert /opt/coins/blockbook/vertcoin_testnet +static /opt/coins/blockbook/vertcoin_testnet +configs/vertcoin_testnet.json => /opt/coins/blockbook/vertcoin_testnet/config/blockchaincfg.json +logrotate.sh /opt/coins/blockbook/vertcoin_testnet/bin diff --git a/build/deb/debian/blockbook-vertcoin-testnet.links b/build/deb/debian/blockbook-vertcoin-testnet.links new file mode 100644 index 00000000..c5f3c713 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.links @@ -0,0 +1,2 @@ +/opt/coins/blockbook/vertcoin_testnet/cert/testcert.crt /opt/coins/blockbook/vertcoin_testnet/cert/blockbook.crt +/opt/coins/blockbook/vertcoin_testnet/cert/testcert.key /opt/coins/blockbook/vertcoin_testnet/cert/blockbook.key diff --git a/build/deb/debian/blockbook-vertcoin-testnet.postinst b/build/deb/debian/blockbook-vertcoin-testnet.postinst new file mode 100644 index 00000000..158bd67c --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.postinst @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u blockbook-vertcoin &> /dev/null + then + useradd --system -M -U blockbook-vertcoin -s /bin/false + fi + + for dir in /opt/coins/data/vertcoin_testnet/blockbook /opt/coins/blockbook/vertcoin_testnet/logs + do + if [ "$(stat -c '%U' $dir)" != "blockbook-vertcoin" ] + then + chown -R blockbook-vertcoin:blockbook-vertcoin $dir + fi + done + ;; + +esac + +#DEBHELPER# diff --git a/build/deb/debian/blockbook-vertcoin-testnet.service b/build/deb/debian/blockbook-vertcoin-testnet.service new file mode 100644 index 00000000..9d391f83 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin-testnet.service @@ -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-vertcoin-testnet.service +# See "man systemd.service" for details. + +[Unit] +Description=Blockbook daemon (Vertcoin testnet) +After=network.target +Wants=backend-vertcoin-testnet.service + +[Service] +ExecStart=/opt/coins/blockbook/vertcoin_testnet/bin/blockbook -blockchaincfg=/opt/coins/blockbook/vertcoin_testnet/config/blockchaincfg.json -datadir=/opt/coins/data/vertcoin_testnet/blockbook/db -sync -httpserver=:19040 -socketio=:19140 -certfile=/opt/coins/blockbook/vertcoin_testnet/cert/blockbook -explorer=http://explorer.vertcointools.com/ -log_dir=/opt/coins/blockbook/vertcoin_testnet/logs +User=blockbook-vertcoin +Type=simple +Restart=on-failure +WorkingDirectory=/opt/coins/blockbook/vertcoin_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 diff --git a/build/deb/debian/blockbook-vertcoin.conffiles b/build/deb/debian/blockbook-vertcoin.conffiles new file mode 100644 index 00000000..50db5a5b --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.conffiles @@ -0,0 +1 @@ +/opt/coins/blockbook/vertcoin/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-vertcoin.cron.daily b/build/deb/debian/blockbook-vertcoin.cron.daily new file mode 100644 index 00000000..f4a8a2c9 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.cron.daily @@ -0,0 +1,2 @@ +#!/bin/sh +/opt/coins/blockbook/vertcoin/bin/logrotate.sh diff --git a/build/deb/debian/blockbook-vertcoin.dirs b/build/deb/debian/blockbook-vertcoin.dirs new file mode 100644 index 00000000..5b381887 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.dirs @@ -0,0 +1,2 @@ +/opt/coins/data/vertcoin/blockbook +/opt/coins/blockbook/vertcoin/logs diff --git a/build/deb/debian/blockbook-vertcoin.install b/build/deb/debian/blockbook-vertcoin.install new file mode 100755 index 00000000..7fdafb01 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.install @@ -0,0 +1,6 @@ +#!/usr/bin/dh-exec +blockbook /opt/coins/blockbook/vertcoin/bin +cert /opt/coins/blockbook/vertcoin +static /opt/coins/blockbook/vertcoin +configs/vertcoin.json => /opt/coins/blockbook/vertcoin/config/blockchaincfg.json +logrotate.sh /opt/coins/blockbook/vertcoin/bin diff --git a/build/deb/debian/blockbook-vertcoin.links b/build/deb/debian/blockbook-vertcoin.links new file mode 100644 index 00000000..bf9efb36 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.links @@ -0,0 +1,2 @@ +/opt/coins/blockbook/vertcoin/cert/testcert.crt /opt/coins/blockbook/vertcoin/cert/blockbook.crt +/opt/coins/blockbook/vertcoin/cert/testcert.key /opt/coins/blockbook/vertcoin/cert/blockbook.key diff --git a/build/deb/debian/blockbook-vertcoin.postinst b/build/deb/debian/blockbook-vertcoin.postinst new file mode 100644 index 00000000..772ac44e --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.postinst @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u blockbook-vertcoin &> /dev/null + then + useradd --system -M -U blockbook-vertcoin -s /bin/false + fi + + for dir in /opt/coins/data/vertcoin/blockbook /opt/coins/blockbook/vertcoin/logs + do + if [ "$(stat -c '%U' $dir)" != "blockbook-vertcoin" ] + then + chown -R blockbook-vertcoin:blockbook-vertcoin $dir + fi + done + ;; + +esac + +#DEBHELPER# diff --git a/build/deb/debian/blockbook-vertcoin.service b/build/deb/debian/blockbook-vertcoin.service new file mode 100644 index 00000000..9f19ba13 --- /dev/null +++ b/build/deb/debian/blockbook-vertcoin.service @@ -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-vertcoin.service +# See "man systemd.service" for details. + +[Unit] +Description=Blockbook daemon (Vertcoin mainnet) +After=network.target +Wants=backend-vertcoin.service + +[Service] +ExecStart=/opt/coins/blockbook/vertcoin/bin/blockbook -blockchaincfg=/opt/coins/blockbook/vertcoin/config/blockchaincfg.json -datadir=/opt/coins/data/vertcoin/blockbook/db -sync -httpserver=:9040 -socketio=:9140 -certfile=/opt/coins/blockbook/vertcoin/cert/blockbook -explorer=https://insight.vertcoin.org/ -log_dir=/opt/coins/blockbook/vertcoin/logs +User=blockbook-vertcoin +Type=simple +Restart=on-failure +WorkingDirectory=/opt/coins/blockbook/vertcoin + +# 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 diff --git a/build/deb/debian/control b/build/deb/debian/control index 05cc65fd..55652522 100644 --- a/build/deb/debian/control +++ b/build/deb/debian/control @@ -80,6 +80,16 @@ Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, backend-dogecoin Description: Satoshilabs blockbook server (Dogecoin mainnet) +Package: blockbook-vertcoin +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, backend-dogecoin +Description: Satoshilabs blockbook server (Vertcoin mainnet) + +Package: blockbook-vertcoin-testnet +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, backend-dogecoin +Description: Satoshilabs blockbook server (Vertcoin testnet) + Package: blockbook-namecoin Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, backend-namecoin diff --git a/configs/vertcoin.json b/configs/vertcoin.json new file mode 100644 index 00000000..b1dec1d5 --- /dev/null +++ b/configs/vertcoin.json @@ -0,0 +1,12 @@ +{ + "coin_name": "Vertcoin", + "rpcURL": "http://localhost:8040", + "rpcUser": "rpc", + "rpcPass": "rpc", + "rpcTimeout": 25, + "parse": true, + "zeroMQBinding": "tcp://localhost:38340", + "mempoolWorkers": 8, + "mempoolSubWorkers": 2, + "blockAddressesToKeep": 300 +} diff --git a/configs/vertcoin_testnet.json b/configs/vertcoin_testnet.json new file mode 100644 index 00000000..45bead82 --- /dev/null +++ b/configs/vertcoin_testnet.json @@ -0,0 +1,12 @@ +{ + "coin_name": "Vertcoin Testnet", + "rpcURL": "http://localhost:18040", + "rpcUser": "rpc", + "rpcPass": "rpc", + "rpcTimeout": 25, + "parse": true, + "zeroMQBinding": "tcp://localhost:48340", + "mempoolWorkers": 8, + "mempoolSubWorkers": 2, + "blockAddressesToKeep": 300 +} diff --git a/contrib/backends/Makefile b/contrib/backends/Makefile index be61a88e..fc211070 100644 --- a/contrib/backends/Makefile +++ b/contrib/backends/Makefile @@ -1,4 +1,4 @@ -TARGETS = bitcoin zcash bcash ethereum bgold dash litecoin dogecoin namecoin +TARGETS = bitcoin zcash bcash ethereum bgold dash litecoin dogecoin vertcoin namecoin IMAGE = blockbook-backend-build-deb NO_CACHE = false diff --git a/contrib/backends/vertcoin/Makefile b/contrib/backends/vertcoin/Makefile new file mode 100644 index 00000000..ad6c3121 --- /dev/null +++ b/contrib/backends/vertcoin/Makefile @@ -0,0 +1,10 @@ +VERTCOIN_VERSION := 0.13.2 + +all: + wget https://github.com/vertcoin-project/vertcoin-core/releases/download/${VERTCOIN_VERSION}/vertcoind-v${VERTCOIN_VERSION}-linux-amd64.zip + mkdir vertcoin + unzip vertcoind-v${VERTCOIN_VERSION}-linux-amd64.zip -d vertcoin/ + +clean: + rm -rf vertcoin + rm -f vertcoind-v${VERTCOIN_VERSION}-linux-amd64.zip diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.conffiles b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.conffiles new file mode 100644 index 00000000..8b042541 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.conffiles @@ -0,0 +1 @@ +/opt/coins/nodes/vertcoin_testnet/vertcoin_testnet.conf diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.dirs b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.dirs new file mode 100644 index 00000000..0ed9e6bb --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.dirs @@ -0,0 +1 @@ +/opt/coins/data/vertcoin_testnet/backend diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.install b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.install new file mode 100644 index 00000000..3e93aa2c --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.install @@ -0,0 +1,2 @@ +vertcoin/* /opt/coins/nodes/vertcoin_testnet +vertcoin_testnet.conf /opt/coins/nodes/vertcoin_testnet diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.logrotate b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.logrotate new file mode 100644 index 00000000..5a3eed96 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.logrotate @@ -0,0 +1,10 @@ +/opt/coins/data/vertcoin_testnet/backend/testnet3/debug.log +/opt/coins/data/vertcoin_testnet/backend/testnet3/db.log +{ + rotate 7 + daily + compress + missingok + notifempty + copytruncate +} diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.postinst b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.postinst new file mode 100644 index 00000000..24ccddb2 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.postinst @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u vertcoin &> /dev/null + then + useradd --system -M -U vertcoin -s /bin/false + fi + + if [ "$(stat -c '%U' /opt/coins/data/vertcoin_testnet/backend)" != "vertcoin" ] + then + chown -R vertcoin:vertcoin /opt/coins/data/vertcoin_testnet/backend + fi + ;; + +esac + +#DEBHELPER# diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.service b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.service new file mode 100644 index 00000000..c2e8443f --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin-testnet.service @@ -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 vertcoin-testnet.service +# See "man systemd.service" for details. + +# Note that almost all daemon options could be specified in +# /opt/coins/nodes/vertcoin_testnet/vertcoin_testnet.conf + +[Unit] +Description=vertcoin daemon (testnet) +After=network.target + +[Service] +ExecStart=/opt/coins/nodes/vertcoin_testnet/vertcoind -datadir=/opt/coins/data/vertcoin_testnet/backend -conf=/opt/coins/nodes/vertcoin_testnet/vertcoin_testnet.conf -pid=/run/vertcoind/vertcoin_testnet.pid +# Creates /run/vertcoind owned by vertcoin +RuntimeDirectory=vertcoind +User=vertcoin +Type=forking +PIDFile=/run/vertcoind/vertcoin_testnet.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 diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.conffiles b/contrib/backends/vertcoin/debian/backend-vertcoin.conffiles new file mode 100644 index 00000000..790936f6 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.conffiles @@ -0,0 +1 @@ +/opt/coins/nodes/vertcoin/vertcoin.conf diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.dirs b/contrib/backends/vertcoin/debian/backend-vertcoin.dirs new file mode 100644 index 00000000..4651768b --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.dirs @@ -0,0 +1 @@ +/opt/coins/data/vertcoin/backend diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.install b/contrib/backends/vertcoin/debian/backend-vertcoin.install new file mode 100644 index 00000000..26372258 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.install @@ -0,0 +1,2 @@ +vertcoin/* /opt/coins/nodes/vertcoin +vertcoin.conf /opt/coins/nodes/vertcoin diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.logrotate b/contrib/backends/vertcoin/debian/backend-vertcoin.logrotate new file mode 100644 index 00000000..0b756cbb --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.logrotate @@ -0,0 +1,10 @@ +/opt/coins/data/vertcoin/backend/debug.log +/opt/coins/data/vertcoin/backend/db.log +{ + rotate 7 + daily + compress + missingok + notifempty + copytruncate +} diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.postinst b/contrib/backends/vertcoin/debian/backend-vertcoin.postinst new file mode 100644 index 00000000..fe11d62f --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.postinst @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u vertcoin &> /dev/null + then + useradd --system -M -U vertcoin -s /bin/false + fi + + if [ "$(stat -c '%U' /opt/coins/data/vertcoin/backend)" != "vertcoin" ] + then + chown -R vertcoin:vertcoin /opt/coins/data/vertcoin/backend + fi + ;; + +esac + +#DEBHELPER# diff --git a/contrib/backends/vertcoin/debian/backend-vertcoin.service b/contrib/backends/vertcoin/debian/backend-vertcoin.service new file mode 100644 index 00000000..cb533569 --- /dev/null +++ b/contrib/backends/vertcoin/debian/backend-vertcoin.service @@ -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 vertcoin.service +# See "man systemd.service" for details. + +# Note that almost all daemon options could be specified in +# /opt/coins/nodes/vertcoin/vertcoin.conf + +[Unit] +Description=vertcoin daemon (mainnet) +After=network.target + +[Service] +ExecStart=/opt/coins/nodes/vertcoin/vertcoind -datadir=/opt/coins/data/vertcoin/backend -conf=/opt/coins/nodes/vertcoin/vertcoin.conf -pid=/run/vertcoind/vertcoin.pid +# Creates /run/vertcoind owned by vertcoin +RuntimeDirectory=vertcoind +User=vertcoin +Type=forking +PIDFile=/run/vertcoind/vertcoin.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 diff --git a/contrib/backends/vertcoin/debian/changelog b/contrib/backends/vertcoin/debian/changelog new file mode 100644 index 00000000..cf4bf9e0 --- /dev/null +++ b/contrib/backends/vertcoin/debian/changelog @@ -0,0 +1,5 @@ +vertcoin (0.13.2-satoshilabs1) unstable; urgency=medium + + * Initial build + + -- Petr Kracik Thu, 21 Jun 2018 11:42:00 +0200 diff --git a/contrib/backends/vertcoin/debian/compat b/contrib/backends/vertcoin/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/contrib/backends/vertcoin/debian/compat @@ -0,0 +1 @@ +9 diff --git a/contrib/backends/vertcoin/debian/control b/contrib/backends/vertcoin/debian/control new file mode 100644 index 00000000..7ac3d718 --- /dev/null +++ b/contrib/backends/vertcoin/debian/control @@ -0,0 +1,16 @@ +Source: vertcoin +Section: satoshilabs +Priority: optional +Maintainer: petr.kracik@satoshilabs.com +Build-Depends: debhelper, wget, tar, gzip, make, dh-systemd, dh-exec +Standards-Version: 3.9.5 + +Package: backend-vertcoin +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate +Description: Satoshilabs packaged vertcoin server + +Package: backend-vertcoin-testnet +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate +Description: Satoshilabs packaged vertcoin server diff --git a/contrib/backends/vertcoin/debian/rules b/contrib/backends/vertcoin/debian/rules new file mode 100755 index 00000000..f69489df --- /dev/null +++ b/contrib/backends/vertcoin/debian/rules @@ -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: diff --git a/contrib/backends/vertcoin/vertcoin.conf b/contrib/backends/vertcoin/vertcoin.conf new file mode 100644 index 00000000..56b81bd6 --- /dev/null +++ b/contrib/backends/vertcoin/vertcoin.conf @@ -0,0 +1,17 @@ +daemon=1 +server=1 +nolisten=1 +rpcuser=rpc +rpcpassword=rpc +rpcport=8040 +txindex=1 +whitelist=127.0.0.1 + +zmqpubhashtx=tcp://127.0.0.1:38340 +zmqpubhashblock=tcp://127.0.0.1:38340 + +rpcworkqueue=1100 +maxmempool=2000 +dbcache=1000 + + diff --git a/contrib/backends/vertcoin/vertcoin_testnet.conf b/contrib/backends/vertcoin/vertcoin_testnet.conf new file mode 100644 index 00000000..24fdacdb --- /dev/null +++ b/contrib/backends/vertcoin/vertcoin_testnet.conf @@ -0,0 +1,15 @@ +daemon=1 +server=1 +testnet=1 +nolisten=1 +rpcuser=rpc +rpcpassword=rpc +rpcport=18040 +txindex=1 + +zmqpubhashtx=tcp://127.0.0.1:48340 +zmqpubhashblock=tcp://127.0.0.1:48340 + +rpcworkqueue=1100 +maxmempool=2000 +dbcache=1000