What are the trade-offs between the different algorithms for deciding which UTXOs to spend?

When someone would like to make a transaction, their software has to choose which of their UTXOs to spend. Here are a few different ways that one might prioritize which UTXOs get spent.

  • Oldest UTXOs first
  • Newest UTXOs first
  • UTXOs with the smallest amounts first
  • UTXOs with the greatest amounts first
  • The Core Client Selection Algorithm: What is the coin selection algorithm?
  • Others?

What the trade-offs are for the different ways of prioritizing spending of UTXOs? Are some faster? Do some make make the block chain less big (grow less quickly)? Do some make the UTXO set smaller? What about making it so that the user has to pay the least fees? Taking all these factors into consideration, is there a method that is generally accepted to be the best way?

On possibility, which I like, is to spend the most UTXOs possible while still staying in the 1kb minimum fee limit. That way if nodes that prune the blockchain of STXOs (spent transaction outputs), they can prune more and it makes the blockchain smaller for them. Although, this might cause a small amount of bloating for nodes who keep the whole block chain, so it’s a tradeoff.

Bitcoin RPC getbalance of address I sent coins to on regtest

Here is my terminal session:

$ echo $address
mvt7M16caMH1xoJyfWU5orjArfq97jhZ7k
$ bitcoin-cli -regtest getbalance
5899.99990000
$ bitcoin-cli -regtest sendtoaddress $address 10.0
6ed7452f8f11fe25904867b57e127a6b65cb180c2013e667e3d399c4179ff1f0
$ bitcoin-cli -regtest setgenerate true 1 
$ bitcoin-cli -regtest getbalance $address
0.00000000

Shouldn’t the balance of this address be 10 now? I thought that by generating a block, I will have that transaction included, which will show up on the addresses balance?

What is the alt stack?

I noticed in the bitcoin wiki script page (https://en.bitcoin.it/wiki/Script) that there were two opcodes named:

OP_TOALTSTACK
OP_FROMALTSTACK

It looks like there is another stack that can be used separately as a data store, simply pushing and popping data. I’ve never heard of this before, but it seems like a very useful feature.

Can anyone verify that this is what the alt stack is actually meant to be used for? If not for just pushing and popping data, what is it for? Do any specific use cases come to mind?

Difference between bitcoin-tx, bitcoin-cli, and bitcoind?

I just pulled from the bitcoin github and compiled, and noticed that there were three executable generated:

bitcoin-cli  bitcoin-tx   bitcoind

I have not heard of bitcoin-tx before, what is it? What are the main similarities/differences between these three executables?

In addition, I would be interested to find out if there are any plans to further develop these into different, complementary, executables.

Thank you!

How do I query a remote bitcoin node like RPC?

I know how to query the blockchain stored on my machine programmatically using bitcoind commands. Is it possible to do the same on a public node?

For example, is it possible to send “getblockcount” over the internet to bitcoinstats.com, hard-coded in the bitcoin source, or to inductivesoul.us, found in the bitcoin.it wiki? What are the steps to do so?

Edit

The quick answer is:

  • No, you cannot use bitcoind commands.
  • You have to communicate with a remote node using TCP.
  • You have to use a different set of commands found in the Protocol Specification.

Pros/Cons/Limitations of Mnemonic Phrases – BIP39

BIP39 mnemonic phrases replace considerations about how to store one private key, with considerations about how to store the seed to a series of private keys.

The idea is that the private keys are hard to remember, worse to write down, and prone to discovery when stored digitally, so the solution is that you can have a phrase of words that act as a seed to a hierarchical deterministic series of addresses.

It seems like this idea has been lost in translation as the phrase length of mnemonic phrases has increased from 12 words, to 24 words, with the “more secure than thou” using even longer words and phrases, and security minded companies alike promote writing down the mnemonic phrase, in multiple places.

or splitting the phrase, or putting an additional passphrase on top of the HD sequence, or using Shamir’s secret key…..

all of which simply create more points of failure.

Ultimately: instead of one paper wallet compromising one private key, your paper phrase will compromise ALL of your private keys. OOPS. or you forget the secret key, or you lose a piece of the phrase, or you misspell it

At least we can be confident that the words themselves contain enough entropy to prevent guessing, RIGHT GUYS? RIGHT?

What are the pros, cons, limitations of BIP39, or at least my concerns. I have read the wiki and the github markdown on BIP39, and these do nothing to alleviate these concerns because these BIPs are a centralized process

How can I read chainstate database?

1) What is the format of the LevelDB databases stored in the database directory?

I know there are some custom blockchain parsing libraries, such as this one, but I’m wondering if I can just do a read of the chainstate database to get some basic information about the UTXO set.

2) Is there some sort of a LevelDB database explorer GUI that I can use to see what’s in this database?

3) Could I have a second program that just read from this database? Would it be safe or would I mess up the database if I tried this?

How did Satoshi manage to mine so many bitcoins being the first user of the system?

I’m just learning about Bitcoin and if I understand its conception properly, mining bitcoins means validation of transactions by computing a hash which should satisfy some preset condition. In other words, mining == servicing network and getting money for it.

If Satoshi was the first user, how did he earn his bitcoins if there were no transactions?

I understand, that in the very beginning some geeks were involved in the network, so maybe 5 or 10 persons’ (first testers) transactions and their validation (mining) generated a lot of bitcoins, because of the low difficulty and high reward. But how did the very first coins get rewarded?