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, ...


9

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

Simplest API, doh!: $ 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, "...


7

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


6

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.


6

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 ...


6

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


6

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 ...


5

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": "...


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 }]''' '{"...


4

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 ...


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

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

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


4

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 ...


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

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


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

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 ...


4

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 ...


4

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

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 ...


3

I was advised that an easy way to read everything my node relays would be to connect to my node and accept all the messages it relays. So here's a basic "node" written in PHP. <?php // -------- // SETTINGS // -------- $version = 60002; $node = array('85.119.83.25', 8333); // node you want to connect to $local = array('127.0.0.1', 8333); //...


3

Yes, congratulations you are running a full node. Note that you're mostly running a full node so that you can fully validate everything so you can now send and receive money without trusting anyone. However you are trusting your PC itself, malware might steal your money or cause you to lose money (both would happen with non-full nodes too of course). You ...


3

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 ...


3

After some digging, I believe I have an explanation: the memory pool is clogged with 'junk' transactions. Bitcoin Core's minrelaytxfee parameter defaults to 0.01 mBTC/KB, which is "too low" in the sense that it permits TONS of 'junk' transactions to enter the memory pool. I've bumped minrelaytxfee to 0.05 mBTC/KB and the results so far are very encouraging. ...


3

Seeing as this question remains unanswered after a few months... You will need to enable txindex = 1 in your bitcoin.conf per @Jannes' suggestion. If you want to scan your downloaded blockchain for another wallet's address transaction history, then you have to build the entire blockchain index on your machine. Whether it's a watch-only address or not ...


3

settxfee sets the fee/kb for future API calls like sendfrom. It is remains in effect as long as the program runs. estimatefee 1 returns the fee estimated to result in confirmation within 1 block.


3

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


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