Bitcoin core txindex option - does it take argument or not?

This is my interpretation from looking at the code.

First, -txindex is parsed, defaulting to false if it doesn't exist.

The argument is to -txindex interpreted as a boolean, which assumes no argument is the same as a true value (or else a non-zero argument is true).

So you do not need to provide an argument to -txindex, but if you do, it should be non-zero.

Don't provide -txindex: don't index
Provide -txindex with no argument: do index
Provide -txindex=0: don't index
Provide -txindex=1 (or any other non-zero value): do index.


How to run the bitcoin client so as to only accept blocks?

I believe what you would like to run is an SPV client.  If you are running a full node, such as Bitcoin Core, you wouldn't want to only get updated blocks without transactions.  The point of running a full node is to independently validate the blockchain.  Blocks can't be validated without knowledge of the transactions in them, so full nodes need to receive both blocks and their transactions in order to independently validate the blockchain.  Otherwise, your client would never know if a block contains an invalid transaction (such as more bitcoin in its outputs than inputs).

UPDATE:  As suggested in the comments by Pieter Wuille, the -blocksonly command line option (https://bitcointalk.org/index.php?topic=1377345.0) can reduce the bandwidth significantly.


Where is the code which rejects transactions with insuffisent balance?

Below is the code that checks that the inputs consumed are greater than the output

const CAmount value_out = tx.GetValueOut();
if (nValueIn < value_out) {
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false,
        strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(value_out)))

You can find it here.


Why are coinbase transaction outputs greater than reward?

The extra 0.25058085 BTC is the sum of the transaction fees on the block (each transactions fee is the difference between the value of the transaction's inputs and the transaction's outputs).

As you can see, this block which had no transactions on it, and therefore no transaction fees, had a coinbase transaction whose sum of outputs was exactly equal to the reward (50 btc at the time).


Currently the most popular method is to use something like pywallet to export your public/private keys and simply generate a text QR code for them. Typically separate QR codes are generated for the public key and private key so that one code may be used to receive payment without giving away the private key which allows spending from the account. There are some alternatives, however, depending on your paper wallet needs.

Casascius' Bitcoin Address Tool is an excellent way of saving bitcoins in an easy to recover format. Though it doesn't yet support QR codes it does have the ability to generate a paper wallet from any passphrase. Once generated you could store the public and private keys as QR codes using any of a number of applications or online generators. Additionally, you could store the passphrase in a QR code and use it to recover your addresses at any time.

I specifically suggest this as opposed to simply exporting keys with pywallet and QR-ing them because this method would let you store more than one wallet address using a single QR code since any passphrase can generate up to 999 addresses deterministically in such a manner. Of course having a simple public key in QR code form also lets you scan the address with a smartphone or computer to send coins, so ultimately the solution depends on your usage.


Why does the block explorer show a different fee rate than what I selected in my wallet app?

Feerates on the Bitcoin network are expressed in sats/vbyte (where vbyte is bytes, but taking the segregated witness discount into account). blockchain.com shows sats/byte (where byte refers to the actual number of bytes used to serialize the transaction); this metric is meaningless for fee estimation purposes.
blockchain.com doesn't show sats/vbyte directly, but you can compute it from the sats/WU that they do show (1 vbyte = 4 WU, so N sats/WU means 4N sats/vbyte).
I recommend using a different block explorer (or none at all; your own wallet will tend to give you more correct interpretations, without needing to trust a single site).
See also: https://murchandamus.medium.com/psa-wrong-fee-rates-on-block-explorers-48390cbfcc74


Blockchain as a way to host truly free social website like reddit

You're looking for Freenet, a p2p plataform which is only different from your idea in the fact that, to avoid wasting disk space, Freenet deletes old and unpopular content.


error message : "com.googlebitcoin.core.ProtocolException:Peer does not have a copy of the block chain"?

ok, so this problem resolved itself. I think the main reason it occurred was because the transaction fee was to low.

So there should be more information out there regarding the fact if the fee is too low payment will get delayed by two whole days ?

or

Maybe it was because I held on to Hive on my desktop ?


I have been scammed 6 months ago

Then criminals expect you to be gullible and foolish. You are a prime target for them. So they'll try new ways to trick you.

BTC REFUND DEPARTMENT

No such thing.

synchronise my wallet with the address

They want to fool you with a watch-only address, where your wallet shows an amount of money that belongs to someone else not to you. Addresses are not secret. Anyone can add any bitcoin address to their wallet but that doesn't give you any control over money.
Bitcoin wallets do not actually contain money. Wallets contain a secret number called a private-key that a wallet can use to control money. Importing an address doesn't give your wallet this secret number.

the amount is under my name

That's not how bitcoin works.
Some businesses that sell bitcoin might ask buyers to set up a named account but that's outside the real Bitcoin system.

hi is asking 10% of the amount to be added

This is often called "advance fee fraud". Don't be tricked. There is never a need to pay any fee to release money. If there were, it could just be deducted from the amount being returned, you wouldn't have to pay it first. This is a favourite trick of confidence tricksters.

Is this true or is just another scammer

It's not true. It is just another scam.

See also answers to questions about

watch only addresses
non-spendable addresses
fraud (Bitcoin)
scams (Personal Finance)


Why the "Unspent Transaction Output Set" is called "UTXO", not "UTOS"?

That seems to be a typo. Unspent transaction outputs are usually called UTXO's (Unspent TransaXtion Output).


What mathematical tasks can an ASIC perform?

Only the exact task they were designed to perform,

  Do they have to be targetted specifically, or will the host machine naturally offload mathematical processing tasks to the ASIC?

They have to be targeted specifically.

  If ASICs need to be targetted specifically, how does mining software target the hardware capabilities of an ASIC?

The ASIC is specifically designed to mine and provides an interface for the mining software specifically to tell it what to mine and to read back the results of its mining.

ASICs, essentially by definition, cannot be repurposed. The whole advantage of an ASIC is that it s totally and completely optimized for a single task and no resources are wasted on the ability to do other things.

For general purpose computing tasks like you're describing, you want a modern CPU or GPU.


This has several downsides for the exchange:

It's complicated. The best the exchange could do is to offer both the way it's currently done and your way. Users will hear that your method is to their advantage and attempt do to it your way. Many will find it too complicated and use a different exchange or lose interest in acquiring money in bitcoin altogether.
The exchange now has to maintain 2 systems. More diversity means higher development costs, more personnel training, more maintenance, and more error-proneness. Overall higher expenditures and more ways to fail.
Users will think their money is now at the exchange and delete their wallets. If it sounds stupid to be done and can be done by users, it will be done. The exchange then has to explain to the users that their money is gone and there is nothing they can do about it. Which is also part of the next point.
There will be more support requests.
It takes control away from the exchange. Right now, if someone jumps off, the exchange still has the money and give it back to the other person. In your system, the exchange has to explain to the other person why the deal can't happen. This can cause trouble in some jurisdictions as the exchange may be the legal trading partner for both.
Right now, exchanges have a lot of funds deposited on their systems. If a user never accesses their account any more for whatever reason (bus factor, user forgets about it, etc.), that's effectively profit for the exchange.
Entities equipped with a lot of money have a tendency to gamble with it. That's not possible if you can't move the money around.

Put together, the disadvantages aren't worth the benefits which basically only consist of making a few users a bit happier.

Besides, if the exchange goes bankrupt, the money you have in a multi signature wallet shared with the exchange probably will be regarded as part of the insolvency estate anyways because you put it there with the intend of giving it to the exchange and that intent is probably all that counts (depending on the jurisdiction, of course, and I'm not a lawyer) so you probably have to agree to only get part of your money back anyways in order to get at least some of it back.


You need to add the rpcallowip setting to your bitcoind.conf file.

You can use a single IP or allow all. for example

rcpallowip=192.168.0.2

or

rcpallowip=*


Security advise on setting up a gambling Bitcoin site

Using Bitcoin means using maximum security

You can cut corners but you need to understand that by doing so you are introducing risk into your business model. These risks include, but are not limited to:

private key theft by malicious administrators
cracks through known vulnerabilities in virtual machine implementations
cracks through weak operating systems (use a secure Linux distro)
theft or confiscation of hardware (data centers may take your stuff)
domain name seizure (ICANN can and will)

To reduce the risk involved you need to isolate your Bitcoin code from your public-facing web code as much as possible. This usually means having your own dedicated hardware under your physical control. Often this means a machine in your basement with a dedicated VPN and static IP address.

Make sure that only the "float" part of your balance is accessible to the server in a hot wallet. The rest should be in an offline cold wallet requiring manual access to free up the funds.

Remember: Bitcoin is money. Take the same precautions that you think a casino would take then go the extra mile.


I suggest that you buy a hardware wallet, such as ledger or trezor.
Those wallets are compatible with a wide range of cryptocurrencies. If they do not provide support to a coin, that coin is not worth buying.


How to estimate the amount of transactions that belong to exchanges?

Not easily nor with any guarantee of accuracy. Since exchanges use unique addresses for each deposit, it is very difficult to know what addresses are under their control until they actually move the coins. Without knowing what transactions belong to exchanges, we can't know how many transactions are being made and how much is being transacted.


According to the Wiki:

VirVox accepts NETELLER and Moneybookers
Bitcoin.de accepts Moneybookers

You could always approach high-rep users and ask them to do exchange with you at some rate favourable to them, and also letting them send you Bitcoins only after some time after which chargeback would be impossible. This way you risk little (high-rep users can generally be trusted), and you will get your positive reputation started.


Are there different ledgers in the bitcoin network?

No, there is only one blockchain which is Bitcoin. There are no different versions or different blockchains that other people are using that are also Bitcoin. Such things do not exist. Such other blockchains that are forked from Bitcoin are not Bitcoin but rather altcoins.


How do I unlock, decrypt, Bitcoin wallet?

Close Bitcoin
Find your wallet.dat
Rename to wallet.old
Start Bitcoin
Copy the address from the new empty wallet
Close Bitcoin
Rename (new) wallet.dat to wallet.new
Rename wallet.old to wallet.dat
Start Bitcoin
Send all your Bitcoins to the copied address from new wallet
Enter your password
Close Bitcoin
Rename wallet.dat to wallet.old
Rename wallet.new to wallet.dat
Start Bitcoin
Your new wallet should now be unencrypted and all old addresses gone.

This solves both your problems.


I do not mean to sound rude (and i am not trying so I apologize if i come off as such). But you need to read some more documentation and learn the basics of bitcoin.
This page is a really good place to get ideas https://en.bitcoin.it/wiki/Running_Bitcoin
Tt tells us that we CAN use the -qt version of bitcoin to allow json-rpc by adding a line to the bitcoin.conf file

the bitcoin.conf file is usualy located

/Users/username/Library/Application Support/Bitcoin/bitcoin.conf

Add this line to the bitcoin.conf

server=1

Now the reason it is 1 versus 0 is because we want it on.

Also you need to add a username and password for your rpc connections

rpcuser=insertuserhere
rpcpassword=passwordgoeshere

Also did you take a look at the documentation for building headless bitcoin before starting? I do not know if there is a bitcoind binary build for macosx

The osx build instructions and notes readme available here runs you through the steps.
https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md

Also, for development purposes xampp is fine but please do not use it on a production device, it is riddled with security flaws and holes. And if you do not decide to listen to my advice, let me tell you the story of how 150 btc were stolen by my lack of security. I used xampp and i used drupal. i used the security methods described for both. but there was a security flaw that was undiscovered at the time and poof it was gone.
if you MUST HAVE xampp then please for satoshi's sake harden the server as best you can
https://security.stackexchange.com/questions/15310/securing-firewalls-for-xampp-on-mac-os-x

Please let me know if i can help you more. I am more than glad to spend some time running through code. and helping some basic trouble shooting. but my warning: Be careful and do EXTENSIVE testing before you start using bitcoin out in the "Wild Wild West" aka the WorldWideWeb - Many people have such insecure set ups that it is a shock more funds are not stolen. Remember, bitcoins are money, every hacker will want money.

Thanks again for reading, good luck. Keep in touch


Holding all your money in one address = Paper wallet?

There's definitely a certain danger to it. According to this book http://www.totalbitcoinsecurity.com/ there are two easy ways to improve its security:

Why put all your money in one paper address? You can split it up and put it in several paper addresses. This makes each address a less attractive target.
You can use BIP38 to encrypt the private keys. If somebody steals your encrypted private key he'll still need to know the passphrase. This is slightly related to two-factor authentication: in order to access the wallet, you need both the private key (typically stored in paper) and the passphrase, which you could remember or write down somewhere else.

Disclaimer: I have no relationship to the cited book. I simply read it last week.


There is no danger in providing your Bitcoin address.

For sites that use inputs.io, certainly you have to provide some way for them to know which account to credit. The security of that account depends on the strength of your password, and how much you trust inputs.io.

A more fundamental problem with these faucets is that they are a complete waste of time. The ones I've seen offer .00001 BTC for looking at an ad, solving a captcha, and entering your account info. This takes 30 to 60 seconds. At current exchange rates that is roughly 10 US cents per hour, about 2 percent of minimum wage, for perhaps the most boring work I can imagine.

It's also not a good way to just pick up a few satoshis to start playing with the system, because thanks to aggregators like inputs.io, you typically cannot get your coins until you have earned BTC .0005 or so, which would take about an hour. Totally not worth it.

In short, I think if it were a scam, they should be offering much better bait.


Why on bitcoin client sender address is 'undefined'


Is the Bitcoin protocol secure if two parts of the network have no connection?

The direct effects of the netsplit

Miners in both the European network and the American network will continue to find blocks and validate transactions in their respective network part. However, until the difficulty will be adjusted, the validation will be slower, because the difficulty was set for a greater mining power than is available in each part of the world.

Let's assume that

2/3 of the mining power are in the Americas and 1/3 is in Europe
the hashing power remains constant (simplification) for the time of the network split
the network was operating at a previous block interval of 10 minutes in average before the split

Then the Americas should find a block every 15 minutes and the European network should take 30 minutes per block after the split. When the difficulty adjustment block is reached, both networks will return to creating blocks every 10 minutes in average. However, up to the adjustment the Americas will be twice as fast and thus their blockchain will be ahead significantly, specifically one and a half blocks for each block that had to be mined until the difficulty was scheduled to be adjusted.

John can spend his money again

When John goes to the Americas, the transactions sent in the European network have not been taken into account there. His wallet thus will still allow him to spend all the bitcoins that he had before the netsplit. He can now cheat Henry out of the money: John decides to send all the money to another of his own addresses.*

Reconnection: Shorter blockchain will be invalidated

Now, when the connection of the two networks is reconciliated, the American network's blockchain is longer (i.e. the total difficulty of the mined blocks is greater). All blocks in the European blockchain mined since the network split will be rejected by the American network, the European miners will retroactively lose their mining gains. The transaction John did in the Americas takes precedent, because it is part of the blockchain there and the transactions of the European network are just now readmitted to be validated by the global network. John's balance had already been sent to his other address, so the transaction that now tries to send the bitcoins to Henry is thrown out as invalid.

Alice, who had sent money to Bob in Europe, will see that her transaction (along with all others that were only seen in the European network) will go back to being unconfirmed in the new global blockchain (that is based on the longer American blockchain), because the block that had validated it in Europe has been obsoleted. The transactions that had been sent in the American network don't see any effect.

The global network will now find a new block every 6.67 minutes, until the difficulty is readjusted, because it had reduced the difficulty to fit the American miners' hashpower and is now returning to full power.

*However, if Gustav had taken his computer with him from Europe and connected it to the American bitcoin network before John arrived, Gustav could have submitted all transactions that had meanwhile occured in Europe to the American network as well, and John would not have been able to spend his balance again.


What technology will supersede the BerkleyDB format? What are the current scalability limitations?

In the next major release (probably 0.8), the reference client will most likely switch to LevelDB instead of BDB for blockchain data. For wallets, a different solution is needed, but we'll most likely move away from BDB for those too.

BDB has several problems - that's not to say it is bad software, but our use case simply doesn't match what it's designed for. BDB is intended to provide databases with extremely high reliability, in complex multi-proces environments, on high-end systems where database logs are backed up and where upgrades are performed manually by a database administrator. BDB doesn't even guarantee compatibility between its environment files between minor releases.

LevelDB - an open-source rewrite of Google's own database system - was designed for efficiency and consistency on commodity hardware, and outperforms BDB by an order of magnitude in some settings. Preliminary tests with LevelDB show very good results.

For wallets, LevelDB would be overkill and a burden. LevelDB uses an entire directory per database (instead of a single file), and wallets are effectively a simple key-value store that's loaded entirely in memory anyway. I assume wallet.dat will be replaced by some simple but solid hand-rolled format.


Is it possible for someone to “scavenge” for bitcoin by generating random key pairs and checking if the derived bitcoin address has any coins ?

Yes.

  Is this likely to be profitable at any time in the future?

No.

The number of possible addresses is extremely massive, much much too large for the human brain to comprehend.

For starters, there are 2^160 possible P2PKH addresses. Then there are 2^160 possible P2SH addresses. There are also 2^160 possible P2WPKH addresses and 2^256 P2WSH addresses. This means that the current total address space is 3(2^160)+2^256. The probability that you would randomly choose generate an address that has Bitcoin associated with it is so small that it is basically zero.

If we were to assume that 100 billion addresses have Bitcoin associated with them or will be in the future (that's an extremely generous estimate), then the probability that you would be able to find one of those is 8.636 × 10^-67. This probability is so small and so unlikely that it will never be profitable or have any probability of an address collision ever occurring.


Is there an application or a site grouping addresses by user graphically?

The tool is called Blockviewer.  The website, blockviewer.com, no longer exists.  However, the source code is available on Github: https://github.com/thallium205/BitcoinVisualizer.  Thus, you might be able to download the source code, compile it, and run it on your own machine.

You can also read the original blog post introducing some of the ideas behind it.


Has the payment protocol – which is supposed to protect against Man-In-The-Middle attacks – ever been implemented?

I am not sure if there are verified reports, but I would be shocked if there were not any man in the middle attacks.

It's super simple to do. Compromise the vendors payment processing (exploit a security hole on the vendors web werver. if the wallet address is generated from a local bitcoin instance, an atacker could point the address generation code away from the vendors instance and towards their own malicious bitcoin instance... Or the malicious user could just hard code their own address in to the payment processing. Depends on how intricate it needs to be. You could even compromise the vendor by having a copy of their wallet, watching silently for a large transaction then running once you find a big haul of coins.) you could compromise their payment gateway api and have it redirect to you(or your coin address) instead of the vendors address. or if they use email: simply compromise the communication protocol (email/web support ticket/etc) and replace the merchants address with yours.

A script kiddie sadly could (and probably has) executed one or all of these methods of attack... There's a ton of ways to do it. Those are just a few off the top of my head.

Be safe. Do not try any of this! This information is posted so you get an idea of what to keep in mind.


What's the difference between a 4 core VM running a Bitcoin Node vs. a 16 core VM?

There's very little value in running a Bitcoin node on Microsoft servers. The idea of nodes is not to add processing power to the network, but to increase decentralization and redundancy. Running multiple instances on servers completely controlled by Microsoft does not help that goal.


Cooling for an XPS 15 (L502x) laptop during Bitcoin Mining

Mining on a GPU, especially on less powerful ones like the ones found in laptops is highly inefficient. You can find out exactly how much you can potentially earn or lose from various Bitcoin calculators, like mine for example.

If you are worried about overheating your laptop and just want to test what mining is all about, you could also lower your hashrate, for example by introducing pauses in the miner. Most mining software should be supporting this feature, so you ought to look at the documentation.

Hardware specific question are probably best asked on different StackExchanges. You could just ask "where is my GPU on my laptop and how best to cool it?"
, which isn't Bitcoin-specific.

And if you want to ask about cooling of BitForce Jalapeno, why not post a separate question with that topic? The more specific question, the better.


How many coins will be available after bitcoin cash fork?

There will be one additional coin after the fork. One network will keep the ticker BCH and the other will get a new one. At the moment it looks like ABC is going to keep the BCH ticker and Bitcoin SV will get the ticker BSV.

The fork is much the same as previous forks off of BTC. The coin with the most proof of work gets to keep the ticker symbol. Right now ABC chain has 55% more PoW done than SV chain.


Where can I import my keys from computer to multiBit HD

All your addresses and private keys in MultiBit HD are produced from the wallet words that you are given when you create a wallet. (This is why it is so important to write your wallet words down).

Because everything is generated from one thing the randomly generated private keys in MultiBit Classic cannot be imported into MultiBit HD.

The safest way to transfer your bitcoin is to spend them.

There is a step-by-step guide on migrating from MultiBit Classic to HD in the help here:
https://multibit.org/en/help/hd0.1/how-to-upgrade-from-classic.html


Is it okay to run regtest for dev purposes while simultaneously running a node on mainnet (bitcoind)?

As long as your nodes are running on separate ports and using separate data directories, you should have no issues running multiple networks.

Note that you may run into resource issues, especially with regular spinning HDDs, if both networks have high requirements for disk writes and reads at any point.


Coinbase.com is a company that buys and sells bitcoins, as well as offers a service to manage your bitcoins for you, much like a bank manages your USD for you.

On the other hand, Bitcoin Core is a software that allows you to manage your bitcoins yourself. Bitcoin Core is not a company, so you cannot purchase any services from them.


Can I mine from CPU using 30 PC constantly on

Yes you can, but it isn't profitable. Mining bitcoin on a normal computer is a waste of energy, because the ASICS have much higher hash/s/kW (hash per second per kilowatt). Mining LTC or any other scrypt based coin is doable on regular desktop PCs, but only those who have a good GPU are worth it.

But then there is another part, tweaking your settings. As mining is continuously stressing your card, it becomes very hot and consumes energy. Therefor its more profitable to run at a slightly less voltage (underclocking) or at only (say something like) 80% of the maximum capacity. It requires a lot of time to get the perfect values for your system. It is an important thing to do, because the margin of profit is quite low, and you really need to push the KHs/kW to the limit to get a good financial result. You have to do that for 30 computers (mining results differ from system to system, even if they are identical, I think I read somewhere) which requires even more time.

Furthermore there are two options: there are good GPU's in the computers for people who want to game in your café or there are just normal GPU's in it, and people just browse the internet and do their thingies there. In the first case, you cannot mine while someone is playing a game because it affects the gaming experience of the customer. In the second case, the GPU is probably not good enough to mine.

So I would say no, it is not profitable to mine in your café. Certainly not CPU mining because that is useless for bitcoin (and will always be due to ASICS). GPU is possible, but because it requires a lot of time  and sweat I wouldn't advise it.


What clients support escrow transactions apart from Blockchain's MyWallet?

Electrum allows to escrow transaction but requires you to use the command line interface.

I found this gist explaining how to do it.


Is there a safe way to use bitcoin based online services?

Look for merchants with a good history. There will, at some point, I imagine be a listing of good and respectable merchants, ranked based on consumer reviews. Until then, just use common sense. I have yet to be scammed with Bitcoin (or USD) because I rely heavily on the reviews of other trustworthy individuals before making purchases.
Don't send more than you can afford to lose. (Bitcoin is often still referred to as an "experimental" currency for a reason.)
Even an escrow service doesn't protect you 100%. In my opinion, you're better off relying on your own intuition when placing purchases, and not buying big ticket items with Bitcoin.
Use a reputable gift card service as an intermediary. I use gyft.com to buy amazon.com gift cards, which allows me to store value in Bitcoin and also get the consumer protection offered by Amazon. (This, of course, means that I trust gyft.com, which I do -- based on a history and other consumer reviews.)


bitcoin-cli sendrawtransaction gives odd error 16

When a scriptSig/scriptPubKey executes, it's supposed to leave an element that evaluates to true on the top of the stack. Both of these are Pay to Public Key Hash inputs, so that means that OP_CHECKSIG failed for at least one of your inputs. Check the signatures.


How can I recognize a bitcoin transaction from a given person?

It would be possible if you can generate multiple receiving address for each transaction. That can be done using your public and private keys.

Give each user a separate address of yours. Then you should be able to track.


The missing inputs error can mean two things: the parent transactions do not exist anymore OR the outputs that your transaction is trying to spend are already spent by another transaction.

You can first try looking up the txids of the inputs for your transaction in a block explorer. Those txids are the parent transactions, and if you see the transactions in a block explorer, check to see whether the outputs you are trying to spend are already spent. If they are, then your transaction is actually a double spend and is invalid. There is no way to make it valid nor is there any way to "retrieve the coins" from it.

If you see that the outputs your transaction is trying to spend from are still unspent, or if the transaction that spends them has the same transaction ID as your transaction, then that means that your wallet is not fully synced yet.

If you do not see any of the parent transactions, then there is nothing that you can do. It is impossible to determine the contents of the parent transaction given just its hash. You would need to have the full transaction of each parent transaction, but if you do not have those, then there is nothing that you can do.


Why is the probability of finding a winning nonce exactly the same for a new header and a header where you've already tried 1 billion nonces?

I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.

For every computation, you have the same probability of generating a valid block hash. Nothing you can do will change this, even if you try every possible nonce value for a given header. Nothing about what you find while testing nonces will tell you anything about what the next nonce value will return as output. Each guess does not get you ‘closer to the goal’, it is just a random chance.

Think of it like this:

You have a six-sided die (numbered 1 to 6) that you know is fairly weighted. If you roll a 1, you get to make the next block! Every other roll does nothing.
You roll the die ten times, and don’t get a 1 on any of the rolls.
Now, on your eleventh roll, you are given the option to switch dice. You can replace the one you were rolling, with a new one that is otherwise the same (also six-sided, printed with 1−6, fairly weighted). Your choice.

What will give you the better odds of rolling a 1? The answer is: it doesn’t matter. The fact that the first die didn’t roll a 1 yet doesn’t influence what the next roll will be. The same goes for the replacement die. Just because it hasn’t been rolled yet, doesn’t make it any more likely to be a 1 (or any other number).


Is there a future-proof method of encoding messages in the blockchain?

With pruning as envisioned today, only spent outputs are pruned. By making a small transaction and never spending it, you can keep the encoded data intact.

In the future it may be that unspent outputs will still be pruned if they're old and low-value, for example as suggested here, in which case you can still extend the life of your message by putting it in an unspent transaction with a high enough value.

If the encoding is in the receiving address itself, this will also resist modifications such as forced consolidation of outputs - but if you want to also be able to salvage the committed coins, the message should be short and the address should be generated with a vanity address generator.


You can share an extended public key (xpub key), and the recipient will be able to generate child pubkeys (and thus, verify and child pubkeys provided to them). An extended public key is defined as (K,c), where K is the parent public key, and c is the chain code.

Keep in mind: anyone with the xpub key will not only be able to verify that an address you give them is derived from the xpub key, they will be able to derive all addresses related to the xpub key themselves. Depending on the situation, this may be a privacy concern.

Worth mentioning: for most applications you should not share a master extended public key. Instead, you should share an extended public key that is located at a deeper level of the derivation tree. It may also be worth looking at the benefits of using a hardened key derivation scheme, so you can create a firewall at a certain derivation depth, meaning an attacker will not be able to work back past that level in case your system is compromised.


Its exactly as you state in the third paragraph.

If you (limit) sell 1 BTC for $1000, you would expect to get $1000. But if someone just placed an order to buy 0.5 BTC for $1050, you will sell to that guy first (so only half of your order) and will receive $525 for that. The other 0.5 BTC you want to sell, sells for $500 (so $1000 / BTC) if someone has that order. So you receive $1025 in total (but fees need to be subtracted), more then you expected.

The same happens when you buy 1 BTC at $1050. If someone just placed an order to sell 0.5 BTC at $1000, you buy that half coin first for $500. The other 0.5 BTC you ordered is bought for $525. So in total you spent $1025 instead of $1050, but you will receive a whole BTC.


When there's a re-org of the chain of several blocks, isn't the total chainwork of both chains compared?

Yes, that's true. In fact, that's how a reorg of any size is considered. However, that wasn't always the case. In the first version of Bitcoin, the client compared purely by chain height. In version 0.3.3 (released July 2010) we switched to comparing by chain work. Today, you can't pull off a timewarp attack without a majority of hashpower.

However, let's say that you did have a majority of hashpower. What could you do with a time warp attack? You could mint an arbitrary number of blocks, and get more mining reward than you're entitled to. You could prevent the timestamp from advancing.


malleability in 2-of-2 multisig payment channel

Did I make an error here somewhere in my construct?

No, you did not. This is indeed an issue for payment channels which can be worked around but reduces the security of a payment channel and increases the complexity of creating a payment channel.

Because malleability poses a problem with payment channels, transactions used for payment channels used in the lightning network make use of Segwit which makes transactions that use Segwit non-malleable. Specifically, for a LN payment channel, the funding transaction must be non-malleable; it must spend from previous segwit outputs and create segwit outputs to allow for future non-malleable transactions.


Will the fee for "bitcoin.it" decrease as the value of BTC increases?

That may full depend on owners of the site, however you can still send them email containing your research, and thay may accept it to that site without payment.


Is there a limited number of Bitcoin wallets?

I think you are talking about Bitcoin addresses, those are considered disposable, consider this; a simple computer constantly generating Bitcoin addresses will generate all possible combinations in 69 tredecillion years.


Personal information and bitcoin purchasing

I am in the process of buying bitcoins and am being required to put in a lot of personal details.

The Bitcoin network itself requires no identifying information from users. In fact, efforts have been made to make transactions / addresses as indistinguishable from one-another as possible, in order to provide the best fungibility and privacy for users of the system.

That said, many of the services which allow users to trade Bitcoins for fiat are businesses that are subject to the laws and regulations of the jurisdictions they exist and operate in. There are anti-money-laundering (AML) and know-your-customer (KYC) regulations in many jurisdictions that require these businesses collect information about their customers. In order to be a customer of one of those services, you must surrender personally identifying information.

  Once i buy the bitcoins is there any way that the information i had to submit to buy them originally can be traced back?

Lets consider two situations:

a) You send all your personal info to an exchange, buy 1 bitcoin, and withdraw to a wallet you control.

b) You meet someone randomly on the street, and buy 1 bitcoin from them.

Now, the question is about how your personally identifying information can be linked to your future Bitcoin transactions. In both cases above, lets assume that you now own one UTXO for 1 bitcoin. In both cases, the counterparty to your trade (the exchange/person) will know that you are the owner of this UTXO. The exchange will know much more about you (perhaps your full name, address, bank info, etc), whereas the random person will just know you as... well... a random person.

Next, lets say you want to buy a bucket of rocks using your newly acquired bitcoin. The price is 0.25 bitcoin (they are very nice rocks!), so you send a transaction that spends your 1 bitcoin UTXO, and creates a 0.25 bitcoin UTXO (paid to the rock seller), as well as a 0.75 bitcoin UTXO (paid back to yourself as change).

So what will the exchange or the random person be able to say about this transaction? The answer is: they will not know whether you now own the 0.75 btc UTXO, the 0.25 btc UTXO, or both, or maybe even neither! The rock seller will know the reality of the transaction, as will you, but third parties will not be able to know with absolute certainty.

Tracking individual coins through time isn't technically possible, but there are some heuristics that can be used to make a best guess of ownership over time. Ultimately, Bitcoins are fungible, so with best practices a user can keep themselves relatively anonymous. Conversely, if a user only uses a KYD'd exchange's custodial wallet and sends/receives all transactions from that wallet, then they will have basically zero financial privacy against that company (and anyone that has access to that company's records).

For more information on Bitcoin privacy, see this wiki article or this stack exchange post (it is an old post, so the wiki is probably more up to date, but the answers there seem largely applicable still to this day).


Bitcoins stuck - No double spend possible

Yes, waiting is the right thing to do, and pretty much the only thing you can do. Because your transaction is valid, it is likely to be incorporated into a block, even though it doesn't have a fee.

According to Blockchain.info, your transaction was successfully mined into a block 21 hours after you first submitted it. Because of this, you can now go and spend this transaction... which you already have, by the time I wrote this answer.


The ScriptCode is the script that is evaluated for a witness program type. Each witness program type has a specific template for the ScriptCode. That is simply part of its definition.

For a Pay-to-Witness-Pubkey-Hash output the ScriptCode is

OP_DUP OP_HASH160 <pubkey hash> OP_EQUALVERIFY OP_CHECKSIG

The <pubkey hash> for the ScriptCode is taken from the witness program.


Does merged mining require clients to download both blockchains?

Those running a miner against a pool don't.  The pool operator would need both.

As stated in the comments below, normal users of the alternate system will not need the bitcoin chain but will need the alternate chain, and normal users of bitcoin will need the bitcoin chain but not the alternate chain. Once the block is mined, nobody cares what other chains may have been involved.


Why does it take 15 minutes for my Bitcoin client to start?

I can't be sure why your client specifically took 15 minutes to start. But I have benchmarked the client's startup process. Most of the time is spent validating the database to ensure the client has a sensible view of the hash chain.

It is "fast verified" up to the most recent checkpoint and then "slow verified" to the current block. Fast verification entails checking only that the header is valid. Slow verification is a much more complete verification that can only be done at about 20 blocks per second on hardware like yours. (Upgrading the client will help, since newer version of the client will have more recent checkpoints.)

If you passed the -rescan option, the client will check every transaction in every block to see if it relates to any account in your wallet. That will add some time to the client's startup time.

When you run the Bitcoin client for the very first time, it will take several hours to sync up to the network. The downside of a decentralized system is that you cannot trust anything and must check everything yourself. This literally requires you to fully verify every Bitcoin transaction that has ever taken place. I've seen that take 9 hours on Pentium 4 class computers with 100Mbps Internet connections. (Though I think it should be a bit faster now, thanks to bugfixes in the client.)


What are the most notable attacks on pools?

Exploits / Hacks resulting in BTC theft:

The Linode Incident - 46,000 BTC were stolen due to the compromise of a single employee workstation.
Slush's Backup Hacked - 3094 BTC stolen after a backup of Slush's pool was compromised.
Mt.Gox Database Theft - a reported 100,000 BTC were stolen, and another 400,000 BTC reported 'missing'. Mt.Gox shuts down and stops honoring trades of compromised coins.

[D]DoS Attacks ([Distributed] Denial of Service):

Slush's Mining Pool DDoS - A DDoS attack which lasted nearly 2 days before being recovered from.

This is a CW entry in the hopes of creating a clean index of info about all known (and notable) attacks against mining pools. Please maintain it as new information becomes available.


The site is a joke, or at best a confusing attempt to educate.
It literally lists all private keys, from low to high, as private keys are just numbers. There are of course way more than can be reasonably computed and stored, so the pages are just generated on the fly. If you ask for private keys starting at number N, it on the fly computes the public keys corresponding to private keys N through N+43, and looks up their balance on public block explorers.
But it doesn't let you search by public key, so it is useless for cracking things. Real private keys are randomly generated, and just scrolling through a near-infinite list of pages to look for a given public keys won't give you anything.


How to move altcoins from Cryptsy into USD?

sell to btc/ltc move to coinbase, withdraw....
coinbase can do instant confirm/same-day ach


Bitcoin unconfirmed long Time no confirmations

Congratulations! Your transaction at the time of writing has 65 confirmations!

blockchain.info


get_tx_status('TXID')
Replace TXID with transaction id.
>> get_tx_status('c12ed68e512aa68dbf88878902efba20446024b645f5254f4b9411db2c6e684c')
{
    "confirmations": 589
}
The transaction should be associated with your wallet else you will get below error:
Exception: Transaction not in wallet.


Multibit client synchronizing since 10 Days now

I haven't used MultiBit, but according to the Exporting private keys page in the documentation, you should be able to get the private keys. You can then import them to another client (local or web) and sweep the coins. For an example of how to do this with blockchain.info, see the Moving a wallet between MultiBit and blockchain.info.


Why miners would waste time validating transactions and blocks when they could spend their time mining?

When a miner successfully mines a block, they  transmit the block across the network. As the block starts to ripple out across the network, each full node receives a copy of the block and after validating it they add the block to the existing chain. Now consider a situation, where the block that is mined does not meet the consensus rules. As the full nodes receive the block, they validate the block to ensure it meets the validation criteria and if the block is invalid, the full nodes will reject the block and will not transmit it further. Thus those miners that do not satisfy the consensus rules will have their block rejected, and will lose their block reward and the effort they put in to mine the block.

  When a new block is created, does each block need to be validated? How does it differ from validating transactions?

When the full nodes receive the block, each node performs a series of checks to ensure that the block conforms to the consensus rules. Similarly, when a transaction is broadcasted, each full node receiving a transaction will perform checks before including it in the mempool. If the transaction is invalid, the transaction will be rejected and will not be broadcasted further by that node. All the transactions included in the block being valid, is a subset of the block verification criteria. You can refer the bitcoin wiki page here to get a checklist on the transaction and block validation.


Segregated witness soft fork: how is the funding Tx made "ANYONECANSPEND"

It's not prepending a script with OP_0. It's a data push that contains the witness program hash, prepended by OP_0.

Old nodes will evaluate this as a script that just pushes two data items onto the stack (a 0 and a hash). That's obviously spendable by all, as the requirement is having a non-zero item as last element on the stack.


Does a soft fork result in two different blockchain versions?

Your observation is correct, except that a fork is expected to be activated by a supermajority of nodes and miners in the network. The most recent soft fork had an activation threshold of 950 blocks in specific segments of 1,000 blocks signaling readiness (95% hashrate) for the new rules.
So, assuming that only 5% of the mining power don't follow the new rules:

Increasing block size: 95% of the mining power allows bigger blocks now, 5% continue to enforce the smaller limit. As soon as a block with the new rules is found, the old nodes that do not allow bigger blocks reject the main chain and start their own chain-tip. The minority chain moves much slower, and thus the majority of the miners and nodes ignores it. Assuming the split's proportions remain stable, the two chains remain irreconcilable. To mend the network split, one side would have to concede and adopt the other sides rules.

Decreasing block size: About 1 in 20 blocks will exceed the limit enforced by the majority. Only nodes still using the old rules will accept the bigger block, all other nodes ignore it. The majority of the hashrate will quickly outpace the big block minority. Since the small blocks are acceptable to the old nodes, big block nodes will reorganize to the small block chain as soon as that chaintip has more total proof of work. Since the difficulty between chaintips can only differ across difficulty readjustments, this generally happens whenever the small block chain pulls ahead by one block in height. As the big block now becomes part of a stale chaintip, the miner that authored the big block loses their block reward. In result, whenever a short chainfork with big blocks occurs, the network converges back on the smaller chain eventually. The big block miners are losing money unless they adopt the rules of the majority, or force the split to become permanent (essentially hardforking from the softforked majority).


Is BTCFrog bitcoin QR code generator hacked?

Unfortunately, that’s the hacker’s BTC address. There are way too many fake BTC QR generators nowadays, so the best way to do that is to ask your wallet to generate the QR for you (or use a well-known website).


is there a tool to produce addresses given a master public key?

Check out libbtc (https://github.com/libbtc/libbtc), once compiled, you get a command line application called bitcointool.

libbtc compiles without external dependencies (compile it with --disable-net if you don't need libevent based p2p network features).

You can then derive a sub-key from your master with something like...

./bitcointool -command hdderive -keypath m/1 -privkey xprv9s21ZrQH143K3C5hLMq2Upsh8mf9Z1p5C4QuXJkiodSSihp324YnWpFfRjvP7gqocJKz4oakVwZn5cUgRYTHtNRvGqU5DU2Gn8MPM9jHvfC

(should also work for public key derivation)

Maybe check the docs: https://github.com/libbtc/libbtc#the-bitcointool-cli


Since the block size is fixed (but has changed since genesis block) there are 2 main reasons:

Transactions are not all the same size in bytes. One transaction can have multiple inputs and outputs, increasing the size of the tx in bytes.
The market might not fill a block with transactions (esp. in the beginning blocks) because usage is low.


A Simple Question: Which blockchain (or ledger) do we query as a client?

I'll try to answer each question as simply as possible, and hopefully give an overview of your misconceptions.

  Which blockchain (ledger) do we query as a client?

We query the nodes that our client is connected to.

  Do we need to query multiple full nodes to get a common view of the nodes?

We don't need a common view of the nodes.  That's not too important.  What is important is a current view of the latest blocks, and which transactions our node has been notified about.  This is how we know which transactions have been confirmed (because they are in a block), and which have been broadcast over the network (because we have seen them).

  Is there one (public) ledger built from the common view of the full nodes?

Yes and no.  Yes, various companies and entities gather information on the state of nodes, and then provide an interface to the public to view information on those nodes, and the overall state of the network.  This is what a block explorer does.  However...no, this is not a part of the Bitcoin network, and clients do not and should not rely on them.

  If the answer to the 2nd question is: no, then why don't we build one unique ledger which is the common view of the majority of the full nodes in the network?

If one unique ledger was the common view, whom would you trust to run that ledger?  This is specifically the problem that Bitcoin has solved.  Bitcoin is a method of coming to consensus on the state of that ledger, without requiring a central trusted authority.  If we were okay with a central ledger, then we wouldn't need a blockchain, and Bitcoin would serve no use.

  If we don't have one ledger, then how do we (as a client) realize that our transaction has got enough confirmation? Do we need to ask many full nodes to realize that?

Confirmations don't come from nodes.  A confirmation is what happens when a transaction is included in a block, and that block is accepted by the network.  Each additional block that is accepted on top of the block including the transaction, is an additional confirmation of the transaction.  It has nothing to do with the number of nodes that relayed the transaction.  As such, we can query a single node for the latest blocks, and count the confirmations of a transaction by counting the blocks backwards until we reach the one with our transaction.  If the proof of work on those blocks checks out, then there is almost no chance that the single node has lied to us about the state of the blockchain.  It would be far too much work for that node to spoof.  Even if they had the computing power to do it, they would have missed out on a fortune in mining just to be able to lie to you about the state of one transaction.  In other words, the verifying the proof of work calculations on the blocks a node provides proves the node is honest.


For ease of use, there has to be one or more automatic peer discovery mechanisms. You have listed some of them.

There is also the -addnode command line option to bitcoind that allows the user to connect to specific node(s).

These mechanisms are specific to the current implementation of Bitcoin. The Bitcoin protocol does not specify any particular peer discovery mechanism. This allows the discovery mechanism to evolve over time, and for the truly paranoid, also allows manual peer specification.


How does the Segwit2x fork implement replay protection?

segwit2x temporarily had an opt-in replay protection, but chose to remove it.

it is intentional, as part of their strategy to make only one fork survive.


Why is MtGox trying to trademark "Bitcoin"?

Some countries have a strict first-to-file rule. In these countries, if some malicious entity tried to trademark the term 'Bitcoin' it could cause problems for others trying to use it to talk about the currency. Tibanne is trying to protect the community from this kind of nonsense. Source.


If SegWit removes signature data, where does it put it exactly ? what does it mean that it puts at the end of the transaction ? and how does it make a block to contain more transactiosn?

It doesn't remove anything. It moves witness data to a separate area, the segregated witness, which (a) does not contribute to the txid and (b) is counted differently.
But, the witness data is still an integral part of the transaction. It's not covered by the txid, but it is covered by a new separate identifier, the wtxid. These wtxids are committed to by segwit blocks. So you still can't change/remove/... the witness data without it invalidating the block that contains them.

By reading this, it still doesn't make sense how block size limit has been increased. if we count the size in MB, segwit implementation might need more MB than non segwit implementation(older bitcoin).

Yes, absolutely. From the perspective of newer nodes, it is a block size increase. It's not a blunt multiply-by-4, but segwit blocks do permit more transactions, and their total size in bytes can be (and is) larger than 1 MB.
The important part is that this extra space is all in witness data, which old nodes don't see. Thus, their 1 MB limit requirement is still satisfied.


What parts of Bitcoin (litecoin etc) are Little Endian?

All numeric values on the wire are little-endian with the exception of network addresses and ports, which are big-endian.  This includes Sha-256 digests which are treated as 32-byte numbers.  It does not include data pushed on to the script stack, however, which is copied as-is from the script element.

The regular numbers aren't really a problem since you end up shifting the bytes to form the internal numeric value in either case.  But the 32-byte values are expensive since you end up allocating a new byte array to reverse the bytes as you go to/from the wire protocol byte stream.


How does the lightning network handle changing IPs?

If your IP address changes, you reconnect to the network and broadcast a new node_announcement message containing the set of your node's reachable addresses and an updated timestamp. The node's public key identifies the node  and all of its channels and may not change. All other information in the node_announcement message can be changed.


Every client has different selection criteria based on fees, age of the outputs, and other factors that impact the ultimate fee and priority. Normally older outputs are preferred as they incur less fees. You would probably want the 0.6 BTC output as you'd need 0.0001 BTC for the fee, sending 0.9999 to a new change address.

There's ultimately no "proper" method as this is wallet functionality and not core protocol.


what do these values in chainparams.cpp do?

If nMajorityEnforceBlockUpgrade out of the last nMajorityWindow blocks have signaled support for a softfork, enforce the softfork's rules on the blocks that have signaled support.

If nMajorityRejectBlockOutdated out of the last nMajorityWindow blocks have signaled support for a softfork, mark blocks with an old version as invalid.

These are for BIP34 style softforks.


What current wallets support deterministic public addresses (BIP32)?

I know of these three:

The Gem API enables wallets to be made using their BIP32 compliant API.
There is also the BitGo service that uses BIP32 Multisig wallets.
BitStash hardware wallets also are BIP 32 compliant.


What methods could a government use to shutdown Bitcoin?

Honestly, I think the best way for the government to shut down Bitcoin would be as a secret project. Simply construct a VLSI ASIC miner built using 40nm/1Gtransistor technology and build 100,000 of them. Effectively make them appear distributed around the world using VPNs, the bandwidth is low. Then execute frequent 51% attacks on the Bitcoin chain to "unconfirm" transactions to major sites. Confidence in the Bitcoin system would drop to nothing.

Another trick would be to switch the miners off and on unpredictably. If done right, this could lead to hours between confirmations at some times.

One can imagine the community responding to this in a coordinated way to develop a workaround. But if you assume subversion and interference in that process, such a response could be avoided.

Of course, they could also summarily execute anyone found using Bitcoins. It's effective too, but also pretty unlikely.


Unconfirmed transaction for nearly 3 months

What you need to do is find the transaction i.d.
There you will see everything if there is no confirmations after 3 months its just well strange , I think you can look for more answers also in bitcoin forums there are alot of people that can help there nad they answer usually instantly


How to direct bitcoins from Triplemining to a wallet?

I think there isn't one specified, and when you generate coins, they just stay on the site's wallet.
Just take your bitcoin receiving address from Multibit and paste that to the "payout address"-field.


At most two outputs according to Bitcoin whitepaper. Multiple outputs in real transactions. How come?

Note the word normally at the beginning of the sentence.  This isn't imposing a restriction but merely describing a common use case.

It's obviously useful to allow more than two outputs, and there's no particular reason to impose any arbitrary limit on the number.  I don't think such a limit was ever contemplated.

In any case, the whitepaper isn't considered to be an authoritative description of the protocol; that would be the reference client.  For instance, the whitepaper describes a scheme for reclaiming disk space that I don't believe was ever implemented (the "pruning" feature came much later and is somewhat different).


How to close debug window (qt client on linux)

Just right-click on the top bar, and it will bring up a menu that allows you to close it.


What prevents a knowledgeable person from modifying their bitcoin data?

Bitcoin aren't stored on a machine, but they are held in a distributed public ledger known as the blockchain. The blockchain is a database which is replicated over the machines of everybody who participates by running the bitcoin software. This means that the database you hold locally on your machine is just a copy of the one which the network as a whole agrees is the correct and undisputed ledger.

The process by which all participants agree as to which chain is the true valid chain is called mining, which uses a Proof-of-Work mechanism to enable one participant to commit a new block to the chain approximately every 10 minutes. The process by which a participant is selected is pseudo-random and probabilistic, based on the amount of work they do, which generally corresponds to the amount of electricity they irreversibly consume to perform computation on the current tip of the chain.

The cost of electricity to perform work is one of the game theoretic elements of Bitcoin which keeps it secure, because it means that any participant who attempts to adjust the ledger to favor themselves will have to spend money and consume electricity, but their chance of success is extremely small, as they would need perform more than 50% of the total global work being done on the current tip of the blockchain in order to keep ahead of the honest majority. The majority of participants are honest because it can be profitable to be honest, but being dishonest is a loss-maker unless you are certain to have more than 50% of the global work being performed on Bitcoin.

The chain is secured by cryptographic hashes, so that any attempted change to any part of the ledger produces different hashes. Each block in the chain explicitly refers to the previous block header's hash, and this value is also included in the current block header. This means every block commits to the entire blockchain history, and any attempt to rewrite part of the ledger would require rewriting the entire history of the ledger from the point of modification. Rewriting the history would therefore require an amount of work in excess of the total amount of work which was performed between the block which was attempted to be modified and the current tip of the chain.

The ledger itself is a linear sequence of blocks which each contain a set of transactions, where one of the transactions in the set is a coinbase, which collects the fees of other transactions in the block, and which releases some previously unused bitcoin as part of a predetermined release schedule. Currently around 35/40 of all bitcoin have been released and the remaining 5/40 will be released gradually over the next 120 years.

The other transactions in a block are regular transactions which have inputs and outputs. The inputs of a transaction refer to the output of a previous transaction. The outputs contain a locking script, which is a set of preconditions which must be met in order for that output to become spent. Once a transaction output has been spent, it may not be spent again. This means that there exists at any moment, a set of unspent transaction outputs (UTXOs) in the ledger which are where all of the bitcoin in existence are "held".

The relationship to a wallet is where this locking script comes in. For all regular transactions, one of the preconditions to unlock the output and spend it is to provide a digital signature matching a public key which is stored in the output locking script. Only the person who has the private key corresponding to the public key is capable of producing such signature, and the message they sign is a hash of the transaction which they are attempting to spend - which ensures that nobody else can manipulate this transaction because it would invalidate the signature.

So a wallet is fundamentally a set of private keys which are used to unlock some bitcoin held in some UTXOs on the distributed public ledger. A wallet will compare the set of corresponding public keys against the entire UTXO set of the public ledger to determine which bitcoins are essentially "owned" by this wallet. The amount of bitcoin in set of UTXOs which the user can unlock correponds to their balance.

A regular bitcoin software will obtain a copy of the entire ledger and will listen for new blocks being added by other nodes - who broadcast them over a peer-to-peer network. Multiple distinct connections are used to ensure that peers do not present false or outdated information. Each time a new block is created, approximately one every 10 minutes, the wallet will download the block and look through its set of transactions for any which the wallet has the relevant private keys to unlock. Any which it can unlock are added to the balance, and this becomes newly received bitcoin.

To spend bitcoin, a user must select one or more UTXOs which they have the private key to unlock. They create a new transaction referring to these UTXOs as inputs, and they create a set of outputs which contain new locking scripts - usually by including the public key hash of the person they wish to pay, which comes from the bitcoin address which they use for that payment. The bitcoin amounts in the outputs of a transaction must be less than or equal to the amounts of the input UTXOs referred to in the transaction, with any difference being paid as the fee for the transaction. The user will then sign this transaction and broadcast it over the peer-to-peer network.

A transaction must be valid for any other node in the p2p network to accept it. This means that the participant who receives a transaction will compare the accuracy of the UTXO set against their own copy of the ledger. If you modify anything in your local copy of the ledger, it will not produce changes to the copy anybody else has. If you attempted to spend some amount that other participants do not agree that you own, then your transaction will be invalid and rejected by the network. It will never be included in a block, and the intended recipient will not receive anything.

In other words - any attempt to modify data locally can only attempt to fool yourself, but it can't fool others. Nobody accepts anything you say as truth - they verify it for themselves by verifying the historical accuracy of the ledger.


(CHECKSIG) Why is the ScriptPubKey from tx-inputs part of the signature?

AFAIK this was a design choice by Satoshi originally that is unnecessary for the reasons stated in the OP. There is a comment about this in bitcoinj

  // Set the input to the script of its output. Bitcoin Core does this but the step has no obvious purpose as
  // the signature covers the hash of the prevout transaction which obviously includes the output script
  // already. Perhaps it felt safer to him in some way, or is another leftover from how the code was written.

However, it should be noted that there is value in signing particular parts of the previous transaction. Segwit just implemented a new transaction signature algorithm to the cover the amount of satoshis a input is spending from a given output.


What's the status of BitInstant's debit card?

This is still very much a project which is being worked on.  BitInstant hopes to bring you more info as everything progresses.  Thanks for your patience.


How can a miner choose which transaction to include in the next block?

Do I really need to put more than 1000 transactions [in a block] to see my transactions going in different blocks

No.  You can limit the size of the blocks you produce by changing the -blockmaxsize option.  For example, if you only want to be able to add a single 250-byte transaction plus the 80-byte header and 1-byte (in this case) transaction count, you can start Bitcoin Core like this:

bitcoind -testnet -daemon -blockmaxsize=331

Then you can use the prioritisetransaction RPC to prioritize tx1 over tx2.

Regarding your second question, estimatefee and estimatepriority may not return useful results on testnet because transaction volume there is low so almost every transaction goes into the next block.

You may find it more useful to experiment with regression test mode which will allow you to create a private testing network and completely control every block (as well as mine blocks instantly).


How can Trezor update firmware but never receive malware?

You actually can't update all the firmware. In particular, the portion of the firmware that implements the security logic cannot be modified, it's burned in for good.

If you want to take full control over a Trezor, which would even let you load malware onto it, you can. However, the internal security logic would still wipe all the data in the unit when you did and display a warning each time the unit was started. So you can't use the firmware update path to steal secrets, nor can you trick someone into using a modified Trezor, so long as they watch the startup.

Assuming all this is implemented correctly and has no bugs or defects, that leaves only the possibility of malicious firmware signed by the manufacturer so that it would be accepted by the security firmware without tripping the safeguards. So to some extent, you have to trust the manufacturer. However, if they ever signed "evil firmware", and that firmware got out, their reputation would be ruined.


Generating Output Script from Bitcoin.js or other Javascript Library

I wrote a tiny module to do just this: https://github.com/lukechilds/build-output-script

It can be used like so:

const buildOutputScript = require('build-output-script');

buildOutputScript([{address: '1LukeQU5jwebXbMLDVydeH4vFSobRV9rkj', value: 100000000}]);
// '0100e1f505000000001976a914da6473ed373e08f46dd8003fca7ba72fbe9c555e88ac'

You can pass in multiple P2PKH addresses.


How to create a Bech32 address from a public key?

Ok, I figured out how to do it.

You need 3 pieces of information to construct the bech32 address.

hrp: the human-readable part. This is bc for mainnet and tb for testnet
witver: the witness version. This is 0 at the moment represented by the byte 0x00 but it can go up to 16 when they add more versions.
witprog: the witness programm. In case you want a Pay-to-witness-public-key (P2WPK) address which is the most common ones, this is the 20-byte hash160 of the compressed public key i.e ripemd160(sha256(compressed_pub_key)). In case you want a Pay-to-witness-script-hash (P2WSH) address, this is the 32-byte sha256 of the scriptPubKey which is the script that will need to evaluate to True for someone to be able to spend the output. More on this in BIP141

Once you have those 3 pieces, you can use the encode function in one of the reference implementations

I have put together a small pure Python library for anyone interested how all this stuff works behind the hood.


Why is the witness data fee discounted by a factor of four?

Witnesses do not need to be stored once they have been verified and can be discarded. This effectively reduces the size of the UTXO. The discount is supposed to account for the reduced storage requirements and to encourage users to switch to segwit, benefiting the network as a whole.


If I invest £2,000 in bitcoin and the price goes down, can I lose more than my investment. Could i Have to sell my house to pay back the losses?

...if the price goes down substantially, to well below that of when I initially invested; is it possible that I might be sent a bill for the further losses ?

No.

If the price of a bitcoin dropped to $0, you would lose your entire investment, but no more than that.

Think of it like buying gold: if the price of gold dropped to zero, you would now just own some worthless metal. You wouldn't owe anyone money, you would simply have lost the capital you used to buy the gold in the first place.

The only way you are going to owe more money than your investment is through some external factor. As an example, if you took out a loan to buy bitcoin, and then owed interest on the loan. But that debt would be owed to whoever lent you the money.


Yes, blockchain.info's wallet import is safe. It encrypts things in such a way that not even blockchain.info can access your private keys. You can make transfers from there (it's a sort of online wallet), so you don't even necessarily need to transfer them to MultiBit before wanting to sell them.

To quote a previous answer with instructions on importing and then exporting to MultiBit:

  Visit https://blockchain.info/wallet/import-wallet. Drag the Bitcoin-Qt wallet.dat file into the dotted area. Follow the
  instructions.
  Login to the new wallet. Under the Backup heading click download.
  Open multibit choose Tools -> Import Private Keys. Now import the wallet.aes.json file just downloaded.
  Delete the keys from the blockchain.info wallet.

If you don't trust blockchain.info (despite their claims), you could extract the data entirely offline using pywallet and then import it into MultiBit.

It should also be possible to dump the private keys from the official client without downloading the whole blockchain (which is the "very heavy" part of it). See How do I import private keys from Bitcoin-qt to Multibit client? for help with that.

Once you have access to your bitcoins again and want to sell them, you could sell them on LocalBitcoins. In the US, I can also recommend Coinbase.


Is it safe to email an encrypted wallet to myself?

You can trust encryption

If you encrypt anything using a strong key and a strong algorithm (e.g. GPG) then you can be sure that it will be beyond economical reach for anyone for a long time.

So, the general procedure would be

Encrypt wallet.dat with your long and complex passphrase (which you keep safe)
Attach the ciphertext output to your email
Enjoy the free offline backup service

Do not just attach wallet.dat to the email since it will reveal your transaction history and bind your public addresses directly to you thereby removing your anonymity.


Encrypting wallet manually instead of using hardware wallet

The benefit of hardware deterministic wallets is that your keys are permanently kept offline and secret, as long as you don't leak your seed words. To spend bitcoin, the transaction signing is performed on the device, keeping your keys safe.

If you encrypt the keys yourself (I'm assuming you're talking about bitcoin private keys, not an HD wallet seed), it depends how you store them. I can see three risks:

If you're planning on storing them online and encrypt them all with the same passphrase, then you're reducing the security of your keys to the single passphrase. If you leak your passphrase, anybody with access to your data can decrypt and use your keys. If you don't store them online (including on a system with access to the internet) however, this is less of a risk.
Signing transactions. In order to sign transactions, you're going to have to decrypt your key and run it through some software. If you do this online, it's very risky. If you do it offline, you're still at risk of keyloggers and other malicious software that could be present on your machine. This also applies to when you generate your keys in the first instance.
Loss. If you lose your encrypted data or your passphrase, your bitcoin is lost. With an HD wallet, if you lose the wallet you can recover with the seed words. If you lose the seed words you can still use the wallet to transfer to an alternative address.

If you do decide to use the passphrase method, note that there is already a standard for protecting a private key with a passphrase (example implementation - check the paper wallet section), so it's not necessary to encrypt it separately yourself.


Do all Bitcoin alternatives need to have a coin limit?

E-Gulden has a limit of 21 Million.

Most, but not all cryptos have a limit, for example DogeCoin recently announced that there would be a minimum reward of 10,000 doge for every block after the previously announced reward schedule was supposed to end.


Turnkey Bitcoin test clone for demonstration purpose

Well, I can tell you that what you are looking for probably does not exist. I did the same search recently.

I was in talks with a large company and all they wanted to hear was the Blockchain and how they could use it. They asked to have their own Blockchain -i.e. altcoin. You are probably in a similar situation.

The best course of action here -in my opinion- is to try to convince them that a Blockchain that they will create is just a more expensive and much more complex version of a Database. And the altcoin will be nothing more than records on that expensive, complex and possibly insecure database.

In my case I was able to convince them -somewhat- but the response was:

  We still can't use Bitcoin because of internal politics and PR risks

In the end, I convinced them to use Bitcoin testnet :) I suggest you do the same.

Bitcoin testnet is the closest thing to what you are looking for.

It's not Bitcoin, it doesn't have real value and there are online and mobile wallets built for it. You can also play around with mining on testnet.

Just call it Testnet instead of Bitcoin Testnet and hope that they will get more comfortable with Bitcoin in time.


Is it possible to know my ip address by simply connecting to the Bitcoin network?

First, it's worth noting that getting your IP won't identify your wallet address. So they can't connect to you and then look you up on the blockchain to see who you've been trading with. Associating an address with a person takes normal investigation, like searching your computer or associating you/your IP with a post on the internet containing your address.

For 1:
Unless someone logging the connections to their bitcoin client and they decide to make it public, there isn't any public record of it.

That said, what most would be worried about isn't that their IP would be publicly published, but that certain organizations may be able to identify them. One way these organizations could identify you is by running their own bitcoin client and logging their internet traffic (TCP on the port BTC uses). This would be very easy to do, so if it is something you're concerned about, you should assume it is being done. (If you want to know how easy, look up wireshark. It can log all traffic on your local network.)

Assuming someone is logging IPs on the bitcoin network, the only hope of not being logged is that a singe node only connects (on average) to around 8 peers (but this is configurable). This small number means you have a somewhat small chance of connecting to them.

But, depending on how peer discovery works, it may also be possible to be found by the logger asking for peers. That is, there has to be some way of finding peers in the btc network. This could possibly be exploited to identify a large number of IPs connecting to the btc network. (To be explicit, I haven't studied the specific way peer discovery works, but from general understanding of programming and networks, it seems very plausible.) If this were the case, then the fact that a node only connects to about 8 peers is pointless, because you wouldn't need to connect directly to the organization to get logged; they could find you by asking others for new peers.

For 2:
If you send them to a paper wallet and never connect to the btc network through a client running on your computer, then no, your IP can't be discovered. But, the only way to retrieve them from the paper wallet is to import it into an digital wallet of some kind, which, when you connect that digital wallet to the network to spend them, will identify you.


How to calculate economic security for bitcoin proof of work?

Is this the correct way to calculate security for bitcoin proof of work?

Not sure. But looks like lot of things are ignored in these numbers. I have read about FRM so I will share few things related to FRM ratio and security:
The Fee Ratio Multiple (FRM) is defined as the ratio between the total miner revenue (blocks rewards + transaction fees) and transaction fees. FRM is a measure of a blockchain's security and gives an assessment how secure a chain is once block rewards disappear. This metric was first introduced by Matteo Leibowitz.
A low FRM suggests that an asset can maintain its current security budget (miner revenue) without having to rely on an inflationary subsidy.
Conversely, a high FRM suggests that an asset will require heavy inflation via block reward subsidies in order to maintain its existing security budget.
https://medium.com/coinmonks/introducing-fee-ratio-multiple-frm-1eada9ac9bec

If a government or group of few rich people or organizations create a token, hold most of the tokens and stake it, price of this token and few people holding this token makes the system secure?

No. I don't think this makes a system more secure.

What are other differences in proof of work and proof of stake?

Few differences are mentioned in the answers for this question: Why doesn't Bitcoin migrate to proof-of-stake?
"Proof-of-stake is still in its infancy, and less battle-tested, compared to proof-of-work"
Although difficult to quote anything from websites associated with altcoins, I agree with above sentence which is from https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/


How was 59 days determined with 1 TH/sec from "Mastering Bitcoin"

There are 2^256 possible hashes and your source gives a target value of 238348*2^176, requiring more than 60 bits of leading zeros (61 in fact, plus the slightly stricter requirement that a valid hash must be smaller than the target value and not just start with the same number of leading zeros). In fact, the fraction of acceptable hashes out of all possible hashes is 238348*2^-80. Multiplied with 10^12 hashes tested per second, multiplied with 24*60*60 seconds per day, you get a probability of finding a valid hash of about 1 / 58.70 per day, or (as reciprocal) 58.70 days per valid hash on average.

You ask how 8496 was calculated. I note that 8496 = 59 * 24 * 6, so assuming you round to exactly 59 days per valid hash and use the nominal target of having one new block recorded in the blockchain every 10 minutes (hence 24*6 per day), then with a constant, steady-state target you would indeed expect to get lucky, on average, once every 8496 blocks by finding a valid block yourself. Obviously, there is an issue with the stated precision; according to my calculation, even just the rounding to 8500 blocks would only barely be correct.


When a new block is propagated, nodes validate from genesis block to propagated block?

Nodes do not validate blocks from genesis each time a new block is received.

During the initial sync, nodes will validate, at the very minimum, the headers from the genesis block upto the current chain head - this allows them to find the best chain (by amount of work done). They also usually verify the utxo set.

When a new block is received, simply validating it against the previous block hash and the current utxo set is enough, as your previous block is already verified, which means all blocks before that are also verified.

If you happen to lose your local copy of the chainstate and only have raw blocks left, then you would need to revalidate from genesis.


Lets start with the version of the bitcoin wallet that you are running. Are you running the latest version 0.6.3?
Second, which OS are you using, It'll help us to tell you which files to delete in order to restart the chain download.

Delete the blockchain data and reload the chain.  !!! Do not delete the files wallet.dat, addr.dat and bitcoin.conf. Except for those, stop the wallet, delete all other files, restart the wallet.

The files you'll see and that you can delete are, e.g. blk0001.dat, blk0002.dat, blkindex.dat, *.log, peers.dat, the whole subdirectory 'database'


How long does it take to earn back the investment of a miner?

You can run the miner all the time, not just overnight or while you're at work.  It doesn't use hardly any resources on the laptop... all the heavy lifting is done on the miner.

It's very risky to buy a miner.  The miner manufacturers often take a long time (i.e. several months) to deliver your order.  While you are waiting the mining difficulty is going up and the manufacturers move on to new more powerful models.  As a result, by the time you get your hardware it could be well on its way to becoming obsolete.  Keep in mind that a mining rig is not useful for any other purpose.

It is a very real possibility that you will never make back your investment unless the bitcoin price goes up a lot.  And if you want to bet on the bitcoin price going up, you can simply buy bitcoin and save yourself the whole mining hassle.


Password not working in Bitcoin core wallet

Any ideas to get around this?

Check the computer for viruses.
Disconnect the computer from the network
Type the password/passphrase into Notepad (etc) where you can see it, then cut&paste into the wallet prompt.
Restore the wallet from one of your recent backups and retry.
Restore the wallet from one of your older backups and retry.
Restore the wallet from one of your offsite backups and retry.
Fetch one of your written notes of the private key from the safety-deposit box at the bank or from your floor-safe, use it to re-create the wallet and then create a new password.


Double SHA256 giving me an incorrect value with this code VB.net

You seem to be interpreting the hex encoded data as a UTF-8 string. Instead, you should be decoding it as a byte dump.

To illustrate, decoding 12 as a UTF-8 string will give you:

0x3132

while decoding it as a hex dump will give you:

0x12

In bitcoin, all hashing it done on the byte values, which are often printed as hex strings for convenience - you must decode them back into a byte array as hex strings, not as actual strings.


How does Bitcoin Gold implement replay protection?

I don't believe any replay protection has yet been implemented, they still have an issue open for it on the BitcoinGold repository here:
https://github.com/BTCGPU/BTCGPU/issues/51

I haven't dug into the code itself but I would imagine that they would have closed the issue if they had implemented something.

The statement by Bittrex also claims that they haven't implemented any replay protection: https://support.bittrex.com/hc/en-us/articles/115002320451-Statement-on-Bitcoin-Gold-BTG-

Update as of 3rd November 17:
A PR for replay protection has been merged, https://github.com/BTCGPU/BTCGPU/pull/109

They announced it via twitter here: https://twitter.com/bitcoingold/status/925600171425259520

It uses a new SIGHASH_FORKID to implement the 2-way replay protection.


Why does bitcoin have so many digits if I cannot move anything freely under 10000 satoshi?

My assumption is that the limitation is set by BlockChain.info itself, to protect the non-educated users for doing transactions which may take days to confirm.

However raw Bitcoin protocol supports transaction with any amount and any fee. But because transactions are confirmed by miners they might not have economical incentive to care about dust-like transactions and thus the transaction confirmation time might not make sense anymore for the person who does the transaction.

More info: What's the minimum transaction with bitcoin?

Bitcoin transaction fee future:

https://bitcoinfoundation.org/2014/07/floating-fees-for-0-10/

More discussion about Bitcoin and microtransactions:

https://bitcointalk.org/index.php?topic=397403.0


bitcoin chainstate database parsing in python giving wrong value

After investigating I found the x in txout_decompress(x) was not an integer which was causing the difference in answer so during division I typecast it to int and it worked. So the corrected code:

def amount_decompress(x: int):
    # x = 0  OR  x = 1+10*(9*n + d - 1) + e  OR  x = 1+10*(n - 1) + 9
    if x == 0:
        return 0
    x -=1
    # x = 10*(9*n + d - 1) + e
    e = x % 10
    x = int(x / 10)
    n = 0
    if e < 9:
        # x = 9*n + d - 1
        d = (x % 9) + 1
        x = int(x / 9)
        # x = n
        n = x*10 + d
    else:
        n = x+1
    while e:
        n *= 10
        e -= 1
    return n


What are Jaxx wallet's slow, average and fast mining fees?

How do I find out the actual transaction fee for each of these settings?

The exact Jaxx miner fees vary per transaction depending on various factors. You can still get an estimate for each "Fast", "Average", "Cheap" option.

Steps

Using Jaxx app, at the top of the screen, tap/click the appropriate cryptocurrency symbol presently activated. Such as BCH (Bitcoin Cash) or BTC (Bitcoin). In this example we will use BCH.
Navigate to Menu >>> Settings. Tap on “BCH Mining Fee” option.
Select one of the following three options:

Fast
Average
Cheap

Still using Jaxx, start a BCH transaction. After you tap "Send", a small orange confirmation screen will mention the exact fee you will pay to the miners before you can confirm the transaction. This is your first answer.
To get all your answers, repeat all of the above steps for "Fast", "Average", "Cheap" option.
Done. Now you know the exact estimated fee per option. Enjoy :)

Notes

Jaxx said that they are using adjustable fees based on a feed from  https://bitcoinfees.earn.com and they are adjusted based on the historical fees charged by the miners in the past few blocks. Source at https://www.reddit.com/r/jaxx/comments/6u0p06/what_is_jaxxs_mining_fee/dlpdz1z/
There are three levels of miner fees you can choose from. They determine the speed of the transaction to be confirmed by the network.
Three level:

Fast
Average
Cheap


Confirmations on sent/receive transactions, still have 0 balance

It is possible if the client crashed it didn't finish processing the block containing your transaction (due to bad timing) and now that it is past that block doesn't go back to "double check".

https://en.bitcoin.it/wiki/Running_Bitcoin

There is a command line argument -rescan which forces the client to recheck every block for transactions related to the current wallet. In windows it would be done from Command prompt "bitcoin -rescan".  I assume OS X has some sort of commandline option.

Alternatively you can stop the client.  Make a backup of your wallet.dat.  Delete all the files from bitcoin configuration folder other than wallet.dat file.  Restart the client.  It should show 0 blocks and not have the "bad transaction".  The client will download the blockchain. This could take an hour or more.  Once block chain is fully downloaded the transaction should appear and balance updated.


What if during transaction Ripple price drops, in this case the receiving bank will get less amount

The market makers (which can be the banks themselves) price this slight risk into the rates they offer. Most of the time, this doesn't happen, and they make a slight profit. When it occasionally does happen, they may take a slight loss. Fortunately, the price can't move very much in so little time -- and, if necessary, the amount of time can be brought down to sub-second levels by using off-chain scaling schemes such as payment channels.


can we make a blockchain that works like torrent?

...you can download only the files that you need, and no need to download everything with it.

To do this, you would need to trust that you are receiving the correct files (blocks) from your peers. If they lie to you and serve a false history, how will you know?

A full node downloads the blockchain so that it can independently validate the current state of the network, starting from the genesis block. By working through the network's history, the full node can verify for itself what the current state of the network is, without needing to trust any peers to not lie.

A lightwallet can download just the block headers (80 bytes per block) and use them to help verify that the wallet's transactions are authentic Bitcoin transactions.

But in both cases the node/wallet must have a full history of blocks/headers in order to not be trivially taken advantage of. So I think that an application which only downloads parts of the blockchain history is likely of little use, due to the potential for abuse of trust.


sent bit coin cash to coin base by mistake

You'll need to contact Coinbase to get your bch back, the coins are in a bch address controlled by coinbase.


How can a deterministic wallet have one private key but multiple public keys

No, there is not one private key. There is one Master private key. The master private key is then used to generate more private keys in a deterministic fashion, i.e. using the same master private key, you will generate the same private keys. Those private keys are what are actually used in your wallet. Their public keys are generated and the addressees calculated from there.

The mnemonic is an encoding for a seed value. That seed is then converted into the master private key. The specification for the mnemonic generation and conversion is BIP 39. Deriving private keys from a master private key is specified in BIP 32.


How does Bitcoin know if enough BTC are available for an account to allow a transaction?

Bitcoin doesn't track a balance on an address.  You can get a balance but that is for humans and isn't how the protocol really works.  What bitcoin nodes do track is a list of unspent transaction outputs.

Here is your scenario reworded a bit.

BLOCK 108

address ddd111 received 2 BTC by mining block 108 in transaction A:0
(By this I mean transaction A has one output (index 0) that is 2 BTC to address ddd111)

Transaction A:
Inputs: coinbase
Outputs: A:0 - ddd111 2.0 BTC

BLOCK 109

address abc123 received 2 BTC by mining block 109 in transaction B

Transaction B
Inputs: coinbase
Outputs: B:0 - abc123 2.0 BTC

BLOCK 110

The network knows nothing about address with no funds, this doesn't happen

address xyz999 created with 0 BTC
address fff555 created with 0 BTC

address abc123 spends B:0, sending 1 BTC to xyz999 (C:1)  and remainder to self (1 BTC) (C:0) transaction C

Transaction C
Inputs: B:0 (signed by abc123)
Outputs: C:0 - abc123 1.0 BTC
         C:1 - xyz999 1.0 BTC

address abc123 spends C:0, sending 1 BTC to fff555 transaction D

Transaction D
Inputs: C:0 (signed by abc123)
Outputs: D:0 - fff555 1.0 BTC

BLOCK 111

address ddd111 spends transaction A sending xyz999  1 BTC and 1 BTC back to self - transaction E

Transaction E
Inputs: A:0 (signed by ddd111)
Outputs: E:0 - xyz999 1.0 BTC
         E:1 - ddd111 1.0 BTC

BLOCK 112

address xyz999 spends transaction E:0 and C:1 to send bbb888 2 BTC - transaction F

Transaction F
Inputs: E:0 (signed by xyz999)
        C:1 (signed by xyz999)
Outputs:
        F:0 - bbb888 2.0 BTC

(xyz999 couldn't form a valid transaction sending 5 BTC because there aren't 5 BTC of unspend outputs for it to use)

Note: A transaction can have multiple outputs which can be spent independantly.

Now we have this list after block 112:

Unspent after block 112
D:0
F:0
E:1

Each node's job is to import the block by marking the spent outputs as spent and tracking the new unspent outputs.  This is part of why it takes time to sync the blockchain, not only do the blocks need to be downloaded but they need to be validated and the local database needs to be updated.

Note: if you run a node that prunes, it will just keep the unspent outputs. If you don't prune, it will keep all blocks and the unspent outputs.


What is the most efficient and safest way to handle cold&warm Bitcoin storages?

I would personally use a linux/bsd computer, without a desktop-environment. This means, you'd command a bitcoin command-line client without having a graphical interface. Probably something like FreeBSD or Ubuntu. This computer can still be online and used for everyday transactions, but it's much less prone to keylogger attacks and any other sort of attacks since you're not using a Web-browser or Email client or any other malicious type of software that could harm your computer - you just have the command-line.

In my opinion having a minimal setup, with no software installed whatsoever except your bitcoin command-line client, is the best way to go for this type of scenario where you need to send regular payments.

So if you need to do regular transactions daily, using something like this is better than a cold storage in my opinion. You could backup your keys in paper wallets sure, but you'd need something online for everyday transactions. And command-line freebsd system would be your most secure option. Unfortunately if the constant swiping/importing doesn't work for you, this is the next best thing imho.


Insert data to transaction with OP_RETURN

How do I add metadata to the blockchain?
Essentially, one of the output scripts should be
OP_RETURN <the data you want to add>

That's it.
Let me give an example. Say you want to add the string "Melons." to the blockchain.

Convert to binary
"Melons." -> 4d656c6f6e732e
Add the push-data-onto-stack command at the start. This is the length of your metadata if it's less than 75 bytes, or OP_PUSHDATAx otherwise.
074d656c6f6e732e
Add OP_RETURN at the start
6a074d656c6f6e732e
Put this in the scriptPubKey of an output of a transaction. I wrote a guide on this here.

How do I find it again?
That's... trickier. Bitcoin is not optimized for searching the metadata of transactions.
Possibilities:

Look through all of the transactions you get with something like bitcointools.
Use a website like coinsecrets.org.


When do you need to run bitcoin-qt -rescan?

This answer might help: https://bitcoin.stackexchange.com/a/1251/11026

The gist is that a -rescan was needed, when you were restoring an older backed up wallet that didn't have all the transactions in your current blockchain reflected. Basically the client then goes through your blockchain to see if there are any transactions that affect your wallet.

However, you don't have to worry about this anymore since the client now checks automatically if the wallet is on the same level as the currently downloaded blockchain, and if needed, does the rescan:

https://bitcointalk.org/index.php?topic=6642.msg99812#msg99812

Hope this helps.