The Bitcoin network is heading toward an activation of the new Segwit consensus rules on August 20th, 2017. If you are using BitPay's Bitcore Bitcoin development platform for your own Bitcoin project or service, you'll need to take some steps to get ready.
Why nodes need to upgrade for Segwit
Once the new Segwit consensus rules are activated, bitcoin transactions will now contain additional transaction information, and some definitions for important transaction rules will be changing. Nodes which fail to upgrade to support Segwit will face major security risks, including the risk of double-spend transaction fraud. Learn more about the risks for non-upgraded Bitcoin nodes.
If your Bitcoin project or service is running on BitPay's Bitcore or Insight services, you will need to guard your Bitcore node behind a boundary node. Bitcore-node v3 uses a modified version of Bitcoin Core 0.12.1 which does not support the new Segwit rules. In order to prevent invalid transactions from reaching your service, you must configure your Bitcore node to only connect to a boundary node which supports the new Segwit rules.
Our team has created the following update guide you can follow to get your Bitcore node ready for Segwit:
How to upgrade your Bitcore full node for Segwit
- Install and sync a full node implementation supporting Segwit consensus rules. The following are general Linux directions for installing and syncing a BTC1 full node*:
- a) Go to the btc1 release page and download bitcoin-1.14.5-x8664-linux-gnu.tar.gz for 64 bit Linux operating systems and bitcoin-1.14.5-i686-pc-linux-gnu.tar.gz for 32 bit operating systems. For ARM systems, choose: bitcoin-1.14.5-arm-linux-gnueabihf.tar.gz for 32 bit ARM systems and bitcoin-1.14.5-aarch64-linux-gnu.tar.gz for 64 bit ARM systems. Most Raspberry Pi hardware is ARM 32 bit.
- b) Download SHA256SUMS.
- c) Verify the hash of the downloaded binary: sha256sum bitcoin-1.14.5-x86 64-linux-gnu.tar.gz (or whatever your binary’s name is).
- d) You will get a 64 character hex string. Compare this string to the string next to your binary’s name in SHA256SUMS.
- e) Unzip the binary: tar zxvf bitcoin-1.14.5-x86_64-linux-gnu.tar.gz (or whatever your binary’s name is)
- f) Navigate to the root of the bitcoin folder in terminal and do
./bin/bitcoind -printtoconsole
to see the output of the bitcoin node.
- Explore a full set of bitcoin command line options.
- g) You can stop the process by typing Control + C.
- h) Once your BTC1 node has the full block chain, you will get a line on the console that looks similar to: progress=1.000000
- i) You will then want to allow your BTC1 to start on boot of the operating system. This is highly dependent on your operating system. Please refer to your OS Vendor for directions on how to create a service that starts on boot.
Edit your Bitcore full node’s bitcoin.conf which is located by default in the user that runs bitcore home directory under .bitcore. Example:
/home/user/.bitcore
Edit your Bitcore full node’s bitcoin.conf config and add the following lines:
- a)
Connect=<the ip address of your BTC1 boundary node>
- a)
- b)
onlynet=<ipv4/ipv6>
- c)
maxconnections=1
- The value of
Connect
will be the IP address of your BTC1 node. This can be127.0.0.1
if the BTC1 node is running locally. onlynet
is the network that you would like to limit connections on. This isn’t strictly necessary, but a good idea. Most of the time, this value will beipv4
.
- The value of
Edit your Bitcore full node’s bitcoin.conf config and remove the following lines if they are present:
- a)
addnode=<whatever>
- In step a: remove any lines that start with
addnode
. We want to prevent our node from connecting to any other peers OTHER THAN our BTC1 boundary node.
- Optional, Linux-only. Configure iptables rules to prevent connections to or from unauthorized peers.
a) Add the following rules:
iptables -I INPUT 1 -p tcp --dport 8333 -s <ip of BTC1 node>/32 -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 8333 -s <ip of BTC1 node>/32 -j ACCEPT
iptables -I INPUT 2 -p tcp --dport 8333 -j DROP
iptables -I OUTPUT 2 -p tcp --dport 8333 -j DROP
Changes for self-hosting BWS (Bitcore Wallet Service) users
If you are running your own instance of BWS (Bitcore Wallet Service) for your own wallet or wallet service, you will need to make a change to prepare for Segwit activation.
If you are running a standalone BWS instance connected to BitPay's Insight-API service over HTTP, you must point your instance at your own boundary-guarded Insight instance (follow the steps above to guard your Insight instance with a BTC1 node) or at the BitPay production version of Insight (insight.bitpay.com).
If you are running BWS as a Bitcore service, placing your Bitcore node behind a boundary node as in the instructions above is enough.
What's next for Bitcore now that Segwit is activated?
Our team is working to release a new version of Bitcore which will be Segwit-compatible out of the box. When this release becomes available, you will no longer need to run additional boundary nodes with a patched version of bitcoind. Stay tuned here on the BitPay blog and at bitcore.io) for updates in the next several weeks.
- ADDENDUM, 8/17/17, 5:20 PM ET: Note that btc1 includes support for the Segwit2x scaling proposal. You may choose to use any full node supporting Segwit, but our instructions follow this version of Bitcoin because over 95% of Bitcoin miners have adopted Segwit2x. If you are not running Segwit2x, your node will be on a dysfunctional minority chain when the base block size increases to 2MB.
Learn more about BitPay's wallet app and prepaid cryptocurrency debit card to buy, exchange, and spend Bitcoin, Litecoin, Ethereum Dogecoin, and most stablecoins.
Last Updated: 10/05/2021