15

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 address with the same key/script, if known to be valid. Note that this command is not available until SegWit is active on the network, as before that time, ...


10

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 to figure out what it has. It can take several minutes. Activating best chain is one stage of this, where the daemon looks at the blocks it knows so far and ...


8

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.


8

Before version 0.16.0: $ bitcoin-cli getinfo { "version": 120100, "protocolversion": 70012, "walletversion": 60000, "balance": 0.00000000, "blocks": 414105, "timeoffset": -165, "connections": 9, "proxy": "", "difficulty": 199312067531.243, "testnet": false, "keypoololdest": 1466689642, "keypoolsize": 101, "paytxfee": 0.00000000, "...


8

The bolded byte in the following raw transaction is the number of outputs (two in this transaction): ...


7

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, they are essentially equivalent. For example: OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG 76 a9 14 ...


7

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 <command> The blockchains are stored in ./bitcoin/blocks for mainnet and /bitcoin/testnet3/blocks for testnet. Update: With the bitcoin.conf updated in the ...


7

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 entirely. This removal is already in the master branch of Bitcoin Core's source code. If you have built that branch from source, then the generate command does not ...


7

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 not say anything about how the keys it generate should be turned into addresses, only the keys themselves. Now, at the time, there was only really one obvious ...


6

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 blocks. If headers is higher, it means that your node has validated the headers for blocks that it has yet to validate. When these numbers match up, it either ...


6

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": "000000000000000001cb02590846299c91794e9b9f422513cff4b9c1dd5c62a", "branchlen": 0, "status": "active" }, { "height": 419698, "hash": "...


6

in debian =) sudo apt-get install libssl-dev pip install python-bitcoinlib or pip3 install python-bitcoinlib


5

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 peers. Also, if you are connected to a single node only for a while, then you will during that time not hear about any branches, as you only get to see the ...


5

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 netstat -antlp | grep 8332. If that produces output like the following, that means that it is bound to the port. tcp 0 0 0.0.0.0:8332 0.0.0.0:...


5

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 JSON", but with bitcoin-cli -testnet createrawtransaction '''[{ "txid" : "12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad", "vout" : 0 }]''' '{"...


5

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 information needed for verifying transactions (addresses are a higher level abstraction). There are no commands that allow you to get the balances or transactions ...


5

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 that witness data for a segwit input (i.e. signatures, scripts) are not part of the txid. Those are in a separate area in the transaction. You can see this ...


4

Great question. I had to do some research to find out. Currently version is actually 4 bytes. In the case of this block (and many other recent blocks, as it turns out) it's 01000020. This is little endian, so when you reverse the bytes in hex it's: 0x20000001 = 536870913 Which in binary is: 00100000000000000000000000000001 It turns out that the bits ...


4

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 empty for simple bitcoin transaction! Using single-quote mark (') to make the bitcoin RPC call looking nice and not messy. That's all.


4

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 it was used or that it downloaded blocks but didn't prozess them jet. Just let bitcoind run a bit longer and try the command again. Here is a similar answer ...


4

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, priority based selection was used for the entire block. It was a means to encourage the young Bitcoin economy to grow. However, it also had a minimum ...


4

Since version 0.16.0 $ bitcoind-cli getblockchaininfo { "chain": "main", "blocks": 525663, "headers": 525663, . . . }


4

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


4

Try rewriting your command to bitcoin-cli -testnet createrawtransaction "[{\"txid\": \"12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad\", \"vout\": 0}]" "{\"mxh3H416KCRoBDiweSESew5YJyAk1nxLrN\": 0.025, \"mkrzDhhZtzQm8zgckSs4fMNrvtNJ66zaFe\": 0.0245}" as suggested by this thread.


4

You're getting this error because bitcoind isn't running. Once it is, it will create an authentication cookie, and bitcoin-cli will be able to connect. To start bitcoind from cmd prompt, type: cd C:/Program\ Files/Bitcoin/daemon/ Press enter, then type: bitcoind And press enter.


4

Wait a few minutes and the error will be gone. The source code defines error 28 as Client still warming up


4

Given: txid: 3bdb32c04e10b6c399bd3657ef8b0300649189e90d7cb79c4f997dea8fb532cb blockhash: 0000000000000000007962066dcd6675830883516bcf40047d42740a85eb2919 With these, you can create a proof and verify it like so: $ bitcoin-cli gettxoutproof "[\"3bdb32c04e10b6c399bd3657ef8b0300649189e90d7cb79c4f997dea8fb532cb\"]" ...


4

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 bitcoin-cli So what you should actually be doing is src/bitcoin-cli -rpcuser={...} -rpcpassword={...} getblockchaininfo


4

bitcoind, and bitcoin-qt are all part of the same program. Bitcoind and bitcoin-qt are both Bitcoin Core and do the same thing except that bitcoind has no GUI. Both are part of the Bitcoin Core project and referred to as Bitcoin Core. Both share a large amount of code and are full nodes. bitcoin-tx is a utility that is part of the Bitcoin Core project that ...


4

configure it to connect to an external full node. Is that possible? Technically yes, but in practice, no. bitcoin-cli connects to a bitcoind via the RPC interface. This interface is typically not exposed to the internet nor are all IP addresses typically allowed to connect to it (specific IP addresses or CIDR blocks need to be explicitly allowed by the node ...


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