For SIGHASH_SINGLE do the outputs other than at the input index, have 8 bytes or 9 bytes including a VarInt?

Transaction outputs have a "value" field that's an 8-byte signed integer (always 8 bytes) indicating how many satoshis (0.00000001 BTC each) are available for that output.  That is the thing that gets set to -1 on the other outputs in SIGHASH_SINGLE mode.

This looks to be the code responsible for making this happen, from script.cpp:

/** Serialize an output of txTo */
template<typename S>
void SerializeOutput(S &s, unsigned int nOutput, int nType, int nVersion) const {
    if (fHashSingle && nOutput != nIn)
        // Do not lock-in the txout payee at other indices as txin
        ::Serialize(s, CTxOut(), nType, nVersion);
    else
        ::Serialize(s, txTo.vout[nOutput], nType, nVersion);
}

If we're in SIGHASH_SINGLE mode, and the index of the output is different from the index of the input, then the thing that we sign in this spot is just a dummy CTxOut object, whose parameterless constructor (in core.h) calls SetNull(), which sets the field called "nValue" to -1 (-0.00000001 BTC) and clears the scriptPubKey, which ensures that it's a 0-byte vector.

When CTxOut gets serialized, it writes the nValue and scriptPubKey per this (core.h again):

IMPLEMENT_SERIALIZE
(
    READWRITE(nValue);
    READWRITE(scriptPubKey);
)

nValue serializes as the 8-byte twos-complement representation of -1, or 0xFFFFFFFFFFFFFFFF.
scriptPubKey serializes as a 1-byte CompactSize that indicates that the script is 0 bytes long, or 0x0.


Encrypting Bitcoin private keys instead of printing out paper

It's challenging to answer this without a clear definition of what you mean by "safe." I'll assume your two main concerns are (A) loss by theft; and (B) loss by user error.

For (A) you're "safe." You followed offline cold storage wallet generation procedure and your private key was not exposed in an online-hackable way. You have the same level of theft protection as an offline-generated paper wallet -- with the added level of protection that your private key is encrypted. If your paper is lost or stolen, another party would have to know your method of encryption as well as your password. (Naturally, if your password is stored on the paper, then you effectively have the same security as a non-encrypted wallet in the case of theft or loss of the physical paper.)

For (B) there are a number of possibilities, but here's some scenarios to consider.

Are you entering the unencrypted or the encrypted private key into bitaddress.org? If the latter, then you gain no benefit from the encryption and might be confused when attempting to retrieve your funds.
How confident are you that you'll be able to recover the unencrypted private key when the need arises? Your use of a home-brewed step here makes it a good candidate for something to go wrong. Are you prepared to keep a working copy of the encryption/decryption software -- exactly as it was used at the time of wallet creation -- for the entire lifetime of the paper wallet? Did you test decryption at the time you generated the wallet to ensure the decrypted private key matches the original unencrypted key? Have you tested retrieving funds to ensure that your process works from end-to-end? Are you going to remember all the steps involved 10 years from now or do you need to keep written notes?  Etc.
Same with any password-protected item, how confident are you that you'll be able to remember the password when the time comes? People forget passwords so often that nearly every website with password-based authentication includes a recovery mechanism. Are you printing the password along with the paper wallet? If so, then what is the purpose of the encryption? Are you printing the password and keeping it elsewhere? If so, then will you be able to find it when the time comes? (How many times have you put something where you'll "never forget where it is" only to discover you can't find it later?)
Same with any paper wallet, how safe is yours from physical loss, disaster, etc.? Are you planning to keep a backup copy? How do the backup copies affect your risk of theft? How long will the paper and ink last?

Have a look into BIP0038. bitaddress.org can generate BIP0038-encrypted private keys. Three benefits of this are:

BIP0038 uses scrypt with parameters intentionally tuned to make brute-force password guessing attacks very slow. In this thread folks were getting 7 password guesses per second at the time, which is not very many for a brute-force attempt.
bitaddress.org generates the wallet in such a way that the actual private key never exists in the computer's memory while the wallet is being created. Counter-intuitive, but true -- it uses the "EC multiply" variation of BIP0038. (Of course your password exists in memory, so you will likely still want to do this offline.)
It is more of a standard than your home-brewed encryption step. BIP0038 is not officially an adopted standard as of this writing; but enough folks support it at this time that it may as well be a de facto standard. This means you have several options for retrieval, with less chance for human error or other issues presenting an obstacle to retrieving your funds.


How to subtract two points on an elliptic curve?

You can negate a point (x, y) by simply changing it to (x, −y).

The document that defines ECDSA reminds us of this fact:

https://www.secg.org/sec1-v2.pdf

Here's a screenshot:

So once you have negated one of your points, just add it to the other one, and you have achieved subtraction.


Where is the change from the output stored in?

When a sender creates a transaction, they explicitly define which pieces of bitcoin they spend. We call such pieces of bitcoin Unspent Transaction Outputs (UTXO) and you can think of the UTXO Set as the distributed ledger of Bitcoin's balances. The state of UTXO is ternary: they either don't exist yet, are available for spending, or have been spent. So, you can't deduct from them, but must spend them completely in one transaction.

Spenders explicitly pick the transaction inputs by referencing the UTXO via its unique outpoint txid:vout which is derived from the transaction that created the to-be-spent UTXO. Now the spender essentially has assignable balance to the sum of the inputs' total value. The spender will  explicitly assign the value of the consumed inputs to new outputs. Any funds not assigned are considered transaction fees and will be collectable by the miner that includes the transaction in a block.

This means the following hold true for (non-coinbase) transactions:

Σ(outputs) ≤ Σ(inputs)
transaction fees = Σ(inputs) - Σ(outputs)

So, to be clear, only the inputs and outputs on transactions are explicitly defined. The transaction fee is implicitly defined by the inputs and output.

It follows that a simple transaction sending to a single recipient will generally have two outputs:

a recipient output to conduct the payment
a change output to return the remaining funds from the inputs to the sender

I grabbed a random transaction from blockchair.com to visualize:

If Alice's wallet had not created the change output to itself, Alice would have paid 11,044.… BTC in additional fees. ;)

Note, that I'm simply guessing that the 610 BTC is the recipient output due to the round number, I'm not intimately familiar with this transaction.


Bitcoin is not connected in regtest mode

Although I believe Fred Tingey's answer is complete, it has the following attributes:

it depends on a config file.
it provides examples for bitcoin-qt on the windows platform, and the OP was asking about bitcoind on the linux platform.

Thus, I wanted to share the following concise bash script which does what the OP wants. As others have partially noted the key to getting this to work is:

specify a unique port (if listening) and rpcport (if using rpc) for each node
specify a unique data directory for each node
if using -connect to restrict to own nodes, remember to use -listen to accept connections from own nodes.

That said, here's my start-regtest-network.sh script:

#!/bin/bash
bitcoind -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16591 -datadir=$HOME/regtest/A/ -connect=localhost:17592 -regtest -pid=$HOME/regtest/A/.pid -daemon -debug
bitcoind -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16592 -datadir=$HOME/regtest/B/ -connect=localhost:17593 -regtest -pid=$HOME/regtest/B/.pid -daemon -debug
bitcoind -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16593 -datadir=$HOME/regtest/C/ -connect=localhost:17594 -regtest -pid=$HOME/regtest/C/.pid -daemon -debug
bitcoind -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16594 -datadir=$HOME/regtest/D/ -connect=localhost:17595 -regtest -pid=$HOME/regtest/D/.pid -daemon -debug
bitcoind -server -listen -port=17595 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16595 -datadir=$HOME/regtest/E/ -connect=localhost:17591 -regtest -pid=$HOME/regtest/E/.pid -daemon -debug

Additionally, here's my stop-regtest-network.sh:

#!/bin/bash
sudo killall --regex bitcoin.*

I realize my stop script is sloppy, and will kill all bitcoin processes.. if you're so inclined you could modify this to pull the individual pids out of each data directory.

Lastly, You will probably need to precreate some data directors for bitcoind if you don't edit the script at all.

mkdir $HOME/regtest/A/
mkdir $HOME/regtest/B/
mkdir $HOME/regtest/C/
mkdir $HOME/regtest/D/
mkdir $HOME/regtest/E/

You should have regtest bitcoind nodes connecting round-robin on ports 17591, 17592, 17593, 17594 and 17595. Likewise, you should be able to connect to rpc ports 16591, 16592, 16593, 16594 and 16595. If you need to know the RPC password you can check ps aux, or set an explicit rpcpassword in the script.

HTH


If Btc2x doesn't have replay protection does that mean all transactions can be automatically replayed in btc2x?

Since 2x has decided not to implement replay protection, transactions will be indeed compatible to both chains. If a transactions is simply broadcast to the other chain, it will enter the mempools there as well and may eventually get confirmed. This doesn't mean that one is completely helpless though. Here are some methods of making transactions valid only to one chain:

Input derived from a coinbase transaction
Coinbase transactions will only ever be valid on one chain. Therefore, including an output that derives from a coinbase transaction will make a transaction only valid on a single chain. Coinbase transactions need to mature to 100 confirmations before their outputs may be spent, so transactions based dependent on a coinbase will become valid about 17 hours later at the earliest.
nLocktime and doublespend
If one of the blockchains has significantly more frequent blocks than the other, one can create two transactions sending to oneself: One with a nLocktime for the next block on the faster chain, and another that spends at least one of the inputs from the first transaction with a very high fee. First, you broadcast the transaction with the nLocktime which will hopefully get included in the next block on the fast chain. Once it is confirmed, the doublespend is broadcast with a very high fee to the slower chain, hoping that it will get confirmed before the height of the nLocktime of the first transaction is reached. After waiting some more confirmations for safety, the outputs of these two transactions can now be used to create transactions specific to only one chain.
Doublespending
Create a pair of transactions with different recipient addresses that you own that spend the same funds. Broadcast both at the same time and hope that one gets confirmed on one chain while the other gets confirmed on the second. If unsuccessful, repeat.

Generally, as soon as one has some unspent transaction outputs that are unique to one of the chains, these can be used to make other transactions safe as well.


What is the best method for creating a paper wallet?

Here are a list of my best practices for creating a paper wallet.

Generate all keys on an offline computer system, this ensures that you are not using an online system that could be sending your keys across the internet.
Verify the integrity of the code as well as the integrity of the author, things to check include MD5, SHA1 sums and that author is a reputable contributor to the community.
Ensure the integrity of the host system being used to generate the keys if your system is compromised your keys could be as well.  To mitigate against this I often use a LiveCD based operating system.
The wallet should not be stored on a live computer system until the fund are intended to be spent.
The wallet should never be displayed, exposed, or photographed and when possible BIP38 encryption should be enabled providing an additional layer of security.
Ensure fully random sources of entropy are being used during private key generation, information/randomness should never be provided by humans (I.E. brainwallets).
Paper wallets should never reuse addresses, and will only store one keypair per wallet.  When spending remember all funds need to be removed from the wallet at that time, many have lots coins due to improper transaction generation which can spend the remaining balance in the form of a fee.
Optional: I prefer to store the paperwallet inside of a tamper evident device, this will ensure that no one else has had access to your private keys (thus protecting them from being stolen)
Optional: Multiple backup locations of the paperwallet all protected and stored using the same techniques, from a backup perspective I am never comfortable unless I have 3 copies stored in at least 2 different physical locations.


The error message explains the program. The Flags field has a bad type -- it must be a JSON integer.


How to best structure Internal bitcoin payments within a webapp?

The Block.io api supports accounts for similar usage.

With Block.io, you can create wallet addresses for users inside your games, auction sites, stores, etc.
To create a user's wallet on your account, create addresses for them using get_new_address. You should specify a sequence of labels for that user. For instance, if we wish to create a number of addresses for User A, we'd want to call get_new_address with label=userAx{address_number} as many times as wish to create a new address for User A.
Once we have addresses for User A, we can query balances for their addresses, and send coins on the user's behalf.


Ledger Wallet doesn't support RBF but you can do Child Pays For Parent:
Make a transaction to your address 3M6EhQL3QUQHAFkSPH3vLc3VDCrJKP3iMv with amount  0.011, set a fee rate, preview the transaction and check and confirm the transaction only if one of the inputs is 0.01187067 BTC.
If this doesn't work, download Electrum and CPFP from there.
But honestly, the fee rate of your transaction is not terribly low. I would wait another 24 hours.


For the Avalon 741, would a suitable PSU be the Leadex II 1200W?

That should work, given that you need 96A and the power supply supplies 99A. It's not a lot of headroom, though. (In contrast, the EVGA power supply has 108A.)


Is it possible to create pure lightning lockboxes (without touching the blockchain)?

I am not sure if I understand your question right. Do you want to have a 2 out of 3 multisig wallet? Theoretically this is very possible. Though practically this will be quite combersome. I guess the best way to achieve this would be to wait for BIP 118 to be activated and then the eltoo upgrade. This would easily enable multiparty channels. This could be used to achieve a scenario as you described.


How can I generate a QR code for multiple outputs?

BIP0021 (the contents of a QR code) does not specify a method for defining multiple addresses.


When are Bitcoin transaction outputs generated more than two?

Bitcoin inputs and outputs are only limited by transaction size. There are  scenarios when you may see a few inputs with many outputs, such as an exchange performing many user withdrawals in a single transaction.

Conversely, you often see transactions with hundreds of inputs, and very few outputs. These are also usually exchanges, or people/companies with lots of receiving addresses, combining the utxos into a handful or large utxos (usually to a cold wallet).


How to refund bitcoin after wallet recovery?

Actually, you said you lost your password to your blockchain wallet, and since you have the wallet and the security passphrase,
then actually you should check the btc address in which you have the fund on blockchain.info to see if your actually balance is there


When ASICs generate a share, is it always at difficulty 1?

It's hardware specific, and most of the information for Bitcoin mining ASIC are under an NDA so this can't be posted publicly. There's very little utility in returning difficulty one shares to the controller, for a device doing 1TH/s it would mean dealing with hundreds of results a second that the controller is just throwing away.

The difficulty of a "share" is whatever the hash target was, if we have a target of difficulty 256, then any valid block header with a difficulty more than this would make that "share" valid for the target. Shares with a vastly higher difficulty (in the billions today) might also be valid as a block for their parent pool. Shares are only used by pools to gauge how much work a client is putting into finding a block (they are simply blocks with too low of a difficulty to be valid), they're completely useless for anything else and thrown away.


Can I transfer bitcoins generated in regtest mode to a friend?

Yes, sort of.

In regtest mode, mining is made much easier, and by default it doesn't attempt to connect to any peers to exchange blocks or transactions.  But your friend can run another client in regtest mode and explicitly connect to yours, and then you will share the same block chain and can exchange transactions.

You will need to ensure that your firewall allows incoming TCP port 18444 from the Internet (or at least from your friend's IP address).  You'll also need your external IP address; say it is 1.2.3.4.  (DNS also works if your machine has a DNS name.)  Then you can run your client with -regtest, and your friend can run hers with -regtest -connect=1.2.3.4.  Once you have synced your blockchain with each other, you can send transactions to each other just like you were on the real Bitcoin network.  (Of course, nobody will see them except you.)
Note that in order for the transactions to be confirmed, one or both of you will have to use setgenerate to mine some more blocks.

Note also that if both of you are mining, a temporary network failure could lead to you quickly making a big fork in your block chain.  This will make the Bitcoin client unhappy.


If you're saying the transaction is confirmed now, then those coins are now in the possession of the market.  You can't reverse the transaction - that is what "confirmed" means.  So in order to get your coins back, you will have to ask the market for a refund.  Nobody else has the power to make it happen.

The fact that the market cancelled the order is purely internal to them.  It didn't prevent the money from being transferred - in fact there is no way they could do that.

It is possible that they will refuse, or that they deleted the private keys corresponding to the destination address before the transaction was confirmed.  In that case, too bad.  You could try to get your money back through legal process (a lawsuit or similar), but you can't do it unilaterally through purely technical means.


How do I catch the unconfirmed transactions?

How do I catch the possible unconfirmed transactions, so the ones that
  got saved in the db when were first posted, but in the process were
  rejected/unconfirmed in the next 6 blocks.

There are two ways a transaction (TXID) is first introduced by walletnotify:

1) Acceptance in mempool
2) Confirmation in a block

A transaction in mempool has no guarantee of being mined, and a confirmed transaction may have never been previously seen in your local mempool. Therefore, you need to be able to differentiate between the two scenarios, and only store the transactions which actually receive confirmation.

Reorgs: Furthermore, there is no guarantee that a previously confirmed transaction receives confirmation from subsequent blocks. It is possible that subsequent blocks form a separate branch, so that your previously confirmed transaction is no longer in the strong chain. This is where incrementing confirmation with each new block as you describe will fail.

Better to verify the longest header chain (they must link together via prev header hash) and ensure that the transaction is included in this longest chain when computing the level of transaction confirmation. If this longest header chain reorganises, you can update the confirmations of all transactions accordingly.


Trouble syncing my QT bitcoin wallet 12 days already and 144 weeks to go

You should upgrade your wallet to the latest version of Bitcoin Core (it's the same thing as bitcoin-qt). Bitcoin-qt 0.8.5 beta is extremely old and unlikely to be able to actually sync the Bitcoin blockchain. Install the latest version of Bitcoin Core from bitcoin.org and let it sync the rest of the blockchain. Upgrading to the new version will not remove any blockchain or wallet data so it will use what you have already downloaded.


How safe it is that a single San Francisco company controls the canonical location of Bitcoin code?

You should learn more about the way the git scm system works. First, it is distributed so that everyone has a complete copy of the entire codebase; second, every commit is checksummed, so that if github wanted to (or was forced to) underhandedly change code, it would be detected by everyone.


Lightning network smart contract technical explaination (unidirectional payment channel)

Yes .
I like this video as well, explaining the u and b directional channel.
The Lightning Network Explained (Litecoin/Bitcoin)


Use this website to recover your coinage: trezor.io/recover-coins


How can I import blockchain.dat into bitcoind?

If you are downloading the blockchain from scratch I strongly recommend using the bootstrap.dat file, which allows your computer to simply verify blocks and import them without needing to download for days or even weeks on end.

The main issue with downloading from the network is that your client will only download one block at a time. It starts with block #1 and will not try to download anything except for block #2 after block #1 is verified, and so on. As you can imagine, with network latency this can become a rather painful process, as you have endured.

The bootstrap.dat file is widely available on bittorrent, torrent files can be found here: http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/

Direct torrent link: http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/bootstrap.dat.torrent/download

Downloading the bootstrap.dat file is just as secure as downloading the blockchain from peers, but since all the data is already there, the only latency you suffer between blocks is going to your hard drive and finding the next block.

You simply need to place the bootstrap.dat in your %appdata%\Bitcoin folder, (on linux/unix in your .bitcoin folder). The file will be renamed to bootstrap.dat.old when the data import is complete. Using this, it took me only 4 hours to catch up with the network, as opposed to the 1-2 weeks it took me before reformatting on the same computer.


Lnd itself does not provide the betweeness centrality of your or any nodes. However you access the network with the graph api call and compute the centrality yourself. You can either implement it yourself by following the instructions from the Wikipedia article or you can use a graph lib like networkx that does it with one api call after you passed the network to such a lib.

Also please keep in mind that of corse one can model the weights of the lightning network differently (for example by just taking channels as edges with weight 1) or by trying to model in the fees. When one does so the problem is how to model in the dynamic fee_rate together with the static base_fee_msat` as the resulting fee that one pays would depend on the amount that is being transferred. this amount could change and thus the network would change.


What would be an estimate of the value gained if the whole world started using Bitcoins?

According to xkcd: Money Chart estimated total economic production of the human race as of 2011 is $2,396,950,000,000,000 . Divide it by 21 million and the theoretical maximum price per bitcoin would be $114,140,476, but that figure is impossible, because for one, even in best case scenario Bitcoin will co-exist and compete with other currencies and would have only a small share of the pie. Second, Bitcoin is more efficient medium of exchange then USD, in other words, to complete transaction a someone required to hold bitcoins for shorter period of time therefore less total amount of bitcoins would be required for circulation and that also means lower price.


What Protocol is used in miner and Pool communication?

Most use the stratum protocol which sends JSON data over a TCP socket. Some pools also support the getblocktemplate protocol which works over the JSON-RPC (i.e. it uses HTTP requests).


Finding paths NOT originating from you with lnd

I don't know if that possibility ever existed as an api call 8n lnd. but you can certainly call the describegraph api call to get all nodes and channels that are publically known. This json blob can easily be imported with a few lines of code as a graph in any graph library such as neo4j  or networkx once the network is there you can run any pathfinding algorithm from any source to any destination. Note that due to routing fees the shortest paths should be searched from destination to sender as the feerate is dynamic and depends on the fees that will have to be paid by future nodes and not only on the payment amount


How do I know my wallet.dat actually already contains 100+ addresses ready to be used?

you can check by directly exploring the content of your wallet.dat file, which is a bdb database. there are various tools for exploring the wallet, one of which is gavin's bitcointools: https://github.com/gavinandresen/bitcointools

Another exporter is pywallet.py.


What getmempoolinfo is returning is not the minimum fee to send a transaction, but the minimum rate per kilobyte to send a transaction. Your bitcoin client will take the configured fee and multiply it by the size of the transaction in kilobytes to calculate the actual transaction fee.

The size of a transaction is somewhat difficult to compute (for a person) because it requires understanding the number of inputs that are required to fulfil the transaction, the number of outputs (primary recipients + change address), and the targeted transaction fee (since appropriate fees could eliminate the need for a change address).

There are online fee calculators out there you can use to estimate these, but it is still difficult to completely empty a wallet with a known fee using the straight bitcoin client.


Is there any complete specification of the transactions?

Or do I have to read the source code?

This is the only "official specification". The wiki pages have a lot of good info, but they sometimes contain inaccuracies or important omissions.

There's some info about the SIGHASH flags here:
https://en.bitcoin.it/wiki/OP_CHECKSIG


Bitcoin Core - When is fAllowWitness evaluated to true?

Doing a grep on SERIALIZE_TRANSACTION_NO_WITNESS shows that it's ORed with PROTOCOL_VERSION when creating a CDataStream object for example. This is the first clue that the no witness flag is to be found along with the version protocol.

A little more digging shows that this define is used when building a Tx message in lines 1105-1126 of net_processing.cpp (v0.15.0.1):

        else if (inv.type == MSG_TX || inv.type == MSG_WITNESS_TX)
        {
            // Send stream from relay memory
            bool push = false;
            auto mi = mapRelay.find(inv.hash);
            int nSendFlags = (inv.type == MSG_TX ? SERIALIZE_TRANSACTION_NO_WITNESS : 0);
            if (mi != mapRelay.end()) {
                connman.PushMessage(pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *mi->second));
                push = true;
            } else if (pfrom->timeLastMempoolReq) {
                auto txinfo = mempool.info(inv.hash);
                // To protect privacy, do not answer getdata using the mempool when
                // that TX couldn't have been INVed in reply to a MEMPOOL request.
                if (txinfo.tx && txinfo.nTime <= pfrom->timeLastMempoolReq) {
                    connman.PushMessage(pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *txinfo.tx));
                    push = true;
                }
            }
            if (!push) {
                vNotFound.push_back(inv);
            }
        }

The above code shows that the int variable nSendFlags may contain the no witness flag. Later, msgMaker.Make will use this variable to create the Tx message as shown in line  1119:

                    connman.PushMessage(pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *txinfo.tx));

You can then follow the serialization by looking at the class CNetMsgMaker in netmessagemaker.h which itself uses CVectorWriter to serialize the data.

To summarize, the GetVersion() value is built using the protocol version optionally ORed with the SERIALIZE_TRANSACTION_NO_WITNESS. This value is never sent over the wire. It's used only to control the serialization of the Tx message.


What does the Bitcoin RPC mean and how is it used?

RPC = Remote Procedure Calls.  That describes a system when you send a command to a remote system where it's processed and results are returned.

Bitcoin RPC is synonymous with JSON-RPC in my opinion, although JSON-RPC itself is not Bitcoin-specific.  JSON-RPC simply implies that the RPC interaction will use JSON as its data structure.

Bitcoin RPC is used by authenticated clients to connect to a running instance of bitcoind. The clients issue commands to send transactions, get status, and a variety of other purposes.

The Bitcoin RPC commands are on the wiki.


If I send BTC from Jaxx will it give me both BTC and BCC

Bitcoin and bitcoin cash are two separate networks, if you send a tx on one network, it will not affect what happens on the other network. If you are using Jaxx, your wallet will show separate btc and bch balances in the app.

To deposit both btc and bch to Bittrex, you will not to get a btc deposit address from Bittrex and send btc to it. And then get a bch deposit address from Bittrex and send bch to it.

That said, I am unsure if Bittrex supports bch right now. If they do support it, the above will work. If they do not support bch, then obviously you cannot deposit a coin they do not support.


BTC that i received 2 days ago are missing, how come?

Maybe someone was monitoring your bitcoin wallet. You should enable 2 factor authentication to increase the security of your wallet. Furthermore, some transaction needs at least 3 confirmations before the proposed money enter your bitcoin wallet finally. Some scammers may use this method to collect money from their victims and cancel the transaction before all confirmations were made.  So please be careful.


Importing 24 word mnemonic to bitcoin-qt

You can't. Bitcoin Core does not currently allow the importing of seeds or mnemonics.


Here's how I understand your question: You have a spare computer that you'd like to run bitcoin on to help the network. You have a second computer that is your main personal computer; it's also where you'd like to keep your bitcoins. Two copies of the blockchain would waste bandwidth and disk space.

There is a way to keep the blockchain on one computer but to keep your coins on another - you can run the electrum client, and the normal bitcoin client on the other computer. Optionally, you can run the electrum server on your always-up computer, although this requires some command-line knowledge.

https://github.com/spesmilo/electrum-server/blob/master/HOWTO.md


You should be wary when trying to travel only on Bitcoins, some people have failed in the past.

At the current stage of development, Bitcoin is not ready to be used to finance your local spending across multiple countries, as getting money to and from an exchange takes a long while. Moreover, you can't withdraw money easily this way into a foreign currency, so the model would work like holding all your money in your local bank and using a debit card to withdraw money at an ATM.

You could potentially have your fellow Bitcoin enthusiasts offer to sell you local cash for Bitcoins on the spot, but that would require a lot of preparation, contacting people, and trusting them to show up on time when you need the cash. Generally, not an ideal situation.

All in all, it can't really be done at the moment. Maybe in a couple years...

Update: BitInstant has announced that they will be releasing an international MasterCard funded by Bitcoins in a couple months.


How to create a transaction without broadcasting

testmempoolaccept is a RPC which lets you dry-run submitting a transaction like sendrawtransaction, without actually pushing the transaction into your mempool or to the p2p network. Both function identically other than the final operation of broadcasting, so error messages can be considered equal.


how to transfer money from mobile wallet to bitcoin wallet

You can always use https://btcxindia.com/ to transfer INR from your bank account/credit card to BTC.


Bitcoin Core is open source under an MIT license, and is the original software implementation of a Bitcoin full node, though there are others. Most nodes run Bitcoin Core, but don't have to. Bitcoin could be defined as a network of users that agree to the same consensus rules, which means they don't all have to run the same exact software.

The MIT License (MIT)

Copyright (c) 2009-2018 The Bitcoin Core developers
Copyright (c) 2009-2018 Bitcoin Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

See COPYING


How to quickly get the target of the next block to be mined from bitcoin-core over RPC?

You can easly calculate that from the difficulty
So just with the RPC call getdifficulty calculate this:
target = targetmax / difficulty

Where targetmax = 26959535291011309493156476344723991336010898738574164086137773096960
target max is a fix number from the genesis block
If the hash value (Converted to decimal) is lower then this value, it's a valid Block


Are there any privacy benefits in using a separate wallet in Bitcoin Core to separate myself from my service?

Yes, it's good practice to use different wallets for different mental entities that you don't want associated. Two different wallets cannot be linked from blockchain data alone.
However, that doesn't mean they couldn't be associated by different means, say someone seeing you use both of them, or monitoring transactions that are first relayed by your node.


Is the SegWit2X success due to concentration of mining power?

I feel that the existing answers here fail to highlight that while (the collection of) miners have the authority to select the order of transactions, and impose additional validity rules, they do not have the authority to determine what the rules are.

Segwit2X (in my understanding, there seem to be multiple ideas out there) seems to be a combination of a soft fork (activating SegWit) and a plan to do a hard fork later (changing some resource limits). The first is something that miners can do, but the second will only be accepted by full nodes that implement the same rules, and be ignored by everyone else.


RPC Wallet API methods "getblockhashes" was removed?

Just for the record, the RPC call getblockhashes exists in bitcore patches for bitcoin/zcash etc, because the insight block explorer, which uses bitcore patches for the running node, needs to know last blocks.


I want to do program that doing some calculations with bitcoin values.
I know bitcoin have 8 digits after decimal point (please correct me).

There is no decimal in bitcoin at code level. There is no "bitcoin" unit either. There is only satoshi. And it is best to always stick to integer types instead of floating point types for calculations.

Shall I use int64_t instead? It generally can store 18 digit number, so if I multiply by 100,000,000, I will be able to work in satoshi units and never lose precision.

The number of digits doesn't matter, the size of the number in binary matters.
Since the maximum value you can have as "amount" for bitcoin is 2100000000000000 (21 million bitcoin or 21 million * 10^8 satoshi) and this value is 7 bytes (0x0775f05a074000), you need an 8 byte (64 bit) integer. So your options are a signed or unsigned 64-bit integer value type. The sign doesn't matter because the most significant bit is never set due to the size of the max value.
By the way a 64-bit signed integer has a max value of 9,223,372,036,854,775,807 which is 19 digits.


You can plug your specs into a bitcoin calculator like this one http://bitcoinwisdom.com/bitcoin/calculator but since you have such a low hash rate you shouldn't expect much since the difficulty will continue to keep rising.


How BTC value is determined in USD from a trading pair?

If one bitcoin is $1,000 (for the sake of easy math), and 1 Neo is worth 0.1 BTC, then you can determine the USD value of one Neo is $100.

1000 * 0.1 = 100


Why there is a huge amount of difference in price for the same coin at same time?

Discrepancies in exchange rates can arise from many things, such as:

how often the exchange rates are recalculated or cached by the website
where the website gets the data from (e.g. there are a lot of different exchange platforms, the live price varies a bit between them all)
how the rate is calculated (most exchanges only support BTC/USD as fiat currency price, so any other fiat currency like Rupee or Ripple coin must be calculated using multiple conversion steps (e.g. ripple -> bitcoin -> USD -> Rupee)

Also, if you are using a website like zebpay, they set the rate themselves to include a fee, because they want to make a profit, so you can expect that rate to always be higher than the price listed on something like coinmarketcap.com. That is just the rate they sell at.


Could a 2/3 majority vote be used as a consensus

Your proposal is not sufficiently specified:

How is the authoring node selected?
How does a node prove his authority to author a block?
How do other nodes show support for the published block?
How can the support for a published block be verified by other nodes?

It is not clear how your proposal achieves consensus at all. Additionally, there doesn't seem to be a significant cost associated to vote on blocks, so the proposal is vulnerable to Sybil attacks.


Yes, the costs of using BTC are getting excessive. So much so that it is no longer practical to keep sending small amounts (< $5).

But this is a result of bitcoin being so popular and its value having risen so much in the last months. Also there's a lot of SPAM transactions going on, probably by miners in order to push everybody else to pay higher fees for their own profit.

But even then most technical users recognize that the solution taken by BCH is not the right one. Why? well because it is just a "kick the can" solution. It fixes things temporarily and it provides BCH users with a great experience (just like bitcoin had a few years ago) basically because no one is using it.

But that extra capacity doesn't come for free. If bitcoin did this, ALL nodes in the network would have their disk usage rate increased by a factor of 8, forever. The cost of that is that in the not so distant future almost nobody would be able to run a full node anymore and thus the number of nodes would decrease, leaving the network less and less decentralized. Remember that the whole value proposition of bitcoin rests on the fact that the network is decentralized enough to be resilient to attacks both from the outside as from the inside. So if we just allow the costs of running a node to increase 8 times faster, we'll probably end up with a network composed of nodes controlled by a cartel of powerful companies. This is a very dangerous scenario for bitcoin. Since it simplifies the work of governments that might want to control or censor it.

Instead of that, the bitcoin core team of developers actually just adopted another more carefully planned increase strategy that will eventually be equivalent to something close to 4x. This was already a compromise solution and one that actually opens the door to new off-chain scaling technologies.

Off-chain scaling can increase the system's capacity by orders of magnitude, not just simple 2, 4 or 8x. If you want to know more about it just google "lightning network". Beware however that it is a complex topic. Maybe that's the reason most people just dismiss it and tend to go to the simple kick-the-can solution like increasing the base block size.

Basically from my point of view Bitcoin Cash is an amateurish solution to a very complex problem. If adopted, their network will just keep on centralizing more and more (Some believe it is already very centralized). And if it actually gets a lot of traction it will inevitably face the same problem bitcoin is facing in a couple of years. The irony is that they'll be just fine if they fail to gain adoption, since they will remain much more usable than bitcoin.


When installing libbitcoin there are checks of the code, why is this?

These are not tests. They are simply warnings generated by the compiler indicating there may be an issue with the code being compiled.

Most likely, it's just being overzealous and the developers are aware of this.


macOS Mojave changes how the header is serialized in the beginning of the executables. Maybe you could tell us how you installed the dependencies (using brew?) and the version of the compiler?


You actually have several options, but they all relate to what your hot wallet actually is, and how you want to interact with it.

For example, you could have bitcoind running on a different server, and allow it to accept RPC commands from your web server.  These commands could either be issued by calling the command line on your server, or by adding RPC support directly into your web application.

You could also skip using an "out of the box" wallet like bitcoind, and instead add wallet features directly into your web application using a library like NBitcoin (since it sounds like you are using .NET).  In this scenario, your web application would actually be your hot wallet, and you would only build out the wallet capabilities that you plan on using.

In either of these cases, however, I would advise you to keep wallet functionality off your public facing web server, and make sure that the server handling the actual signing of transactions and storage of private keys is only accessible from your web server (with proper authentication), and not the internet at large.  When bitcoin is involved, it's best to limit your attack surface.


Is magicbytes sequence a valid delimiter for blocks in blockchains?

A blockchain is an abstract datastructure that contains a chain of blocks, consisting of hash-linked he headers and transactions.

If you're talking about a parser, I assume you're talking about files on disk... perhaps the blk*.dat files in Bitcoin Core's data directory. Those are just one way to represent the blockchain, and it's an implementation specific one that can change between releases.

Assuming you're indeed asking about the disk representation of blocks in Bitcoin Core (or similar software):

Every valid block starts with the magic sequence plus the size.
The magic sequence is allowed to appear inside the middle of blocks.
There may be gaps between blocks that are filled with garbage, including byte sequences from block data, which may in fact also contain the magic sequence.

Furthermore, the term 'blockchain' is often interchangably used for both the tree of all blocks produced/known, or for the longest path through it. The block files on disk contain all blocks Bitcoin Core has ever seen, including blocks that are not part of the main chain ("orphan blocks") and were stale or reorganized out.


Unconfirmed transaction sitting in blockchain.info for 10 days

When will the network drop it?

Never. Why should network drop your transaction without an action from your side?


There is no way to determine (that I can imagine) the number of lost private keys, you would have to make a guess that after x years without movement the private key is lost but that would just be a guess.


Why some transactions disappear from the mempool?

Skimming the source code, I found the following reasons for a transaction to be removed from the mempool:

It was included in a block
A conflicting transaction (i.e. one which spent at least one of the same inputs) was included in a block
Expired: it has been in the mempool longer than the time specified by -mempoolexpiry (default 336 hours)
The memory pool size limit was reached (set by -maxmempool).  Lowest fee transactions are removed first.
A blockchain reorganization occurred (i.e. a different branch of the chain became the best), and this transaction spent coins that are now immature, i.e. the block where those coins were created is no longer at least 100 blocks deep
A blockchain reorganization occurred, and the new chain is shorter, such that the block height mentioned in this transaction's locktime has not yet been attained
A blockchain reorganization occurred.  Transactions from disconnected blocks have to be added to the mempool.  If it's already full, in this case, oldest transactions are removed to make room (not lowest fee in this case).
Under replace-by-fee, it was replaced by one with a higher fee

If someone knows of others that I've missed, please edit to add them.

If we could find the transactions themselves, we might be able to guess why they were removed.  For instance, maybe we could look at their inputs and see if they were spent by some other transaction.  But when I looked up the first few of those transaction IDs at blockchain.info, I got no results, so it may be that the block explorers have dropped them as well.


What is the easiest to operate/fastest solo bitcoin mining client for a cluster rig?

If you have a GPU rig cluster, you ought to look at standard miners. This question should help you get started:

What open source miner applications are there?

In the end you ought to try a few of them out and see which ones give you the best performance on your hardware. You can also have a look at Mining hardware comparison Wiki page to see what performance you should expect from your hardware and what configuration was used to accomplish it.


Transaction with OP_RETURN rejected by bitcoind 0.9

I suspect that the second output is being rejected because it contains an OP_RETURN with two data pushes.  From browsing the code, "Solver" in script.cpp only categorizes output scripts as "standard" if they meet one of a limited set of templates.

All such templates containing OP_RETURN:

OP_RETURN, by itself
OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack.

Since your script is "OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack, followed by another data push operation", it looks like it wouldn't meet either of those templates.


Each channel participant sets their own policy for forwarding HTLCs through the channel. They broadcast a channel_update message containing the policy, which is received and forwarded over the gossip network, and also received by the channel's counter party. The channel_update has a bit flag indicating whether the update belongs to node1 or node2.

A missing policy could mean that one party has not yet broadcast any policy, or that you've missed the broadcast message if you went offline at some point. In the latter case, your node should be able to query the policy over the gossip network with a query_short_channel_ids message.

If it is one of your own channels, it may just be that the channel is private and your node sets a policy regardless of whether or not the node is announced. I'm not sure about the specifics of any implementation in that regard.


MultiBit developer here. If you're using the latest version of MultiBit HD (0.2.0 at the time of writing) then your default would have been set to a reasonable level for the current network conditions of near full blocks. You can always set it higher if needed.

If your version is older and you haven't upgraded then the default fee will likely be too low to be accepted by a miner in the current conditions. It is likely to hang around until it is finally purged by all nodes from their mempools. This can take several days.

More information is here: https://bitcoin.stackexchange.com/a/9737/117 (as suggested by @StephenM347).


Importing a private key (paper wallet) to Bitcoin Core client, while offline, is not actually importing

You can use dumpwallet to examine the wallet's contents after importing the private key.
(for completeness, since comments are disposable)


Is reliance on a UTXO Set provided by other users dangerous?

First, you can validate the utxo set for the most part using SPV proofs. Essentially, that would mean you need the 80-byte block headers from every block (currently 410,000 or so, which means a 32MB worth of headers) and every transaction in the utxo set can carry a merkle proof for the block that it was published in, which can help you validate the set. So getting a UTXO set along with the merkle proofs for each transaction would at the very least have some decent promises of validity.

Second, it's possible the UTXO set that someone else gives you can be either missing certain UTXOs or otherwise be sending spent transaction outputs. In that way, it's possible for another user to fool you about the UTXO set being complete.

Third, the danger in getting a UTXO set from someone else is that you compromise your own privacy. This is fine for a lot of people (those who use SPV wallets, for example), but it may not be for you.


For some reason stackoverflow has a 50 reputation limit on comments, so I must use the answer box to point out that Karlo's answer is not correct - or at least does not tell the whole story. I understand that this is not the correct use for the answer box, blame stackoverflow's poorly thought out reputation limits.

I have a node with a few (outgoing) channels, have not spent a single satoshi with it yet. So the "remote balance" of the channels has always been 0, in other words there have been no balance updates. Yet the number of updates in the channels is non-zero.


What is the safest way to escrow my money before purchasing bitcoins?

Sites like localbitcoins.com (and eBay!) rely on reputation scores to assuage the type of concerns you express.

If a user on localbitcoins.com has a high number of succesfully completed transactions, with a 100% overall score, I think you can feel reasonably reassured that this user is reliable and will do the right thing. They have a respectable track record of performing as expected.

If you are buying bitcoins, in fact you do not have to give your fiat (dollar) banking information out at all. Many bitcoin sellers will accept cash, either in person, or deposited at their bank - so they would have to give you their banking information.  Unfortunately, many traditional fiat banks are restricting cash deposits into user accounts from anyone but the named account holder.  (Perhaps because they sense their obsolescence versus the security, speed and de-centralized nature of cryptocurrency.) So, verify that the bank you are depositing into will accept cash deposits from third parties.
There are other ways to pay for the bitcoins you are buying, as you point out, such as "Zelle" (https://www.zellepay.com/how-it-works) and others. Check the localbitcoin.com adds for the different ways sellers of bitcoin may accept payment.

Interesting that nobody wants to be "the bank". I think that is one of the beauties and reasons-for-being of crypto. There really is no need for banks, once you can receive, and send crypto on your own, from your own machine, with its own wallet. It obviates the need for third party intervention, really. Paying someone with crypto is like handing them cash, but it can be done electronically world-wide.

Maybe what you have here is a business opportunity for such an escrow company. One that will hold fiat deposits to secure transactions between seller & buyers. It would receive fiat from buyers of crypto, and release the funds to the sellers of crypto when it verifies (by monitoring transactions in the blockchain) that the agreed-upon crypto has been deposited into the buyer's crypto address...

Crypto funds are "kept" by the coin's entire peer-to-peer network in public addresses, and exist everywhere worldwide where any peer in the coin's network keeps a copy of the blockchain: aka, the shared-ledger which accounts for the creation and transfer of coins. But only the owner of the each address should have the private key that can spend the funds in that address.
(Make sure to keep the private keys to your addresses truly private !)

It's even possible to print out your private key on paper, and erase any trace of it from a digital device, making it impossible for any hacker to abscond with your funds. Cryptocurrency is very similar to cash in this regard. Your private keys are literally the keys to your funds. If someone takes or copies your private keys, they can spend your crypto funds. This would be analogous to leaving fiat cash lying around somewhere where it can be stolen.
Just keep those keys (in most wallet apps it's the 'wallet.dat' file in the .bitcoin directory) safe and secure and you will be fine.

Best of Luck


Please help me to understand lightning-cli getinfo more

First of all yes these are your earnings from routing. You can check lightning-cli listforwards to get a list (in json) to see through wich channel routings have been attempted and settled or failed. In particular you can analyze the routing fees per channel from the output of that command.

If you are interested in channel balances you can use lightning-cli listfunds to see how much balance is on which side of the channel.

As for the message you received someone offered you to balance their channels through you by asking how your capacity is organized on particular channels. You can find that information with the above mentioned listfunds command. You also have the power to share this information. Morally you should have the consent of your channel partners.

As for python: Checkout my Hack a LAPP video series or my git repo for the code of that LAPP that shows how to interact with the Lightning rpc interface.

most important lines will be:

from lightning.lightning import LightningRpc
rpc_interface = LightningRpc("~/.lightning/lightning-rpc")
print(rpc_interface.listforwards())
print(rpc_interface.listfunds()["channels"])

If you know python it should be easy to adapt to xls output


A bitcoin is divisible to the eighth decimal. The smallest portion of Bitcoin has its own name: satoshi, whereas 1 BTC = 10^8 satoshis = 100,000,000 satoshis

To be completely correct, while in popular conversation the bitcoin is the predominant currency unit, in realitas the protocol uses satoshi. You can see this when looking at raw transactions or the ledger.

Whenever you send a Bitcoin transaction, the inputs are destroyed and new outputs are created. Essentially, what happens with Bitcoin works like this: Imagine you are paying for a $5 ice cream with a $10 bill, and the $10 bill is destroyed and replaced by two $5 bills, of which you get one $5 bill and one $5 bill goes to the ice cream vendor.

I was not able to deduce what you are trying to get code for, but if you want to split up bitcoins for transactions you might be looking for more information on how to create raw transactions, as dannypaz pointed out in the comments, the Bitcoin Wiki's page on transactions may also be illustrative.


Why do dustcoin.com and coinwarz.com give opposite results of profitability?

First off, don't listen to so called "profitability" calculates they are always wrong.

and here's why:
Each "profitability" site bases the profitability based on the current block on that network vs bitcoins current block. Well most of these coins have a limited exchange volume on exchanges (some as low as 0.001 btc) yet because of that activity they are deemed to be more valuable. What happens next is a huge dump of coins and a market crash. This leads to an increase in diff and a decrease in profitability. Using that theory, you can see that these sites are not going to be correct. Especially depending on the exchange they use and the rates they use. Most coins only convert from ALT->BTC. So that means they will take the BTC/USD price from somewhere like bitstamp and then take the ALT/BTC price from the exchange of choice and finally it will take BTC*USD.

BEGIN EDIT
Simple formula these sites use

$profitability = $USDperBitCoin * $BitCoinperAltCoin

END EDIT

tl;dr
Exchange rates and exchanges used.
Low volume of trade.
Unique Difficulty filter algos on unique coins

I suggest you ask the owners of the sites this one.


Can I update my channel state with another node signing offline in person?

Yes that is possible. The channel updates are following BOLT 02 (peer protocol) and parts of BOLT 03 (transactions) and BOLT 05 (on chain). All of these things are solely negotiated between you and your peer / channel partner and could happen in an offline world or even on a sheet of paper. (not saying this would be particularly useful) I am also neglecting the regular protocol mates here that are send via the transport layer and noise protocol framework ( BOLT 08 and 01)

Generally as long as you don't have a (force) close the exact channel state is a private matter between you and your peer. This is a design principle within lightning.

Keep in mind that what you asked and my answer is only of theoretical nature. I don't think it would be very practical to actually do that in a way so that it is compatible with actual software state.


Can't we use all the mining/processing power to calculate useful stuff?

Yeah it could be it's just not the type of proof of work algorithm that was used. Some crypto-coins have since been implemented that are somewhat useful, such as Primecoin.


What is the difference in speed between a GPU and an ASIC per dollar of cost?

The AntMiner S4 gets 2 TH/s and sells for about $1200. This is 1660 MH per second per dollar.

The AMD Radeon 5830 gets 307 MH/s and sells for about $200. It was released in 2010, so if we assume that graphics cards have doubled in power every 18 months, that suggests that the best Bitcoin mining graphics card on the market today gets 12.2 MH per second per dollar.

So they're on the order of a hundred to a thousand times less powerful per dollar.

This is a generalization.


the bitcoind daemon doesn't respond to commands

In bitcoin.conf, make sure you have the following lines:

rpcuser=your-userid
rpcpassword=your-password
server=1


I don't have data on my phone, can I still send and receive bitcoin without internet?

Yes, you can receive Bitcoin even if you don't have internet, but you will only see them when you synchronize your wallet (for this you need internet).


How smart property works on basic bitcoin blockchain?

The token in the blockchain represents a physical item, the same way that a paper document may represent a contract or ownership of a house.


Two identical transactions and hashes in Block Hashing algorithm

1) Are the transactions 100% secure?

No.

  2) Suppose there are two identical transactions happening at the same time, are those transactions are going to get differentiated based on the Hashes?

Yes. It's difficult, though, because each transaction must include the hash of the previous transaction, and so on.

It used to be much easier. A while back, it was pointed out that two coinbases could have identical hashes, and so create identical transactions down the line. See also: Why block height is required in coinbase?


Is it possible for the government to censor bitcoin by blocking ports?

Is it possible for the ISPs to block these ports of bitcoin clients?

Yes, it is. It is fairly trivial for most ISP's to control ports.

  And, therefore censor bitcoin?

Not easily. It is possible to configure Bitcoin Core to operate over the Tor network. Tor itself can be configured to run even behind a fascist firewall (it has settings labelled such), although, I encourage all to only act in a lawful manner.

Similarly, it is possible to configure Electrum wallet to operate over Tor.


New address generation on exchange services

There are a lot of online tools to generate bitcoin addresses and some of them have APIs. For example Blockcypher
's one.

But usually such services have their own full node which manages their wallet. In such case they'll generate new addresses using bitcoin-cli tool.

$ bitcoin-cli help getnewaddress
getnewaddress ( "account" )

Returns a new Bitcoin address for receiving payments.
If 'account' is specified (DEPRECATED), it is added to the address
book
so payments received with the address will be credited to 'account'.

Arguments:
1. "account"        (string, optional) DEPRECATED. The account name for the address to be linked to. If not provided, the default account "" is used. It can also be set to the empty string "" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.

Result:
"address"    (string) The new bitcoin address

Examples:
> bitcoin-cli getnewaddress
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

As to the other coins, I bet they have alike tools, but looks like there is no "silver bullet" API for every coin out there.

And if you are going to handle big amount of coins, you, maybe, don't want to generate addresses via the third-party services.


Is it safe to invest $100 Million in Bitcon

I suggest you instead spend some of that on a financial planning expert.


Before GPU mining all mining was done on the CPU.


Do I need to scan the whole blockchain to determine a balance?

That is correct. This is what the optional -rescan flag does to the addresses in your wallet when launching bitcoind.

There is no balance property. Balances are just the total values added up on all unspent outputs for a given address, and the only way to determine the unspent outputs of an address is by scanning/tracing/following each output from address to address.


Problem with data redundancy in block chain

Since the copy of same data is stored on each node in network. Does it use storage space to store same data on each node?

Yes, but what matters is the validation of the data. Therefore you can use pruning to validate the block chain data without the storage overhead.

If yes then how the data is decentralised. It is just a large network of centralised database.

What can be called decentralisation in the case of Bitcoin is the ability of being able to retrieve the current state of the network without having to trust a central source of validation (/truth). This is accomplished through the validation of the block chain.


Error generate new block with signet test

You can't create blocks yourself for the global signet; it requires signatures by the parties running that signet.
You can create your own signet, though, where you yourself are the signer. The tooling around this is still a work in progress, as far as I know.


How can I check the hash of a bitcoin block?

Seems to me that you are hashing the whole block instead of header only. Take my code (in C++).

void test ( )
{
  const MyByteArray header ( QByteArray::fromHex (
     "00000020" // version
     "164a1e4a7f34b96b0e201dcc6a623c63fe3874696e4875000000000000000000" // prev hash
     "49de8b4f4bfa9fc890d3d28a93156a111f891dc680090cd497b58a7d5c2b09cf" // merkle
     "2f62345a"      // timestamp
     "edb00018"      // bits
     "ffdfd257" ) ); // nonce
  const MyKey32 key ( header.sha256d ( ) );
  qDebug ( ) << key.toString ( );
}

and the output is:

000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da


Bitcoin sent from unsyncronised (2013) Bitcoin-Qt wallet to Multibit wallet have not arrived

If you don't want Bitcoin Core GUI (Bitcoin-Qt) to download new blocks, you can start it with the -maxconnections=0 option; this should allow you to use it on any machine upon which it previously worked.

Once you have it open, go to the transactions screen and find your transaction.  Right-click on it and choose the option "Copy transaction ID":

Then open the built-in console.  Starting from the menu at the top: Help → Debug menu → Console tab

Type in the following:

gettransaction <paste>

Replace <paste> with a paste of the transaction ID (txid) you previously copied.  You can leave the weird -000 on the end of the txid in Bitcoin Core 0.11.1, but you might have to delete it from earlier versions.  Press return to get the output.

Near the end of the output should be a field label "hex".  Copy the long alphanumeric (hex) string that belongs to it.  This is the raw transaction you created encoded in hex.

Go to a transaction broadcast form, paste in that string, and submit.  For redundancy, you may want to try doing it again on a different site.  This will ensure your transaction gets broadcast to the network.

Multibit should show that it is receiving an unconfirmed transaction within less than a minute; then you just need to wait for confirmations.

P.S. if you don't understand any of these instructions, you may want to ask in the Bitcoin.StackExchange chatroom to make sure the people there agree that these are safe.  You should always be careful taking advice from strangers on the Internet when it comes to your bitcoins. :-)


If I abandon a slow to verify transaction is my wallet recredited?

To understand the situation fully, let me clarify what happens when you publish a transaction.

Upon publishing a transaction, the bitcoins do not "leave your wallet". At any given moment, a "bitcoin" exists as an address in the blockchain that has an "unspent output". Publishing a transaction simply broadcasts your intent to spend that output to a new bitcoin address, but until the transaction is confirmed (mined into a new block), your bitcoins still reside at their old address.

So, after publishing a transaction, the network's nodes will understand that someone is trying to spend an unspent output, so your wallet will not give you the ability to spend those coins more than once (there are some special cases, but for normal transactions this is the case). So it appears your coins are unspendable, locked 'in limbo', but they in fact still reside in your address, until the transaction confirms.

You can make your wallet forget about its previous unconfirmed transaction, but you will never be able to guarantee every node in the network will also forget it. If your transactoin does not confirm after a long while, enough nodes will likely forgot the transaction that you will be able to publish a new transaction to re-spend the coins.

So bitcoins cannot become 'lost in limbo', there just might be times where the network ignores a more recent transaction, in favour of another older one that that spends the same coins, and that they saw first.


What large and well known companies directly sell BTC?

We have a long history in bitcoin...

bitinstant.com

We offer many options and transaction types.  :)


Why do self-loops exist in the bitcoin transaction graph?

You are looking at transactions the wrong way. Bitcoin does not actually use addresses and their balances. The protocol has no concept of what an address is, nor does it need to. It also has no idea of an address or an account balance.

Rather how Bitcoin works is with transaction outputs. Transaction outputs are spent as the inputs to other transactions, and created as the outputs of transactions. Addresses are merely a human abstraction to quickly specify the locking conditions (the conditions that need to be met in order to spend) of a transaction output. They are not an identifier, just shorthand for an output script.

Since addresses are just shorthand for an output script rather than identifiers, nodes do not care about the contents of the scripts except when verifying that an input has met the conditions to spend the output it specifies. Other than that, a transaction output can contain whatever the user wants in the script, including invalid scripts. Outputs with such scripts just cannot be spent.

So these self loops exist because people can create a transaction which spends an output with a particular script, and then they create a new output which has the same script. Because nodes don't check the scripts, this is perfectly fine and valid.


Why are there regulations when buying/selling with USD

Every country (or other jurisdiction) can make its own laws and regulations about how Bitcoin can be exchanged for dollars (or anything else) in their jurisdiction, just like they can make their own laws about taxes, traffic, etc.  So your question as stated maybe has  hundreds of answers.

Since you mention US dollars: in the United States, my understanding is that most regulations on businesses that exchange Bitcoins come from the fact that they are considered money services businesses (MSBs).  The US Department of Treasury, through its FinCEN agency, makes and enforces regulations on MSBs, as authorized by laws created to fight money laundering.  These regulations require MSBs to do various things, such as gather personal information on their customers, report suspicious transactions to the government, and so on.

I don't know much about gold markets, so I can't really address that part of your question.  I would think that in the US, large-scale gold market participants would fall under the purview of the US Commodity Futures Trading Commission and be subject to regulations roughly analogous to those which the Securities and Exchange Commission enforces on stock traders and brokers.  My impression is that these regulations are substantially more complex than those for MSBs.  I don't think this would apply to small-scale operators like jewelry stores, but they may have other regulations to obey, perhaps imposed at the state or local level.


Accessing Bitcoin core software through a mobile phone with no internet connection

Here are some considerations and recommendations. I hope that someone can provide a more complete answer than this one, though.

First off, creating new wallet software and getting it right is deceptively difficult, even if you're starting off with a nice library such as Bitcoinj. Unless you feel extremely comfortable with Bitcoin in general, I'd recommend that you use (to the extent possible) an existing full wallet implementation with a good reputation.

On the server side, you'll probably want wallet software you can easily interface with, either by directly calling its library functions, or via an RPC interface. Here are three such options you may want to consider:

Bitcoin Core (RPC access)
Armory (RPC and Python library access)
Electrum (RPC and Python library access)

Take a look at the bitcoin.org choose-your-wallet page for a rough comparison. Please also note that the latter two are deterministic wallets; unfortunately there's less (no?) API documentation available for these two.

You should also take note that Armory has a rather broad interpretation of its AGPLv3 license—if you have a company General Counsel, I'd definitely ask them to consider this before proceeding.

On the server side, you'll need to develop your own accounting database to track individual account balances (do not use the Bitcoin Core deprecated "accounts" feature). Read up on cold storage if you don't have enough insurance to cover the loss of all of your bitcoin, and split your bitcoin between hot (on-server) and cold (off-server) wallets.

I can't offer much other insight than the above, except perhaps to guess that client-server authentication issues are likely to be your biggest potential for bitcoin loss. If you're not an expert in client-server security, or for that matter in security issues related to your chosen mobile platform(s), you should consider consulting with someone who is.


How to exchange small amounts of dogecoin to bitcoin?

One Doge/BTC exchange I know is https://shapeshift.io - but they are currently down since it was hacked last weekend. Even small amounts was working (I don't know the exact minimum since there down currently - but some hundred Doge was possible).

Maybe they will come back again in the next few days...


How can I tell when bitcoind has found a block?

If you look in debug.log, you should see a message that says "proof-of-work found".

Here is an excerpt from debug.log for a testnet block that I found.  (It was immediately orphaned; in fact an earlier block had been found several minutes earlier but had not yet reached me.  So you won't find it in the blockchain.)

BitcoinMiner:
proof-of-work found
  hash: 00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54
target: 00000000ffff0000000000000000000000000000000000000000000000000000
CBlock(hash=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54, ver=2, hashPrevBlock=00000000b96e8a2e2f27bf209a1059fd10b117cdf5a6373559eb93268853bc04, hashMerkleRoot=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, nTime=1383697696, nBits=1d00ffff, nNonce=2576125723, vtx=1)
  CTransaction(hash=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 0330f6010101062f503253482f)
    CTxOut(nValue=50.00000000, scriptPubKey=0226fe62f7b1812c421efd7638907f)
  vMerkleTree: f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50
generated 50.00
keypool keep 6
AddToWallet f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50  new
Committing 1 changed transactions to coin database...
SetBestChain: new best=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54  height=128560  log2_work=57.064666  tx=708022  date=2013-11-06 00:28:16 progress=1.000000
ProcessBlock: ACCEPTED

I believe debug.log is overwritten periodically, so if your block was created some time ago, you may no longer have this entry in yours.

Newly generated coins require 100 confirmations before they can be spent, and bitcoind apparently won't show them as spendable until 120.  See also this question.  As far as I know these rules are the same on testnet.

Congratulations on your newfound fake wealth!


When is it a good time to invest in Cloud mining?

TL;DR: Never.
Lack of Control
I don't think there is ever a good time to invest in Cloud Mining. I remain utterly unconvinced of the whole business model.
Mining itself already has an inherently slim return rate, then putting both your investment and the hardware into the hands of a third party that wants an additional cut seems counterintuitive. With regular mining you can at least switch the pool when you are dissatisfied, with Cloud Mining you make yourself a hostage to changing circumstances.
Scams in the space
Definitely have a look at Cloudmining 101 (ponzi risk assessment). There are a lot of scams in the space.
Buying bitcoins directly may be better
A lot of people interested in investing into Cloud Mining point out that it may be a profitable investment if Bitcoin prices rise in the future.
Under the expectation of rising prices, the reader should consider the value increase of the same investment directly into bitcoins instead, though.

Also see this related question: How do cloud hashing companies profit? (leasing hashing power).


What is the economic value of Litecoin? Is it simply a subdivision of BTC?

The major difference between litecoin and bitcoin is the hashing function. Bitcoin uses SHA-256 while litecoin uses scrypt. scrypt "is designed to be far more secure against hardware brute-force attacks than alternative functions" [1]. By hardware brute-force attacks they basically mean ASICs such as the ones coming out of butterfly labs. For instance the advantage that GPUs have above CPUs when mining litecoins is much much smaller than the advantage they have for mining bitcoins. It may well be that at some point ASICs will be made for litecoin, but the creators of litecoin specifically chose the hash function to make that happen as far in the future as possible.

The other differences are trivial, but it may be nicer to have confirmations come in faster. The only real difference to having blocks made faster will mean that transactions will sit at 0 confirmations for less time. However still the absolute number of confirmations a transaction is not what makes it safe, but rather the amount of computation that has gone into making those confirmations.


Importprivkey problem for Litecoin clone

It seems like you are trying to import an address with importprivkey, which is absolutely incorrect. An address is not a private key and thus cannot be imported with importprivkey. Addresses have different data and will have different prefix letters than private keys. Looking at your code, the prefix for private keys will be 2 and those should be able to be imported into your wallet IF they did not already exist in the wallet (i.e. import to another wallet). This has nothing to do with your address prefix.


What Bitcoin Mixing/Laundry Services are availble today?

The only one I'm currently aware of is "Bitcoin Laundry" operated by Mike Gogulski. They charge a 4.555% commission rate and do little more than accept a payment then re-send a payment. There is also (according to the Wiki) that the service is only lightly used and might not be adequate to provide any real anonymity. You might be better sending then withdrawing coins at Mt Gox with a decent delay between transactions - the sheer volume of Mt Gox's transactions as well as the size of their wallet would make them much more effective and there's nothing I'm aware of to stop you from creating an account with a throwaway email address and accessing Mt Gox through TOR/I2P/etc.


I have read many times that bitcoin is a public blockchain. Why is that?

The whole point of bitcoin is that anyone can verify it, it's supposed to be trustless. If transactions were private, how could you trust anyone claiming to have BTC? How could you trust that BTC being sent to you in fact exists, instead of the sender just making up a transaction spending outputs which never existed? That's why all full nodes verify all transactions since the genesis block, to ensure all bitcoin being sent are legitimate.

A separate blockchain is possible but perhaps not in the way you think. It's possible to use sidechains or second layer networks like Lightning, but to make a separate blockchain itself would be to create a new currency completely, it would be an altcoin not bitcoin


Addresses/keys formats are the same and behave the same.  If you have the private key for the destination address then you still have access to the funds, regardless of if it's BTC or BCH.

The issue is if you send BTC to a BCH address (or vice versa) that you don't own (e.g. transferring to an exchange) since the exchange won't look for the tx on the chain you claimed to have sent it on.


Two identical R value finding z value from two transaction

calculating z1

  replace the input with the corresponding output script

This is the step where you made a small mistake.

The UTXO that's being spent is from txid 9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280 which contains two txouts. When you did the script replacement, you chose txout #0 (with a hash160 of cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d), but the tx being signed is spending txout #1 (with a hash160 of 09a4cb092dc30da1354369fc78f482365ce2767a).

Doing the replacement with the correct txout script results in this, which hashes to the z1 value you were expecting:

010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000


What is the difference between accounts and adresses?

A Wallet is a collection of Accounts and Addresses.

An Account is an arbitrary basket of Addresses. Transactions originating from and going into one Account will be kept separate from other Accounts (unless you use a move command, which moves the balances around without creating new transactions).

Address is the only part of this that is visible in the Block Chain.


How can I recover dogecoins sent to a Bitcoin address?

Even though the address format is different (the prefix part) the transaction is valid so there will be a transaction on Dogecoin blockchain to the address.

I found a reddit thread where they suggest to save your private key in the Bitcoin client and import it to your Dogecoin client, although it is not certain this will work, I think this is your best chance, as transactions are irreversible by design.

In the original Bitcoin Core client you export in the debug window (based on this and this):

click on 'help' in the menu bar (top right)
click on 'debug window'
select the 'console' tab type: walletpassphrase "passphrase here" 600
type: dumpprivkey [address here]

Then to import navigate to the same window in Dogecoin client and

type importprivkey [private key here]


blockchan.info payment processing, how long?

I've had the same issue. Sounds like you are using blockchain.info's receive payments API. This is a free service they offer where BC.info even pays the transaction fee. The payment forwarding used to be almost instant, then it went down to one confirmation. Sometime over the last month or two during the "stress tests" and the SPV mining fork it is taking about 24 hours before the transaction is forwarded.

Is this permanent? I don't know, but I suppose there has to be some take-away when you use a free service.

If you are looking for an alternative I suggest you try blockcypher. However with blockcypher they do not pay the transaction fee, so the receiving address will receive 10,000 less satoshis as a mining fee on every transaction.

http://dev.blockcypher.com/#payment-forwarding


Can one trace a criminal with his Pubkey?

Knowledge about his addresses and transaction history will be sufficient to discover addresses with which he made deals. His Private key will not help. This is the consequence of public ledger.

The different case is with deterministic wallets. When you know master private key/ mnemonic seed you can check all derived addresses, even the ones you have no previous knowledge.


Why is blockchain.info allowed to have an iOS app but coinbase is not?

Probably because blockchain.info is just a wallet whereas coinbase actually allows you to buy and sell bitcoins. Exchanging one currency for another (where one is only loosely labeled a currency by the government) is where you get into sketchy regulatory waters. I imagine these are the types of problems apple would like to avoid.


Why do miners seem to be using consecutive letters for the Coinbase transaction text?

According to BIP 34 the coinbase transaction is required to start with the block height.  The format is a single byte giving the count of bytes to follow (currently 3) and then the block height in little-endian. See Why block height is required in coinbase? for more on the rationale.

478529 decimal is 0x074d41 in hex, so this block's coinbase must begin with the bytes 0x03 0x41 0x4d 0x07.  0x41 0x4d happen to be the ASCII codes for the letters A M.

Likewise, 478530 decimal is 0x074d42, so we start with 0x03 0x42 0x4d 0x07, and 0x42 0x4d is B M.


How i can delete last block from blockchain? altcoin

You can't delete a block, just mine a new block on top of the previous block, creating a fork. Just reference the parent block as the parent of your new block, and if you mine more on top of your new chain, it will become the accepted chain.
The age of the block shouldn't matter.


You cannot.  The mining functionality was removed in version 0.13.0 since it was hopelessly inefficient.  See Since which version the mining functionality removed from wallet?

It is not practical to mine Bitcoin without recent specialized ASIC hardware.  See In the ASIC-age, is it worth starting mining Bitcoin at home?


What is the cheapest way to deposit money into a Bitstamp account from the US?

I spent a long time researching this very question a while ago before buying my first bitcoins thinking that Bitstamp is the cheapest way to buy bitcoins (fee wise).  I ended up concluding that the cheapest way to deposit money in a Bitstamp account from the United States is with Ripple, which allows you to bypass the $15 wire transfer fee that it would cost to transfer money the old fashioned way.  However, I ended up going with Coinbase to buy my bitcoins rather than doing this.  I'll explain why:

In order to buy bitcoins this way using Bitstamp, the process is rather convoluted.  That alone is the first reason.  The second reason is that once I added up the fees, it was actually more expensive with bitstamp because you're not just paying Bitstamp's fees, but also the fees to transfer money into Ripple.

If you still want to do buy bitcoins using this method, here's how.

1) Setup a Ripple account.
2) Fund it with SnapSwap.  Fees:0.99% + $0.30.
3) Send the money to Bitstamp using Ripple.  The deposit money page when you're logged into Bitstamp will have the Ripple address to send money to in order to fund your account.
4) Buy bitcoins with the newly funded account.  Fees: 0.5%.

Cumulatively, the fees add up to 1.49%, excluding the $0.30 fee.  The fees that SnapSwap tack on negate the advantage of the relatively low fees that Bitstamp uses.

So if you're looking for a cheap exchange, since you live in the United States and thus cannot use SEPA, Bitstamp unfortunately probably won't work for you.  Here are your other options:

CampBX.  An Atlanta based exchange that has a fee of 0.55%.  As far as cheapest way to buy Bitcoins in the United States, this is probably your best bet.  Their website appears to be down right now, however.
Coinbase.  Not the cheapest option, but it may just be the easiest option.  That's why I choose Coinbase, I got frustrated with the hoops one has to jump through to buy bitcoins on other exchanges.  Coinbase has a 1% fee plus a bank fee of $0.15 when you're buying and selling bitcoins, the real advantage is that as far as I've been able to tell, they're the only ones that let you buy bitcoins with an old fashioned bank transfer.  The price is locked in at the time when you buy bitcoins, and you get them five business days later.

Alternatively, if you live in an area where people are selling bitcoins in person, you can buy bitcoins directly from someone who already owns them.  Localbitcoins.com is the place where you can check to see if anyone near you is selling bitcoins.


Why can't I create a fork of BTC that has no difficulty changes so I can premine the rest of the coins?

Depending on what you meant to ask, the answer is one of the following:

If you run a Bitcoin-qt fork which is incompatible with the rest of the network, you're running a separate currency which has no value (because no one else accepts it).
If you ignore blocks and forge historic timestamps to create a branch with more blocks of low difficulty, it will not be chosen over the main branch because the choice is made based on total difficulty, not number of blocks.


How should webapps handle addresses/wallets?

bitcoind has a feature named "accounts" which does exactly that: handles the balance in separate accounts, which you can map to your users. It automatically generates new addresses for the accounts, can move coins between accounts, etc.

Obviously you must take great care into keeping it as secure as possible.


What prevents bitcoin from breaking down in case of a "transaction attack"

There are rules which make such kind of attack very costly to the attacker. Below are relevant rules from wiki, with updated transaction fee:

0.0005 BTC fee per kilobyte of transaction, but:

If the blocksize (size of all transactions currently waiting to be
included in a block) is less than 27 kB, transactions are free.
If the blocksize is more than 250 kB, transactions get increasingly
more expensive as the blocksize approaches the limit of 500 kB.
Sending a transaction when the blocksize is 400 kB will cost 5 times
the normal amount; sending when it's 499 kB will cost 500x, etc.

Let's say attacker publishes 499kB worth of transactions every block, this would be about 1000 transactions per block, 144000 per day. This is nowhere close to millions or billions, and besides it would cost him about 18000 BTC per day.

Source: Transaction fees


In the Bitcoin blockchain, each block has a 32-bit field called version. Right now, it takes on simple small values like 2 or 3.

As an example of changes, block version 3 introduced new rules about transaction validity, as well as anti-malleability measures. Miners with the new Bitcoin client create blocks with the version set to 3 to signal their capability to other network participants. Once enough v3 blocks are mined, the Bitcoin clients start enabling their incompatible (potentially fork-causing) new features, and also reject blocks with versions below 3.

The version bits proposal is a generalization of this concept. Suppose someone proposes an incompatible feature X and wants to see if they can gather support for it. They somehow agree on which bit to use in order to show support for this feature, and compatible clients will mine blocks with this bit set to 1. To fabricate an example as an illustration:

Version field: 00001000 00000000 00000010 00000000
                   ^      ^            ^
                   |      |            Supports large blocks
                   |      Does not support infinite inflation
                   Supports cat emoticons

This allows multiple features to be proposed in parallel rather than sequentially.

The rest of the article talks about consensus, recycling old bits, and other related pragmatic considerations.


How can I transfer the last little bit from my Bitcoin Core wallet to Armory?

Re: Bitcoin-QT Core

Your balance showing in BTC may not be the actual amount; is the Blockchain fully synchronised?
Your BTC may be spread over several private keys ie addresses in your dat wallet
The floating point value may be being rounded to an integer (ie 0.000297 may show up as 0.0003)

I'd go about it like this:

Open options under BitcoinQT settings;
tick "display addresses in txn list" &
"display coin control features"
Wait for Blockchain to synchronise
Open 'Send' tab

tick Coin Control Features; inputs
choose the input addresses with BTC in them

Fill out Sender address, etc
Right click the total BTC being sent; choose copy amount to send after txn fee
Paste this figure (BTC being sent minus txn fee) into the Amount box at the bottom
Send to your new address; leave Bitcoin-QT open so it can relay the txn


keypoolsize only shows how many keys are currently in the keypool. It does not reflect the maximum size of the keypool. The keypool=<n> option does not automatically fill the keypool to that size, you will need to refill it by using keypoolrefill.

If after keypoolrefill you still do not see a larger keypool, then that means your bitcoin.conf file is either named incorrectly, located in the wrong location, or formatted incorrectly.


Is Bech32 transaction on blockchain.info size accurate?

Your transaction size calculation is incorrect. The inputs are 1 byte input count + 36 byte output + 1 byte scriptSig + 4 byte sequence + 1 byte witness stack count + 1 byte signature length + 71 byte signature + 1 byte pubkey length + 33 byte pubkey = 149 bytes for all of the input data. That along with 32 bytes for output, and 10 bytes for the rest of the transaction gives you a transaction 191 bytes in size.

So, blockchain.info correctly calculated the serialized size of your transaction. However that size is not the one that miners use for computing the feerate of a transaction since segwit data is discounted. Rather what they use is the fee per weight unit, which is the 34.526 sat/WU value that blockchain.info displays beneath the fee per byte feerate.

It's likely that whatever wallet you were using was using virtual bytes (vbytes) instead of weight units or actual bytes. Virtual bytes is just the size of the transaction but applying the segwit discount to the segwit data in the transaction. Your transaction is 110 vbytes, which gives you a feerate of 137.16 satoshis/vbyte. It's possible that when you told your wallet to use a 120 sat/byte feerate, it actually used a 120 sat/vbyte. However, when the transaction was actually made, the change that would have been left over from targeting that feerate would create a dust output, so it was rolled into the fee itself thus increasing the feerate that was actually paid.

  Do miners take my transaction as I paid 120 sat/b or 78 sat/b?

Your transaction has already been confirmed.


Yes, incoming connections must be allowed through port 8333. If your VPN provider allows port-forwarding, it should be configurable in your account settings.

See: https://bitcoin.org/en/full-node#network-configuration


Does a Block contain the list of transactions? Or only the Merkle Tree?

You cannot obtain a list of transactions from the merkle tree.

The merkle tree root is part of the block header, which as you said, allows quick verification of the proof-of-work.

After the block header, each block contains a list of serialized transactions in the order they appear in the merkle tree. A complete block is a block header + list of transactions.

When validating a block, nodes will check:

The proof of work (this can be done with just the block header. However, just because the block header validates, it does not mean the block is valid)
The merkle tree - Nodes will take the list of transactions and reconstruct the merkle tree to ensure the root matches what is in the header
Each individual transaction - Individual inputs and outputs are validates to ensure they meet network rules, and that no double spends exist.


How do you reliably estimate mining fees?

TL;DR: you don't, you enable RBF and adapt the transaction fee to the block space market (or use a wallet that does).
Best effort(s)
First of all, in order to be reliable the estimation must not be game-able by miners (or at least, most of the estimations must not be).  Therefore it must not be mempool-based (such as the electrs additional implementation, or by looking at Johoe's before making a transaction).
In this sense, the Bitcoin Core fee estimation (block chain based) is the most reliable.
Secondly, reliability is expensive. It can be measured by the statistical probability to get confirmed in less than N blocks. And by this metric, the most reliable method is again Bitcoin Core's.
Finally, i think you are interested in the most optimal estimate: that is both reliable (you are going to be confirmed before your target, and for the cheapest possible fee).
But such an estimate does not exist: the block space is a free market and no matter the statistical reliability of your estimate, if someone wants to fill the blocks up to your target with megabytes of high-fee-paying transactions, they just can.
A guess isn't reliable
Since you cannot reliably estimate transaction fees, you need to adapt your price to the market. However you will only witness the market actions after broadcasting your transaction. This is the reason behind Replace-by-fee (you need a way to bump your fees post-broadcast).
But RBF is opt-in, you need to enable it before performing a transaction. In case you already broadcasted your transaction, you can fall back to CPFP (spend the unconfirmed output with a second, high fee paying, transaction that pays for both --example with Electrum).
Conclusion -- what should i use?
It depends on your usecase.
If you are an occasional onchain user, you can afford the game-able and less reliable mempool estimations (see for example https://bitcoinqueue.com/#0,24h or the friendlier https://mempool.observer/).
If you are building an application, prefer Bitcoin Core's block chain estimations as:

For users reliability often outweighs cost (stuck transactions really aren't fun).
With a larger sample of transactions, statistics are on your side.
If all applications start relying on mempool estimations and fees continue to rise it becomes attracting for miners to collude :)

In both cases, when possible start with a lower estimation, enable RBF, and bump the fees as you are approaching your desired target without being confirmed.