pulled out pipeline code from bitpay-core