Bitcoin Transaction using API with Custom Fees

I want to transfer Bitcoin from one individual address to another using API. But I want to set Transaction fees as per my requirement. So How can I do it ?

Right now I am using blockchain-transaction – npm api for transfer bitcoin from one address to another. So please shade some lights on this.

var bitcoinTransaction = require('bitcoin-transaction');
//Send all my money from wallet1 to wallet2 on the bitcoin testnet
var from = "mm3gdVh8n6YtcNyaTKYkveB6yTME7aDWNJ";
var to = "mgPUfqJk4X6gE4P5Do5RfpkTFsYmsSjCya";
var privKeyWIF = "cNZi8iySqBToXMpcsQaHKD5uv7HExBQJBSi4dTg3ZPaEzeNAzvbj";    //Private key in WIF form (Can generate this from bitcoinlib-js)
bitcoinTransaction.getBalance(from, { network: "testnet" }).then((balanceInBTC) => {
    return bitcoinTransaction.sendTransaction({
from: from,
to: to,
privKeyWIF: privKeyWIF,
btc: balanceInBTC,
network: "testnet"

Why is the probability of finding a winning nonce exactly the same for a new header and a header where you’ve already tried 1 billion nonces?

I’m referring to this question: When do miners stop waiting for new transactions?

More specifically, this statement from the top answer:

“suppose you have a block header h1 on which you have already tried a billion nonce values, and a header h2 which has just been generated and on which no nonces have been tried yet. If you have the choice as to which one to hash next, which should you choose, for the greatest chance of finding a winning nonce? The answer is, it makes no difference – they both have exactly the same probability. So there is no harm in switching to h2”

I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.

Complete newbie here and to the bitcoin world so apologies if I’m missing something obvious.

Debugging Bitcoin Unit Tests

I am running the unit tests from bitcoin source using make check, and would like to debug the tests using LogPrint in the bitcoin source files. I read in the Test Docs that logs are only output to test_framework.log, but I’m unable to locate this file. Where should I be able to find it? Or perhaps there is a better approach?

encode/decode Base-58 C++

I have built a base-58 encoder using this formula:

Is there a smarter way to encode/decode with base-58?

I read somewhere that you need a bignum library which I use Boost for.

My goal is to convert between these two:


Which so easily this website do:

I know bitcoin source code have a base-58 encoder/decoder, but I do not know how to implement it successfully.

How to recover wallet by importing private key on testnet?

I want to test the functionality of wallet recovery via private key import on the testnet. Preferably thru an online service.

I only want to test the functionality so that I can verify that it’s basically working since I’m working on some Python code that I want to use on the mainnet later.

So for that, I don’t want to download the whole blockchain but instead, want to verify that my private key is generated correctly and I can access the funds that way. But I can’t find any possibility to do that on testnet…

EDIT: I did not use mainnet for anything yet. I’m exclusively used testnet to create the wallet and get some coins and want to verify on testnet the wallet recovery thru private key

How to import private key on testnet and verify balance of wallet?

I have a python library to create wallets and play around with private key generation and stuff like that.

But i can’t find any service / wallet – preferably online – where i could import my generated testnet-private-key and check the balance…

I can get coins thru Testnet Faucet and see the balance of an address on testnet via Blockcypher but where can i test importing private keys on the testnet?

EDIT: I don’t really want to download the whole blockchain so some online service would really be great!