15 votes
Accepted

How to generate SegWit address

How do I generate a SegWit address using Bitcoin Core CLI? You can use addwitnessaddress addr, where addr is an existing P2PKH or P2SH address of yours. It will construct a P2SH-P2WPKH or P2SH-P2WSH ...
user avatar
10 votes
Accepted

Bitcoind error -28

Error -28 is defined as RPC_IN_WARMUP, see https://github.com/bitcoin/bitcoin/blob/master/src/rpc/protocol.h. The bitcoind server has just started and is still processing its stored blockchain data ...
user avatar
10 votes
Accepted

fundrawtransaction - what is it?

Just to give a little background first: Bitcoin uses a so-called UTXO model. You own UTXOs (or "coins", to give an analogy). Every coin has a value (which can be any number of satoshis) and ...
user avatar
8 votes

How to check if an output has been spent?

If gettxout returns something, the output is unspent. If it returns nothing, the output either never existed or is spent. You do not need -txindex for this.
user avatar
8 votes

How to check if node is on TestNet or MainNet via `bitcoin-cli`?

Before version 0.16.0: $ bitcoin-cli getinfo { "version": 120100, "protocolversion": 70012, "walletversion": 60000, "balance": 0.00000000, "blocks": 414105, "timeoffset": -165, "...
user avatar
  • 1,673
8 votes
Accepted

What are the hex and asm field values in the JSON decoded from a raw transactions?

asm refers to the de-serialised form of the script, with well-known tokens parsed as script tokens. hex is just the serialised form of the script in hex encoding. If you compare them carefully, ...
user avatar
  • 2,378
8 votes
Accepted

What is the key differences between bitcoin-qt, bitcoin-cli, bitcoind, bitcoin rpc, and daemon?

All of those things are part of the same program, Bitcoin Core. bitcoin-qt: The GUI version of Bitcoin Core. Most users will use this as it provides a nice Graphical User Interface that uses the Qt ...
user avatar
  • 60.5k
8 votes
Accepted

Breaking down a raw transaction:

The bolded byte in the following raw transaction is the number of outputs (two in this transaction): ...
user avatar
8 votes
Accepted

running live and test node simultaneously

You can run both at the same time: $ bitcoind -daemon $ bitcoind -testnet -daemon Then you can issue commands on either using: $ bitcoin-cli <commmand> or $ bitcoin-cli -testnet <...
user avatar
  • 7,040
8 votes
Accepted

Why does importmulti not support zpub and ypub?

The "xpub" format was defined by BIP32. It's a standard that specifies how to derive public keys from master public keys and seeds. Parts of it are widely adopted, some parts aren't. However, it does ...
user avatar
7 votes

Can you list receiving addresses in bitcoin-cli?

Yes, you can do it. bitcoin-cli listreceivedbyaddress 1 true I had to read the argument documentation. Thanks Sven Williamson.
user avatar
7 votes
Accepted

bitcoin.rpc python library problem

in debian =) sudo apt-get install libssl-dev pip install python-bitcoinlib or pip3 install python-bitcoinlib
user avatar
7 votes
Accepted

Bitcoin-cli how to get balance of a wallet on different node?

You cannot because Bitcoin Core does not store such information. Bitcoin Core does not store all information for all addresses, it only stores information for its own addresses and the lower level ...
user avatar
  • 60.5k
7 votes

Method not found when I use bitcoin-cli to generate blocks under regtest mode

For the upcoming Bitcoin Core 0.18 release, the generate command has been deprecated and its functionality disabled. For the following major release, 0.19.0, the generate command has been removed ...
user avatar
  • 60.5k
6 votes
Accepted

How to check if my node is fully sync'ed

Calling getblockchaininfo is your best bet. It includes a field called verificationprogress, which is an estimate of how much of the chain you have validated. Alternatively, compare headers to ...
user avatar
  • 8,724
6 votes
Accepted

How to detect a fork with bitcoin-cli?

You can use the getchaintips RPC, which will list all tips of the known block tree, including branches that were never active. You may see for example: { "height": 420561, "hash": "...
user avatar
6 votes
Accepted

bitcoin-cli could not locate RPC credentials

You are using bitcoin-cli incorrectly. The command line arguments come before the RPC command. Anything that comes after the RPC command will be interpreted as arguments for the RPC, not arguments to ...
user avatar
  • 60.5k
6 votes
Accepted

Why can't Core CLI query wallet balance when loading block index or verifying blocks?

The wallet needs access to the chainstate for normal operation, and that needs access to the block index. So the wallet requires a chainstate in its constructor, and the object managing the chainstate ...
user avatar
  • 60.5k
5 votes
Accepted

Why is my bitcoind daemon not listening on RPC port at 8332?

Two thoughts: The wildcard syntax is not supported anymore. Instead of 192.168.*.*, use 192.168.0.0/16. Instead of 192.168.1.*, use 192.168.1.0/24. As an additional debugging step, try running ...
user avatar
  • 28.6k
5 votes
Accepted

How to sign bitcoin transaction with 'bitcoind' and non-bitcoind-wallet private key?

Answering my own question Two things basically got into way of creating and signing a raw bitcoin transaction using 'bitcoind' program: Leaving 'redeemScript' to be the empty string It has to be ...
user avatar
  • 261
5 votes
Accepted

How to check if node is on TestNet or MainNet via `bitcoin-cli`?

Since version 0.16.0 $ bitcoin-cli getblockchaininfo { "chain": "main", "blocks": 525663, "headers": 525663, . . . } Reference: https://...
user avatar
5 votes
Accepted

How to get more chain tips from getchaintips?

It returns all branches your node knows about. Note that your node cannot know anything about branches that occurred while your node was still syncing, as you only get the active best chain from your ...
user avatar
5 votes

bitcoin-cli commands like createrawtransaction not working with json on command line

When looking at the Bitcoin Developer Reference I saw an example where they use two additional '' before and after the list of inputs in comparison to you. For your input, I also got "Error parsing ...
user avatar
  • 62.4k
5 votes

64: too-long-mempool-chain

You will not be able create unconfirmed chain for 300 transactions. Bitcoin core default limit is 25 transactions. In case you modify this parameter on your local node, network will not accept tx ...
user avatar
5 votes
Accepted

Why is the field 'hash' necessary in a bitcoin transaction?

Note that Bitcoin transactions don't actually contain the txid or hash within them. This is only part of the decoding output from Bitcoin Core. The hash is there because of segwit. Segwit specifies ...
user avatar
  • 60.5k
5 votes

Why does importmulti not support zpub and ypub?

ypub and zpub are not things that are specified in BIPs. They are things that people have decided to use and specify outside of the BIPs process. Furthermore, they are a layer violation. They specify ...
user avatar
  • 60.5k
5 votes
Accepted

How to extract all the bitcoin addresses with bitcoin-cli?

Answering this question requires first defining what an address means. Historically (before BIP16 activated in 2012) an address was a synonym with a "public key identifier", as there were ...
user avatar
5 votes
Accepted

Bitcoin-cli responding but not curl

Found it out, you just need to give it a username and password. You can add them to a bitcoin.conf file in your datadir. This file isn't automatically created. The default datadir is at ~/.bitcoin, so ...
user avatar
4 votes

Bitcoind error -28

This would be normal if you just started your bitcoind service and it is still verifying downloaded blocks. It can be a result that bitcoind did not had time enough to write changes to disk last time ...
user avatar
  • 141
4 votes
Accepted

Why does getblocktemplate use priority for transaction selection?

Getblocktemplate builds a block based on configuration parameters. In recent versions, the default is to use fee per byte as criterion for the entire block. History In versions of Bitcoin up to 0.6, ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible