I am trying to sign a Bitcoin transaction using the BlockCypher API but I am failing because I don't have my private key in the correct format.
According to their documentation:
"One of the most common errors in the signing process is a data format mismatch. We always return and expect hex-encoded data, but oftentimes, standard signing libraries require byte arrays. Remember to convert your data, and always send hex-encoded signatures to BlockCypher."
The PHP code should be as follows:
$privateKeys = array("2c2cc015519b79782bd9c5af66f568e808f573714f3c4dc6df7d79c183783cff");
$txSkeleton = $txClient->sign($txSkeleton, $privateKeys);
But my private key is in the format xprv9s21ZrQH143K4NejhhRcspQdS2g7JgnSVwmT2dkXQuszJaQqjYD3wdUdsXyqmfetdUZ2SS25uM7
nAfnUwNDGA75bfqYxKwYZ8zDdaCv6meL, ie not in hex.
I have tried simply converting it to hex, which obviously was a bit overoptimistic of me but the transaction signing fails.
I have Googled and Googled this for weeks and have been unable to figure out how to convert a xprv prefix key into the correct format as required by the BlockCypher API.
I am a paying customer of theirs and have e-mailed them but no reply after two weeks of waiting.
I'm at my wits end and any help would be very much appreciated.