{"id":367,"date":"2020-09-29T22:04:25","date_gmt":"2020-09-29T22:04:25","guid":{"rendered":"http:\/\/bitcoinsv-io.bitproton.com\/?post_type=miner_document&p=367"},"modified":"2020-09-29T19:30:47","modified_gmt":"2020-09-29T19:30:47","slug":"bitcoind","status":"publish","type":"miner_document","link":"https:\/\/bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/","title":{"rendered":"Bitcoind"},"content":{"rendered":"\n

The following instructions describe installing Bitcoin SV Node using tools available in most mainstream Linux distributions. The assumption has been made that you are using a Bourne-like shell such as bash<\/code>.<\/p>\n\n\n\n

To start the install of Bitcoin, make sure you use an account that can use su<\/code> or sudo<\/code> to install software into directories owned by the root user.<\/p>\n\n\n\n

Download<\/h2>\n\n\n\n

Download the zipped release of your choosing, for this example we are using 1.0.5 which is the latest release at the time of writing:<\/p>\n\n\n\n

$ wget https:\/\/download.bitcoinsv.io\/bitcoinsv\/1.0.5\/bitcoin-sv-1.0.5-x86_64-linux-gnu.tar.gz\n<\/pre>\n\n\n\n

Confirm downloaded file sha hash matches those provided at download.bitcoinsv.io<\/a> for the version you have downloaded.<\/p>\n\n\n\n

$ sha256sum bitcoin-sv-1.0.5-x86_64-linux-gnu.tar.gz\n\/\/Expected Output \n96f7c56c7ebd4ecb2dcd664297fcf0511169ac33eaf216407ebc49dae2535578  bitcoin-sv-1.0.5-x86_64-linux-gnu.tar.gz\n<\/pre>\n\n\n\n

Setup<\/h2>\n\n\n\n

Locate the file you downloaded and extract it using the tar<\/code> command followed by the argument xzf<\/code> followed by the file name. The argument xzf<\/code> means eXtract the gZipped tar archive file. For example, for a 64-bit tar archive in your current directory, the command is:<\/p>\n\n\n\n

$ tar xvf bitcoin-sv-1.0.5-x86_64-linux-gnu.tar.gz\n<\/pre>\n\n\n\n

Create a symbolic link from a new directory called bitcoin<\/code> to the bitcoin-sv-1.0.5<\/code> directory you just made by unzipping for easier use and updates:<\/p>\n\n\n\n

$ ln -s bitcoin-sv-1.0.5 bitcoin\n<\/pre>\n\n\n\n

Create a bitcoin-data<\/code> directory to put bitcoin data in (or else Bitcoin will put data in ~\/.bitcoin<\/code> by default):<\/p>\n\n\n\n

$ mkdir bitcoin-data\n<\/pre>\n\n\n\n

Create a bitcoin.conf<\/code> file in the directory to configure the settings to run your node using:<\/p>\n\n\n\n

$ cd bitcoin-data\/\n$ vim bitcoin.conf\n<\/pre>\n\n\n\n

Below is an example bitcoin.conf<\/code> file used by a node on the STN<\/strong>:<\/p>\n\n\n\n

A full list of available options can be seen by running bitcoind --help<\/code><\/p>\n\n\n\n

#start in background\ndaemon=1\n\n#select network -- comment out both for mainnet\n#testnet=1\nstn=1\n\n#Required Consensus Rules for Genesis\nexcessiveblocksize=10000000000 #10GB\nmaxstackmemoryusageconsensus=100000000 #100MB\n\n#Mining\n#biggest block size you want to mine\nblockmaxsize=4000000000 \nblockassembler=journaling #journaling is default as of 1.0.5\n\n#preload mempool\npreload=1\n\n#mempool usage allowance\nmaxmempool=8000 #8G\ndbcache=8192 #8G\n\n#Pruning -- Uncomment to trim the chain in an effort to keep disk usage below the figure set\n#prune=100000 #100GB\n\n#orphan transaction storage \n#blockreconstructionextratxn=200000\n#maxorphantxsize=10000\n\n#transaction options\n#maxsigcachesize=260\n#maxscriptcachesize=260\n#minrelaytxfee=0.00000001\n#mintxfee=0.00000001\n#dustrelayfee=0.00000001\n#blockmintxfee=0.00000001\n#relaypriority=0\n#feefilter=0\n#limitfreerelay=1000\n#maxscriptsizepolicy=500000\n\n#OP Return max size\n#datacarriersize=100000 #Genesis default is UINT32_MAX\n\n#Max number and size of related Child and Parent transactions per block template \nlimitancestorcount=100\nlimitdescendantcount=100\n#limitancestorsize=25000000\n#limitdescendantsize=25000000\n\n#connection options\nmaxconnections=80\n\n#ZMQ\n#zmqpubhashtx=tcp:\/\/127.0.0.1:28332\n#zmqpubhashblock=tcp:\/\/127.0.0.1:28332\n\n#Ports - Leave commented for defaults\n#port=9333\n#rpcport=9332\n\n#rpc settings\nrpcworkqueue=600\nrpcthreads=16\n#rpcallowip=0.0.0.0\/0 \nrpcuser=CHANGE_ME\nrpcpassword=CHANGE_ME\n\n#debug options\n#can be: net, tor,\n#       mempool, http, bench, zmq, db, rpc, addrman, selectcoins,\n#       reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent,\n#       coindb, leveldb, txnprop, txnsrc, journal, txnval.\n# 1 = all options enabled.\n# 0 = off which is default\n#debug=1\n\n#debugexclude to ignore set log items, can be used to keep log file a bit cleaner\ndebugexclude=libevent\ndebugexclude=leveldb\ndebugexclude=zmq\ndebugexclude=txnsrc\ndebugexclude=net\n\n#shrinkdebugfile=0 # Setting to 1 prevents bitcoind from clearning the log file on restart. 0\/off is default\n\n#multi-threaded options\n#threadsperblock=32\n#maxparallelblocks\n#scriptvalidatormaxbatchsize\n#maxparallelblocksperpeer\nmaxstdtxvalidationduration=15\nmaxcollectedoutpoints=1000000\nmaxstdtxnsperthreadratio=10000\n#maxnonstdtxvalidationduration\n<\/pre>\n\n\n\n

Run<\/h2>\n\n\n\n

Run directly<\/h3>\n\n\n\n

To run Bitcoind, pass in the location of the configuration file as well as the location of where to store the bitcoin data:<\/p>\n\n\n\n

(In our example the user test was used)<\/p>\n\n\n\n

$ \/home\/test\/bitcoin\/bin\/bitcoind -conf=<\/strong>\/home\/test\/bitcoin-data\/bitcoin.conf -datadir=<\/strong>\/home\/test\/bitcoin-data -daemon\n<\/pre>\n\n\n\n

Run with systemctl<\/code><\/h3>\n\n\n\n

Create the bitcoind.service<\/code> file:<\/p>\n\n\n\n

$ sudo vim \/etc\/systemd\/system\/bitcoind.service\n<\/pre>\n\n\n\n

bitcoind.service<\/code>:<\/p>\n\n\n\n

[Unit]<\/strong>\nDescription=<\/strong>Bitcoin service\nAfter=<\/strong>network.target\n[Service]<\/strong>\nType=<\/strong>forking\nExecStart=<\/strong>\/home\/test\/bitcoin\/bin\/bitcoind -conf=\/home\/test\/bitcoin-data\/bitcoin.conf -datadir=\/home\/test\/bitcoin-data -daemon\nExecStop=<\/strong>\/home\/test\/bitcoin\/bin\/bitcoin-cli -conf=\/home\/test\/bitcoin-data\/bitcoin.conf -datadir=\/home\/test\/bitcoin-data stop\nExecReload=<\/strong>\/bin\/kill -s HUP $MAINPID\nRestart=<\/strong>on-abnormal\nTimeoutStopSec=<\/strong>120\nKillMode=<\/strong>none\nPrivateTmp=<\/strong>true\nUser=<\/strong>test\n[Install]<\/strong>\nWantedBy=<\/strong>multi-user.target\n<\/pre>\n\n\n\n

(be sure to replace test<\/code> in the above with your logged user)<\/p>\n\n\n\n

Then start:<\/p>\n\n\n\n

$ sudo systemctl start bitcoind.service\n<\/pre>\n\n\n\n

Run with Docker<\/h3>\n\n\n\n

Included in this repo are docker images for the Bitcoin SV Node implementation. Thanks to Josh Ellithorpe and his repository<\/a>, which provided the base for this repo.<\/p>\n\n\n\n

This Docker image provides bitcoind<\/code>, bitcoin-cli<\/code> and bitcoin-tx<\/code> which can be used to run and interact with a Bitcoin server.<\/p>\n\n\n\n

To see the available versions\/tags, please visit the Docker Hub page<\/a>.<\/p>\n\n\n\n

Usage<\/h4>\n\n\n\n

To run the latest version of Bitcoin SV:<\/p>\n\n\n\n

$ docker run bitcoinsv\/bitcoin-sv\n<\/pre>\n\n\n\n

To run a container in the background, pass the -d option to docker run, and give your container a name for easy reference later:<\/p>\n\n\n\n

$ docker run -d --rm --name bitcoind bitcoinsv\/bitcoin-sv\n<\/pre>\n\n\n\n

Once you have the bitcoind service running in the background, you can show running containers:<\/p>\n\n\n\n

$ docker ps\n<\/pre>\n\n\n\n

Or view the logs of a service:<\/p>\n\n\n\n

$ docker logs -f bitcoind\n<\/pre>\n\n\n\n

To stop and restart a running container:<\/p>\n\n\n\n

$ docker stop bitcoind\n$ docker start bitcoind\n<\/pre>\n\n\n\n

Configuring Bitcoin<\/h4>\n\n\n\n

The best method to configure the server is to pass arguments to the bitcoind command. For example, to run Bitcoin SV on the testnet:<\/p>\n\n\n\n

$ docker run --name bitcoind-testnet bitcoinsv\/bitcoin-sv bitcoind -testnet\n<\/pre>\n\n\n\n

Alternatively, you can edit the bitcoin.conf<\/code> file which is generated in your data directory (see below).<\/p>\n\n\n\n

Data Volumes<\/h4>\n\n\n\n

By default, Docker will create ephemeral containers. That is, the blockchain data will not be persisted, and you will need to sync the blockchain from scratch each time you launch a container.<\/p>\n\n\n\n

To keep your blockchain data between container restarts or upgrades, simply add the -v<\/code> option to create a data volume<\/a>:<\/p>\n\n\n\n

$ docker run -d --rm --name bitcoind -v bitcoin-data:\/data bitcoinsv\/bitcoin-sv\n$ docker ps\n$ docker inspect bitcoin-data\n<\/pre>\n\n\n\n

Alternatively, you can map the data volume to a location on your host:<\/p>\n\n\n\n

$ docker run -d --rm --name bitcoind -v \"$PWD\/data:\/data\" bitcoinsv\/bitcoin-sv\n$ ls -alh .\/data\n<\/pre>\n\n\n\n

Using bitcoin-cli<\/h4>\n\n\n\n

By default, Docker runs all containers on a private bridge network. This means that you are unable to access the RPC port (8332) necessary to run bitcoin-cli<\/code> commands.<\/p>\n\n\n\n

There are several methods to run bitcoin-cli<\/code> against a running bitcoind<\/code> container. The easiest is to simply let your bitcoin-cli<\/code> container share networking with your bitcoind<\/code> container:<\/p>\n\n\n\n

$ docker run -d --rm --name bitcoind -v bitcoin-data:\/data bitcoinsv\/bitcoin-sv\n$ docker run --rm --network container:bitcoind bitcoinsv\/bitcoin-sv bitcoin-cli getinfo\n<\/pre>\n\n\n\n

If you plan on exposing the RPC port to multiple containers (for example, if you are developing an application which communicates with the RPC port directly), you probably want to consider creating a user-defined network. You can then use this network for both your bitcoind<\/code> and bitclin-cli<\/code> containers, passing -rpcconnect<\/code> to specify the hostname of your bitcoind container:<\/p>\n\n\n\n

$ docker network create bitcoin\n$ docker run -d --rm --name bitcoind -v bitcoin-data:\/data --network bitcoin bitcoinsv\/bitcoin-sv\n$ docker run --rm --network bitcoin bitcoinsv\/bitcoin-sv bitcoin-cli -rpcconnect=<\/strong>bitcoind getinfo\n<\/pre>\n\n\n\n

Kubernetes Configs<\/h4>\n\n\n\n

The following directions will walk you through creating a Bitcoin SV node within GKE (Google Kubernetes Engine).<\/p>\n\n\n\n

If you wish to run another version of bitcoind, just change the image reference in bitcoin-deployment.yml<\/code>.<\/p>\n\n\n\n

Steps:<\/p>\n\n\n\n

1- Add a new blank disk on GCE called bitcoin-data that is 200GB. You can always expand it later.\n2- Save the following code snippets and place them in a new directory kube.\n3- Change the rpcuser and rpcpass values in bitcoin-secrets.yml. They are base64 encoded. To base64 a string, just run echo -n SOMESTRING | base64.\n4- Run kubectl create -f \/path\/to\/kube\n5- Profit!\n<\/pre>\n\n\n\n
bitcoin-deployment.yml<\/h5>\n\n\n\n
apiVersion: extensions\/v1beta1\nkind: Deployment\nmetadata:\n  namespace: default\n  labels:\n    service: bitcoin\n  name: bitcoin\nspec:\n  strategy:\n    type: Recreate\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        service: bitcoin\n    spec:\n      containers:\n      - env:\n        - name: BITCOIN_RPC_USER\n          valueFrom:\n            secretKeyRef:\n              name: bitcoin\n              key: rpcuser\n        - name: BITCOIN_RPC_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: bitcoin\n              key: rpcpass\n        image: bitcoinsv\/bitcoin-sv\n        name: bitcoin\n        volumeMounts:\n          - mountPath: \/data\n            name: bitcoin-data\n        resources:\n          requests:\n            memory: \"2Gi\"\n      restartPolicy: Always\n      volumes:\n        - name: bitcoin-data\n          gcePersistentDisk:\n            pdName: bitcoin-data\n            fsType: ext4\n<\/pre>\n\n\n\n
bitcoin-secrets.yml<\/h5>\n\n\n\n
apiVersion: v1\nkind: Secret\nmetadata:\n  name: bitcoin\ntype: Opaque\ndata:\n  rpcuser: YWRtaW4=\n  rpcpass: aXRvbGR5b3V0b2NoYW5nZXRoaXM=\n<\/pre>\n\n\n\n
bitcoin-srv.yml<\/h5>\n\n\n\n
apiVersion: v1\nkind: Service\nmetadata:\n  name: bitcoin\n  namespace: default\nspec:\n  ports:\n    - port: 8333\n      targetPort: 8333\n  selector:\n    service: bitcoin\n  type: LoadBalancer\n  externalTrafficPolicy: Local\n<\/pre>\n","protected":false},"parent":365,"menu_order":0,"template":"","meta":[],"tags":[],"minerdoc_category":[6],"lang":"en","translations":{"zh":4537,"en":367},"yoast_head":"\nBitcoind - Bitcoin SV<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stag.bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bitcoind - Bitcoin SV\" \/>\n<meta property=\"og:description\" content=\"The following instructions describe installing Bitcoin SV Node using tools available in most mainstream Linux distributions. The assumption has been made that you are using a Bourne-like shell such as bash. To start the install of Bitcoin, make sure you use an account that can use su or sudo to install software into directories owned by the root user. Download […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stag.bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/\" \/>\n<meta property=\"og:site_name\" content=\"Bitcoin SV\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-29T19:30:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bitcoinsv.io\/wp-content\/uploads\/2020\/09\/bitcoin-sv-bsv-mines-world-record-128mb-blocks.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1234\" \/>\n\t<meta property=\"og:image:height\" content=\"616\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BitcoinSVNode\" \/>\n<meta name=\"twitter:site\" content=\"@BitcoinSVNode\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/bitcoinsv.io\/#organization\",\"name\":\"Bitcoin SV\",\"url\":\"https:\/\/bitcoinsv.io\/\",\"sameAs\":[\"https:\/\/twitter.com\/BitcoinSVNode\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/bitcoinsv.io\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/bitcoinsv.io\/wp-content\/uploads\/2020\/10\/bsv-logo-wh-medium.png\",\"width\":800,\"height\":144,\"caption\":\"Bitcoin SV\"},\"image\":{\"@id\":\"https:\/\/bitcoinsv.io\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bitcoinsv.io\/#website\",\"url\":\"https:\/\/bitcoinsv.io\/\",\"name\":\"Bitcoin SV\",\"description\":\"Just another WordPress site\",\"publisher\":{\"@id\":\"https:\/\/bitcoinsv.io\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/bitcoinsv.io\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/stag.bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/#webpage\",\"url\":\"https:\/\/stag.bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/\",\"name\":\"Bitcoind - Bitcoin SV\",\"isPartOf\":{\"@id\":\"https:\/\/bitcoinsv.io\/#website\"},\"datePublished\":\"2020-09-29T22:04:25+00:00\",\"dateModified\":\"2020-09-29T19:30:47+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/stag.bitcoinsv.io\/documentation\/miners\/installation\/bitcoind\/\"]}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/miner_document\/367"}],"collection":[{"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/miner_document"}],"about":[{"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/types\/miner_document"}],"version-history":[{"count":1,"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/miner_document\/367\/revisions"}],"predecessor-version":[{"id":4423,"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/miner_document\/367\/revisions\/4423"}],"up":[{"embeddable":true,"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/miner_document\/365"}],"wp:attachment":[{"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/media?parent=367"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/tags?post=367"},{"taxonomy":"minerdoc_category","embeddable":true,"href":"https:\/\/bitcoinsv.io\/wp-json\/wp\/v2\/minerdoc_category?post=367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}