Lightning Network: How was the maximum allowed HTLCs in flight computed? The maximum acceptable max_accepted_htlcs (maximum number of HTLCs forwarded concurrently) is specified by the BOLTS as being 483.
How was this value chosen ?

The rationale is given in the BOLT #3: for the commitment_signed to be under the maximum message size allowed by BOLT #8 (~65kb), and for the penalty transaction to be able to sweep all HTLCs in one transaction.
Here is a more beginner-friendly explanation of the second part.
The 4000000 Weight Units limitation is the maximum Bitcoin block size limit (link to the BIP).
The 400000 Weight Units limitation is the limit for a transaction to be standard (hence relayed).
The penalty transaction is crucial to the security of Lightning Network channels, so you need a transaction which can be relayed, hence a transaction which size is standard.
But each new HTLC is a two additional outputs to the commitment transactions. Thus two new inputs to the penalty transaction (which spends it). It's an added size (calculated in Weight Units) to the penalty transaction.
So you must restrict the number of in-flight HTLCs to accept (i.e. to add to your commitment transaction concurrently) in order to be sure you can broadcast your penalty transaction if something goes wrong.
Now here is the explanation of the calculation :
max_num_htlcs = (400000 - 324 - 272 - (4 * 53) - 2) / 413 = 966

400000 : the maximum transaction size, cf above
324 : the size of the input corresponding to the commitment transaction output sending funds to you.
272 : the size of the input corresponding to the commitment transaction output sending funds to your peer.
53 : the size of the commitment transaction's non-witness data, this is wy it's timed by 4 to get weight units.
2 : the size of the witness header.
400000 - 324 - 272 - (4 * 53) - 2 : the free room left for adding HTLC inputs
413 : the size to spend an accepted HTLC (used over the size to spend an offered HTLC because it's larger).
(400000 - 324 - 272 - (4 * 53) - 2) / 413 : the maximum number of HTLCs you can accepts so that they can be spent by a penalty transaction which can be relayed by the Bitcoin network.

Because each HTLC creates two outputs, you divide this result by two so :

Thus, 483 bidirectional HTLCs (containing both to_local and to_remote outputs) can be resolved in a single penalty transaction. Note: even if the to_remote output is not swept, the resulting max_num_htlcs is 967; which yields the same unidirectional limit of 483 HTLCs.


How does the security of a mobile wallet work? Let's assume we have a non custodial hd mobile wallet.

Where is the master key stored?
What are the components of the telephone that allow the derivation of keys?

Let's assume we have a non custodial hd mobile wallet.

Non-custodial means no third party acts as custodian, the wallet stores the private key(s)

Where is the master key stored?

Wherever chosen by the software developer who wrote that part of the wallet app.
Normally you'd hope this is in a file in local storage. You'd hope that file is encrypted using a wallet password as a key and using a well-implemented well-known algorithm. In some cases you'd be wrong.
In some cases the wallet's backup feature might copy this rather vital data into cloud storage. You'd hope the data is competently encrypted before being sent and that the cloud storage provider are also competent at protecting their client's data. Sometimes our hopes are not fulfilled.

What are the components of the telephone that allow the derivation of keys?

No special hardware is necessary.
Derivation of keys will involve use of the the processor (CPU) and memory in conjunction with the software algorithms embedded in libraries provided by the operating system and/or in the software application that is acting as the wallet. The results are likely to be stored in normal non-volatile storage (e.g. onboard flash-memory). You'd hope the developer was competent and careful to ensure this data was not vulnerable to undesired access while in memory or in non-volatile storage.


Help - transfering bitcoin old bitcoin core 0.12.0 wallet I have a old bitcoin core wallet 0.12.0 ... I tried to transfer bitcoin from this to a new Coinbase wallet 2 days ago... Nothing has shown up in Coinbase wallet and the status of the transation in bitcoincore shows sent - but with a ! and status 0/unconfirmed.... is this transaction ever going to work or is there a way to cancel? I dont seem to be able to do anything with it now... so am concerned about how I can I get bitcoin from this old wallet?

It also has years worth of syncing to do to catch up

Export your private key(s) from 0.12.0 and import into a more recent version of the wallet, send from the newer version.


How to retrieve unclaimed BTC for wallets whose private key is lost How to retrieve unclaimed BTC for wallets whose private key is lost
Kindly share details

If you lose the private key for some address that contains bitcoins, then you will never be able to spend those bitcoins. The private key is required in order to spend, and there is no known way to work backwards to discover the private key for an account.

If the private key is lost, the bitcoins become un-spendable.


Is the Testnet stable? I have been recently playing with the testnet (using bitcoin-qt -testnet). I have been able to mine a few coins and do some test transfers, but I have found some problems:

The coins appear sent, but a second, receiving client never saw them.
When launching the client some days later the mined coins (and all the blockchain data) have vanished.

I have read we are now in the third testnet. I have checked my .bitcoin directory and there are two tesnet directories, one named testnet and a second called testnet3.

Am I connecting to two different networks?

I thought there was just a testnet, but now I have my doubts. If there are many testnets or if the testnet can change, how can I make sure I can still check my old transactions?

Posting my comment as an answer

Make sure your client is up to date... it's possible your wallet in the old testnet got coins that is separate than the more modern testnet3.

Each version of bitcoind has the possibility of being associated with a different test network.  It would be interesting to see if there was a matrix listing releases against test networks (and why the new network was created).

I assume that it's possible to launch older versions of bitcoind and see each testnet independently of each other, but that independence means that there is no way to transfer coins from one network to the other.  (It is test after all, and hopefully one didn't pay for those coins)


What to save in a wallet? I am programming a specialty wallet software. I am able to generate a EC_key and valid bitcoin addresses. I am not sure what to save to a wallet file in order to recover the EC_key in the future. Must I save both the private and the public key? Can I just save the private key?

What is the preferred format to save these keys and what openssl function should I use to restore the keys?

If you want to save your keys as a proper wallet.dat file, you would need to comply with its format.

If you want to store your keys for some other purposes, you only need to save the private keys (public ones can be recreated, you can check out my testing suite for that). You can save them in any format, but Wallet Import Format might be the best choice - it is compact and includes a checksum.


Unconfirmed Transaction >22 hrs I realise that this might be a duplicate however I have not actually seen a sufficient answer to the question aside from 'wait'.

I submitted a transaction yesterday from a blockchain wallet to a Justcoin wallet.
It was quite a small transaction (test transaction as this is my first)
Below is the information I have from blockchain:

Fees    0.0001 BTC

Estimated BTC Transacted    0.00000001 BTC

Size    258 (bytes)

Received Time   2014-08-20 14:27:54

Estimated Confirmation Time     Within 6 Blocks (Medium Priority)

The transaction ID is:
https://blockchain.info/tx/5ea993b10e772f1e31218a02b843adc18a0e4d1176b3127f0170c5c08bb0361c

The problem I have with this is, it's stopping any other transactions I want to make.
Anytime I try to move more substantial figures I receive the error:
"No Free Outputs To Spend - Some funds are pending confirmation and cannot be spent yet"

Does anyone have any idea why it's taking so long (I'm guessing because of it's size?) and if there is anything I can do to expedite the transaction.

One of your transaction outputs is below "dust" limit. Most of nodes do not relay and mine such transactions. However, there are miners who accept such transactions.

There are two possibilities:

just wait (may be a day or two) for such miner
try to double-spend your transaction with another one

Please read https://bitcointalk.org/index.php?topic=232979.0 for more info


Electrum: seed is 0 length / empty I installed electrum a while back and noted down the 12 word seed. Haven't used it for a few months, but now when I go to view my seed (clicking on the seed icon on the bottom right of the GUI), it asks for my password, and then the dialogue says:

"Your wallet generation seed is:"

And the text box below is completely empty, underneath which it says:

"Please write down or memorize these 0 words (order is important)..."

A bit concerned my seed seems to have vanished. Any suggestions?

it is most likely this bug, fixed now:
https://github.com/spesmilo/electrum/commit/059d381ba8cfed0b4c00cb9b4ec1ff13293de74c


Transaction in a block vs a new block I am writing a study work related to blockchain and the potential in my area of working. Therefore I am now analysing how blockchain works.I have some confusion and hope somebody here can help me with a good source or directly help me to understand it.

I use the bitcoin blockchain as example to explain it.

Person A send Person B xx amount of btc
the transaction is not yet on the blockchain (unconfirmed)
The nodes (miner) verify the transaction mathematically in a block and chain in in the blockchain
TX is confirmed and Person B receives xx amount of btc
-> this I got!

Now every 10min a new block is generated with xx amount of BTC (Based on the algorithmus)

The Blockchain runs with SHA-256, every block has a unique hash so every miner understands where is the current ending of the blockchain.

My problem is to understand/connect those three points, I wanna illustrate it on a timeline.

We have a chain lets say this chain has only 5 blocks. So the miners look for the 6th block. The 5th block has a unique hash so every miner knows where to line up the 6th block.

Then we have a list of unconfirmed transaction, every TX has a little incentive fee for the miners.

The miners work (verify old Tx and search for a new block)
I read that they have to solve mathematical quizzes -> where is the link to a new block then?
Do they create blocks while searching for a new block with btc inside?
-> if a new block is found has this block also Tx inside? Does somebody has a sample on the blockchain?
Do they then use those blocks, add Tx and match it to the blockchain?
How many Tx can go in a block?
Are there also empty blocks?

Sorry if my questions sounds stupid.

You questions are legit, however they might need a bit of reorg.

  where is the link to a new block then?

Every block header has the hash of previous block's header. So there's the link

  Do they create blocks while searching for a new block with btc inside?

a miner "creates" a block by selecting tx from the pool and "solving the math problem" as you said. Other miners are doing the same thing. When someone else solves a block before you do, she broadcasts it and you'll receive the block through the p2p network. If that's a legit block, it usually makes sense to stop your work on the current block and work on the next one on top of the one you just received.

  if a new block is found also has this block'a Tx inside?

it's totally possible, depending on what tx you select and what tx the other miner selects

  Does somebody has a sample on the blockchain?

If you mine, then every scenario would be like this

  Do they then use those blocks, add Tx and match it to the blockchain?

if "those" means the new blocks you receive while mining, then no, you just accept it after validating it, and then solve for new blocks on top of that.

  How many Tx can go in a block?

as little as one (that pays to the miner), and as many as the number of tx that fills the block (such that the total size of tx data is less than 1 MiB)

  Are there also empty blocks?

yes if empty in the sense that no other tx except for the one that pays the miner. It happens more often in the early stage, but it still happens nowadays.


Is there a Bitcoin mining library? I write free software in my spare time. Some of my softwares are quite popular. Now i'm a thinking of a way to generate a little revenue. Using adware is not an option for me.

Is there a Bitcoin mining library ( maybe a .dll ) that i can bundle into my programs?

Trying to mine bitcoin on home PCs will generate you absolutely no income, to mine bitcoin you need a lot of hashpower which home PCs just don't have. So that isn't a viable way to generate revenue. But also, secretly mining bitcoin on peoples computers while they run your software is probably quite dishonest, if you tried such a thing you would need to ensure you let them know it was going to happen. And antivirus software would probably quarantine your file as a bitcoin mining trojan.


How do transactions fit into mining? One question about the inner working of the mining process:
I know there isn't such a thing as a block 30% or 99% mined, or a mine is blocked or it isn't, I get it. The thing is: how do the transactions that belong to a block (that dole out transaction fees) get incorporated into the block after it has been found. Are these transactions being processed along with the mining and that's what the mining process is all about?

The transactions are already there when you are mining. You are hashing the block header which contains a merkle tree root that connects the list of transactions and block header together.

After you hash a valid block header you can't add any transactions as it would change the merkle root and the hash would not be below the current target anymore, so the block becomes invalid. This is also the reason why you can't mine in a pool and take the coins yourself if you find a valid block. That would require changing the generation transaction, which changes the merkle root, and the block is then invalid.

Mining is both about generating new coins (they must come from somewhere) and processing transactions (we need a ledger that everyone can agree is the one true ledger).


I've deleted my wallet and never backed up my files. How can I recover my coins? I've deleted my wallet when I wiped my computer recently and never backed up my files. The only thing I've done was convert money into bitcoins and it was sitting in my wallet never touched. I reached out to the company that processed my conversion and they provided me with the necessary addresses that were used. How can I recover my bitcoins? Any help would very appreciated. Thank you.

First, don't panic!

Second, make an image backup of the wiped drive to a physically different drive.

Third, you maybe able to recover the deleted files with tools such as magic rescue so long as the sectors on your drive that your wallet was wiped from are intact... otherwise you may be out those coins... I've had OK luck with rescuing data off drives for friends but also some failed attempts to because of rewritten blocks corrupting deleted data.

In other words this will cost you in either time or in the coins you've lost. Right now you're in limbo and I would suggest you do a dd backup of your wiped drive and try to use recovery tools on the backed up drive image so that you don't accedentaly wipe the target data off the original drive.

I'll see what I can find in my notes in a few hours on the subject of drive imaging and recovery for ya.

Updates

Here's an edited version of my private notes on data recovery steps that I've used to recently recover a corrupted USB drive that was being used to backup a client's Windows user account files. Note file names did get mangled during the process so be aware that there will be cleanup after this process.

Setup

You'll need second drive with enough free space to house double the total number of bits of the target drive. Or in my case I had to get two drives of greater than 64gigs; one for the backup image and the other to receive recovered files. This is because we are going to be copying every bit off the target drive; even the zeros. In my case discussed here there was only 13~gigs used out of 63'ish but we still had to copy it all.
You'll need a USB or CD bootable Linux distribution. I used Kali Sana for my recovery because it has pretty up to date tools for this job but you might want to hunt for a specifically designed distro. Web search for terms like "USB recovery Linux distro" and you'll likely find a top 10s list of someone's testing results or recommendations; there be choices in flavor so I'll keep this based off my expenses with Kali.
You're going to need to locate the dev file path for your target drive, in this example it's /dev/hda but for you it maybe different. Hint use mount & blkid commands to show drives, their file paths and other info. Once located unmount it so you're normal programs don't write or read from it by accident. For example my target drive was mounted at the following umount command directory path

umount /mnt/usb/damaged

  Repeat above for any mount points associated with
  the target drive to be backed-up. For my revival there
  was two partitions associated with /dev/hda physical
  drive and both had to be unmounted. Also be on the look
  out for swap partitions associated with the target; mine
  didn't but if you roll the next command with any
  of the target drive's mounted you run the risk of a bad
  backup image being made to work from.

Backup command

dd if=/dev/hda bs=4K conv=sync,noerror | tee mybackup.img | md5sum > mybackup.md5

Be very very careful with the above because dd is not forgiving! Also note that the directory path is different than what was used with umount because we're now operating on the target drive a a whole and not a partition within the target drive. Hint, the previously mentioned  mount & blkid commands used to reveal mounted directory paths should have shown the dev related path too.

-if=/dev/sda should be the drive location of the hard-drive you need to recover data from. Don't include any partition numbers as you'll want every bit from start to finish.
bs=4K is the bite count per read/write (I think) and lower values will take longer but be less prone to errors.
conv=sync,noerror are options to keep dd chugging away even if there's a bad sector or two.
| tee mybackup.img redirects (and duplicates with tee) output from dd reading the target drive and saves it to mybackup.img. Note this fine path should not point to the drive your imaging; if you write to the same drive you'll likely wipe bits you want back for good from your drive because right now the addresses/sectors are marked as available for writing that use to contain your data.
| md5sum > mybackup.md5 takes the duplicated output from dd and writes a signature to mybackup.md5 same rules for file placement as the image file too.

Now the above is going to take some time; for the 64~gigs I had to recover I used an RPi board (cheaper on the electric bill) and ran the above in screen for one full night and half a day. The above also isn't going to give you any feedback or process until it's done. In other words, grab a book or watch a season of Firefly to pass the time.

Eventually it'll report the number of records in/out and the time it took in seconds. And we can roll some tools over the backup image instead of on the target drive; this means mistakes can be made and you're just out the time of making another image.

To verify that the backup image you've saved is good you can run the md5 command against the image file and compare against the one generated during backup. Furthermore if really worried you can roll the md5 command against the target drive and compare that all three signatures/fingerprints are equivalent. The following are steps that I used to verify the image I took.

dd if=/dev/hda bs=4K conv=sync,noerror | md5sum > drive.md5
## Above should modified to point to your target drive
## Bellow should point to your backup image
dd if=mybackup.md5 bs=4K conv=sync,noerror | md5sum > image.md5

Use cat to show the contents of each md5 file, they should all match or show the same human unrelated junk. Note for other readers, yes collisions (false matches) can happen but we're not trying to make any collisions so chances are low.

Tips for keeping sanity on next steps

if you've the space then make a backup of your backup because it's safer that way and will save your target drive from any accidents when having to start a whole new dd command ;-) beware of sleepy terminal user input.
if possible unplug/disconnect the target drive or attempt the next block of steps on different hardware operating only on your backup image.
take your time at this point. There's little reason to rush at this point, well unless you liked waiting for the next backup image to complete. Not going to judge if that's what you're into.

Optional, install Windows partition compatibility

## For many Debian/Ubuntu based distributions
sudo apt-get install ntfs-3g
## Kali Sana
sudo apt-get install ntfs-config
## and some Ubuntu flavors
sudo apt-get install ntfsprogs

Using apt-cache policy ntfs-3g, subbing in application name to check, it's possible to see which is available to your system if using apt and a package manager.

Install software for working with drive images

sudo apt-get install kpartx

Install software for working with partitions

sudo apt-get install parted
## Either above or below, 'g' stands for GUI
sudo apt-get install gparted

Install software for data recovery & inspection

sudo apt-get install safecopy magicrescue testdisk testdisk-dbg

Getting documentation

Any of the above can have its manual or help docs printed via the following syntax

man magicrescue
safecopy --help

About kpartx

Using kpartx the backup image can be opened and it's internal partitions can be mapped to the /dev directory for later mounting to a path(s). This bit is better in use cases where corruption or deletions do not need to be recovered from.

## Make some directories for the image partitions to be mounted to
mkdir -p /media/rescue_p1
mkdir -p /media/rescue_p2
## Map image to dev loop paths
kpartx -v -a /media/backup_drive/mybackup.img
## Note the output of above command it will be similar to below
##  but not identical.
mount /dev/mapper/loop0p1 mkdir -p /media/rescue_p1 -o ro
mount /dev/mapper/loop0p2 mkdir -p /media/rescue_p2 -o ro

Note the use of - o ro means read only. Remove it if you wish to do stuff without protection to backups and like loading another backup image.

Files within the drive image should now be available to the same extent as the original target drive, however, because your files where deleted and my client's files where corrupted then there's still more work to do. So let's un-mount for now and install another tool. For now know that you've this power of resurrection unlocked.

unmount /dev/mapper/loop0p1
unmount /dev/mapper/loop0p2
kpartx -d /media/backup_drive/mybackup.img

information gathering

Now some info about the drive image needs to be know for you to make use of the following block

## Take note of Disklable in following output
fdisk -l /media/backup_drive/mybackup.img
## Take note of Partition Table, Type, & File system
##  in following output
parted /media/backup_drive/mybackup.img
## you may have to look for quit (q) command to get back to the terminal.

Now prepared with knowledge about your drive the following blocks can be tried on your backup image

About testdisk

Test disk is a command line, menu driven, application. So be very aware of what context your keyboard input will be read under. To test disk recover any files we should first cd  to a directory safe for it to dump in to. For my recovery I mounted the second drive I had and changed directories to it as shown

mkdir -p /media/salvaged/testdisk
## mount recovery drive partition to above, then cd
cd /media/salvaged/testdisk
## start testdisk against image file
testdisk /media/backup_drive/mybackup.img
## Choose Analyse & Deeper-scan to go deeper
## Use bundled photorec program to try and recover deleted our corrupted files
photorec /media/backup_drive/mybackup.img

After using the above two recovery tools, the results can be reviewed using logs saved to your current working directory. Here's the command I ran

ls -hal /media/salvaged/testdisk | less -R5
## use letter q on keyboard to quit, arrow keys to
## move up and down though output in five row chunks
## and page keys to move though output based on
## the entire screen hight.

About safecopy

The safecopy tool can be used to read drives even when blocks within go bad. Supper useful if you run into a situation where a drive is reporting health issues or similar errors or into situations where partitions where messed with. It saves image files kinda like what we did with dd but unlike dd it's able to really dig into sectors marked as bad.

## Copy target drive source, bad block marks are listed in
## stage1.badblocks output file in your terminal's
## current working directory. They'll come in handy in the
## next steps.
safecopy --stage1 /dev/hda stage_one.img
## Attempt to read bad blocks marked in
## stage1.badblocks with no repeats marking ends
## of bad areas in stage2.badblocks
safecopy --stage2 /dev/hda stage_two.img
## Give no heed to bad blocks and attempt to copy
## everything. Note this next one will retry forever on
## every uncooperative block so it may take forever
## or just a ridiculously long time. Additionally if your
## target drive is a platter style then if there are problems
## with the mechanics of the drive this may cause
## increased ware and tare.
safecopy --stage3 /dev/hda stage_three.img

Next try any of the recovery tools already suggested to try and recover lost data. Even if these backups still don't have your data there are likely other tools you can try.

While there's still a chance that you've lost your coins, such as if a new file was written over it, the above steps should increase your chances at recovery. Try searching for terms like forensic drive imaging and similar to find even hope of recovering data from that state. Last but not least there maybe a place in your area that can open up the drive (it's platter style) and use specific tools for literally imaging the data off it; mom & pop tech shops and state level law enforcement are two good places to chat-up for suggestions on where they send out drives for full revival. However, that route will cost in time and in money so reserve this as last resort.

Hopefully the first image is the only one needed and you get your coins back without issue. In either case save these notes somewhere so that you can impress a luckier soul with your wizardry.


Private key security level Any of a kind Bitcoin wallet need to share private key on the internet-connected machine.

Bitcoin client has no responsibility for to keep private key secure. If your's machine connected to the internet, your keys can be hijacked, because your machine can be hacked before you import keys.

The questions is, how to trust any of existing wallets to store private keys?

Any of a kind Bitcoin wallet need to share private key on the internet-connected machine.

This is false. You can keep private keys on a completely offline computer, but still submit transactions to the network. To do this:

Create a wallet that will store your private keys on an offline computer. This wallet will be used to sign txs
Create a wallet on an internet-connected computer. This wallet will be used to generate (unsigned) txs, and submit (signed) txs to the network
Generate an unsigned transaction on the internet-connected computer
Transfer the unsigned transaction to the offline computer (eg. via a fresh USB drive).
Sign the tx using your offline wallet
Transfer the signed transaction back to your internet connected device, and broadcast the transaction to the network.

This way, your private keys are kept offline, so an attacker would need physical access to the machine in order to steal your funds.

Note that hardware wallets follow a similar scheme: the private keys are isolated within the device so that the computer you plug your hardware wallet into cannot access them directly.

A less secure but still good solution is mobile wallets, seeing as a mobile OS will generally have a smaller attack surface than a desktop OS (eg compare iOS to Windows). Generally, there is a smaller chance of having a phone infected with malware than your desktop machine. For best practises, you could run a full node and point your mobile wallet at it, but I would generally not advise storing large amounts of cryptocurrency on a phone.


How can a single person operation keep a collection of online wallets secure? While this question is similar to others about securing wallets, I think it merits a question of it's own.

One thing that has dissuaded me in the past from running an online wallet service of some kind is the worry that I could be compromised (rubber hose, extortion, intimidation etc) and by extension permit full access to a large collection of bitcoins that I don't own. If I'm running an operation with potentially millions of dollars worth of bitcoins and my contact details become known (not that hard to find really) then I'm naturally a risk to my clients.

I've heard of multi-key encryption so that no one person has complete access (client PIN etc), but I'm not sure if that would solve the problem.

So my question becomes how can a single person operation ensure that they are unable to compromise the wallets under their care? Ideally the answer would not require any technical knowledge on behalf of the client beyond a passphrase.

(If such an approach became commonplace then it could act as a deterrent because attackers would simply see that the website uses that approach and slink away.)

This is a great goal, which many people will assume just can't be done.  But remarkable strides are being made in the field of secure cloud computing via homomorphic encryption.

These schemes allow servers in the cloud to perform computing tasks (currently only a limited set of arithmetic) on encrypted values without decrypting them.  See more at In what ways does Full or Partial Homomorphic Encryption benefit the cloud? - IT Security - Stack Exchange

A question about applying this to Bitcoin clients on Less Wrong is here: Homomorphic encryption and Bitcoin but they seem to be confusing homomorphic encryption with a form of secret splitting between two computers, which would not meet the goal outlined here.

I'm guessing that current homomorphic techniques are inadequate or too slow or both for bitcoin, but I'm not sure.  But further research may make it practical.


What type of power supply do Gridseed G-Blade need? I have recently purchased 2 Gridseed G-Blade Miners, not realising the power supplies didn't come with them.

Do I need a specific PSU to power them? Or can I get an AC adapter and plug them straight into the wall?

Either solution will work fine. For reference, check out these two setups:

https://www.youtube.com/watch?v=nCjSQMsdlKg

https://www.youtube.com/watch?v=2QrkWR5HdcQ

The former video illustrates use of AC adapters and the latter illustrates use of an external PSU.


Can I trust the peers I am connected to? From my understanding of Bitcoin, it operates on a P2P network. Having just downloaded a wallet app, I see it is connected to 6 peers. Does the Bitcoin protocol rely on trusting these peers? What does it mean if these 6 peers turn out to be fake, and I'm part of a 'micro-economy' rather than Bitcoin proper?

Your understanding is correct. What you describe is known as a Sybil attack, here essentially the p2p version of a man-in-the-middle attack.

In general, Bitcoin requires very little trust, as each peer can check whether new information adds up with the information that was previously gathered. The attacker could use this constellation to relay a transaction to the attacked, e.g. make a store believe that an incoming transaction has been sent on the Bitcoin network, while instead sending the competing double-spend to the network.

However, the attacked could notice that he is not receiving any new blocks from the network (as otherwise the double-spend might be detected early). I.e. the attacked is not part of a real 'micro-economy', but rather just cut off from network updates.

In order to truly create a 'micro-economy', the attacker would have to actually mine fake blocks at the current difficulty in order to pass off false information as true, requiring immense hash-power at his disposal.

However, as one legitimate peer is sufficient to defeat this attack, you can either set your Bitcoin client to connect to certain peers only, or at least force it to connect to two peers that would not cooperate with each other to defraud you, in order to defeat the attack.

Edit:

Actually, I just realized that the Bitcoin.it has a paragraph on the Sybil attack.


Blockchain download taking many days I'm trying to download bitcoin core (ultimately want to run a node off my laptop). However the blockchain seems to be taking a (very) long time to download. I've read in some posts it might take up to a day, but this is taking way too long.

Any feedback/changes you suggest?

It's normal for it to take a long time, the whole blockchain is >120 GiB at this point. You can download a bootstrap.dat torrent, but at this point, as you have already a lot of it downloaded via Bitcoin Core, it won't be any faster.

On the other hand, perhaps you would want to reconsider running a node. 120 GiB is quite a lot and you neither can hope for block rewards nor is your security any better* compared to a light wallet, such as Electrum. There are many other light wallets, I just don't know much about their security.

* See below:

  Simple Payment Verification (SPV) is a technique described in Satoshi Nakamoto’s paper. SPV allows a lightweight client to verify that a transaction is included in the Bitcoin blockchain, without downloading the entire blockchain. The SPV client only needs download the block headers, which are much smaller than the full blocks. To verify that a transaction is in a block, a SPV client requests a proof of inclusion, in the form of a Merkle branch.


bitcoin-qt ignored user input for fee calculation My blockchain isn't synced yet. Thus, fee calculation didn't work. Therefore, I chose user defined fee and entered what btc.com suggested.
But my bitcoin-qt (v0.20.1) went for 255 satoshis instead of some 10 thousands or so. (A rough guess, since I can't recall the actual amount any more.)
The question is: Did I encounter a bug or is there some hidden magic involved?

I believe you're confusing units here, and entered a value intended as sat/vB in a place that expects sat/kvB.
Perhaps you intended to use 40 sat/vB (=40000 sat/kvB, or 0.0004 BTC/kvB), which would translate to around 10000 sat (or 0.0001 BTC) for a typical transactions.
When interpreted as 40 sat/kvB, it would be far below the minimal relay fee on the network (1 sat/vB, 1000 sat/kvB, 0.00001 BTC/kvB). The sender software you used may have rounded it up to 1000 sat/kvB instead, and used that - which may translate to 255 sat for a typical transaction. That is far below the current blockspace market rate, and may explain why your transaction hasn't even propagated (blockchain explorer sites don't even show it as unconfirmed).


What situations will you lose your bitcoins during backup? I read this paragraph from bitcoin.it but I don't get it completely.

  The wallet contains a pool of queued keys. By default there are 100
  keys in the key pool. The size of the pool is configurable using the
  "-keypool" command line argument. When you need an address for
  whatever reason (send, “new address”, generation, etc.), the key is
  not actually generated freshly, but taken from this pool. A brand new
  address is generated to fill the pool back to 100. So when a backup is
  first created, it has all of your old keys plus 100 unused keys. After
  sending a transaction, it has 99 unused keys. After a total of 100
  new-key actions, you will start using keys that are not in your
  backup. Since the backup does not have the private keys necessary for
  authorizing spends of these coins, restoring from the old backup will
  cause you to lose Bitcoins.

Can someone explain this in a clear way, especially the bold parts?

Note: Since Bitcoin Core uses deterministic wallets (BIP32) now, this behavior does not apply to new wallets created with Bitcoin Core versions 0.13.0 and newer. It does apply to old wallets created with previous versions that were carried over to the new versions of Bitcoin Core!

When you do certain actions (usually a send), a new key is generated. Your backup pre-generates 100 of these keys. Once you need more than 100 keys generated, your backup no longer knows about the new keys. This means you should perform backups regularly, at least every 100 transactions.


Recover $220 Million Worth of Bitcoin Locked in a Self Destructing Hard Drive A NY Times article recently ran a story of Stefan Thomas who has $220 million worth of Bitcoin locked up in an encrypted hard drive:

Stefan Thomas, a German-born programmer living in San Francisco, has
two guesses left to figure out a password that is worth, as of this
week, about $220 million.
The password will let him unlock a small hard drive, known as an
IronKey, which contains the private keys to a digital wallet that
holds 7,002 Bitcoin.

I am familiar with this discussion on SE which analyzes possible vectors to retrieve the actual PK using brute force. However, in this specific case we are trying to retrieve the password, not of the actual Bitcoin wallet but of the hard drive. Once the password to the hard drive is found, the PK would be known automatically. The main issue is that the hard drive will self destruct after 10 failed password attempts (8 attempts have been tried so far in Stefan Thomas's case).
What possible vectors are available to retrieve Bitcoin in this case? My first thought was to copy the contents of the hard drive to many different drives and try to brute force each copy separately. This way when one hard drive self destructs you can always continue brute forcing on the other. Obviously, this won't be cheap but it might be worthwhile depending on how much Bitcoin is at stake. However, there might be something specifically about IronKey that prevents copying?
Is copying hard drive an effective/feasible strategy? If not, what other possible vectors should one consider to tackle this problem?
Thanks

I'm not sure on the specifics of this particular model, but usually the way these work is the encryption key is stored on a hardware security module, which is a physical chip that performs the encryption and decryption of the data given the right password.
To my knowledge you cannot make a copy of this physical chip, and once your attempts at entering the password run out, the chip will permanently wipe its copy of the encryption key. This chip is the thing that is checking your password, so it's this chip you would have to somehow duplicate.
With a lot of effort, you could probably desolder the flash memory chips and attempt to make a copy of the encrypted data itself. However, this encrypted data is generally protected with a 256-bit AES key (with has nothing to do with your password), of which the only copy was on the encryption chip, which the chip wiped when your password attempts ran out. So, this would be pointless.


In case of the Bitcoin split - when holding BTC on blockchain.info - will I receive coins on both forks? Everyone says:

  If you do not hold private key to your BTC, you do not own BTC.

Technically speaking I do not hold the private key, but I do have the 12 words backup phrase.

I would like to know if my funds are safe - will I receive coins on both forks - in case of the chain split?

Yes, blockchain generates address deterministically as per BIP 44, and uses mnemonic backup phrases as per BIP 39, so you can recover all your keys using that mnemonic. It is compatible with any other wallet which follows BIP 39 and 44, and because it allows you to regenerate your private keys, it is equivalent to backing up the keys themselves. So you should be safe.

References:

https://support.blockchain.com/hc/en-us/articles/115001298143-Your-Recovery-Phrase-The-Failsafe


Does mining without a realistic chance of solving a block provide any benefit to the network? Okay, before anyone votes to close this as a duplicate, I would like you to hear me out.

Since I began using Bitcoin, I always thought about miners as the people that effectively "host" the bitcoin network as if it were a website. I know this isn't entirely true, but its the analogy i've been using for a while.

What I want to know is if I mine Bitcoins on my mid 2011 iMac with the sole intention of helping the bitcoin network, will I be providing any real benefit to the network or will I just be fruitlessly trying to solve problems when the bigger, faster, mining-dedicated computers will ultimately beat me to it?

EDIT: Also, as an extension of my question above, could I be one of those miners that tweaks he software and only processes transactions with no fees to provide a greater benefit or would this approach still cause me to get out-hashed by bigger, better computers?

TL;DR:
Mining is heavy duty number crunching, your iMac is useless for that. Running a node helps the network and gives you your own copy of the blockchain. Your iMac should probably be able to do that.

Mining

The purpose of mining is to 1. achieve consensus about the state of the network, 2. confirm transactions, and 3. initially distribute the bitcoins. For mining your machine continuously shuffles the unconfirmed transaction pool and tries whether the current jumble resolves to a valid block. To contribute to the network, you have to have a chance at succeeding at finding a block. With a "mid 2011 iMac" you do not have a chance at succeeding at mining, as explained on In the ASIC-age, is it worth starting mining Bitcoin at home?. Its computational power for the purpose of mining doesn't register, it's a waste of money, time, and unnecessary wear for your hardware. To have any kind of effect, you need an ASIC today.

Running a node

The purpose of running a node is to 1. relay information in the network, 2. check the work of miners for validity, and 3. to have your own copy of the blockchain. Catching up with the network requires some computational effort, but nodes can be run on fairly lean systems. Personally, I run a node on a RaspberryPi 2B, it took roughly eighteen days to synchronize with the blockchain, but is now happily churning along. You can do that with your iMac, but really it's only useful if you either have it running a large part of the day (at least 6h), or are interested in having your own copy of the blockchain. Not sure how well an iMac deals with permanent load though, so maybe it's not the best machine for a 24/7 gig.


Is it possible to brute force bitcoin address creation in order to steal money? Bitcoin users frequently generate new addresses for each transaction they make, which greatly increases the number of bitcoin addresses being used to receive money.

Would it be possible (and profitable) for someone to find collisions in the bitcoin address space in order to steal money?

It is possible to brute force some Bitcoin addresses, because some people generate their private keys in an insecure manner.  Any (non-zero) 32 bytes can be a private key.  So running sha256 over a passphrase gives an apparently random, but brute force-able private key.

Take sha256("sausage") for instance:

$ echo -n 'sausage' | sha256sum
30caae2fcb7c34ecadfddc45e0a27e9103bd7cfc87730d7818cc096b1266a683  -

Load up bitaddress and paste that private key into the 'wallet details' tab to get the corresponding Bitcoin address, then look it up on blockexplorer:

$ GET http://blockexplorer.com/q/getreceivedbyaddress/1TnnhMEgic5g4ttrCQyDopwqTs4hheuNZ; echo
0.01000000

and you'll see that the address held one bitcent for about 2 days in February 2012.

See also: "fuckyou", which held 2.5 bitcents for 12 festive days at the turn of last year.

So in practice it's possible to brute force bitcoin address creation, but only for poorly chosen passphrases.  These were probably just people playing around with the idea of "storing bitcoins in their head" which is why they are for such small amounts, and why they weren't left funded for long.

No address balances were harmed in the making of this answer.


Get the historic circulated suppy I'm looking for the historic circulated supply of Bitcoin.  I'm aware I can get the current supply by creating my own node.  But I need the supply at a given date.
Does anyone know of an API to get it.

gettxoutsetinfo will return the current supply in total_amount so it doesn't help. getblockstats doesn't return supply info for the block.

Bitcoinvisuals has the supply chart and you can move the cursor over the chart to know supply at any given date in past.

Since we know block rewards (new coins added to supply) and they are reduced to half after every 210,000 blocks, we can also write a simple script to know the supply at any given block:

def btcSupplyAtBlock(b):
    if b >= 33 * 210000:
        return 20999999.9769
    else:
        reward = 50e8
        supply = 0
        y = 210000
        while b > y - 1:
            supply = supply + y * reward
            reward = int(reward / 2.0)
            b = b - y
        supply = supply + b * reward
        return (supply + reward) / 1e8

if __name__ == "__main__":
    block = 1000000
    print(btcSupplyAtBlock(block))

Source: https://github.com/ndsvw/Bitcoin-Supply-Calculator

There are lot of third party APIs available like coinmetrics to achieve the same.

In 3 the script will not include lot of exceptions mentioned in this answer by sipa: https://bitcoin.stackexchange.com/a/38998/


Is a mined block invalid as soon as another block is added/accepted? If all the miners are working on adding to the central blockchain, what happens if a miner (A) submits their valid block just seconds after another miner's block (B) has been accepted and added to the chain?

Since the new hash-value of the last block in the chain changes with the newly accepted block (B), does that make the computed hash (A) invalid?

Blockchains can conceptually easily acquire two or more heads if blocks are solved at the same time. Eventually one of the heads will grow longer than the other, in which case the transactions in the shorter one cease to have ever happened as miners switch to working on the longer one.. This is one reason to wait for a reasonable number of confirmations (blocks on top of your block) before letting the guy drive away in the car he just paid bitcoins for :)

There's another stackexchange thread discussing the longest orphaned chain heads - What is the longest blockchain fork that has been orphaned to date?


Detecting stale blocks with ZeroMQ I'am writing an application which receives information about new tx and blocks via ZeroMQ. There is a chance that I will receive notifs about blocks which will later on become stale blocks. Is there a way to verify whether the block has become stale?

I don't believe there is a direct way to do this via ZeroMQ. Your best bet would be to validate the ancestry for each block as you receive it.

When you receive a block, check its parent hash against blocks you have already seen. If the parent chain validates and you do not have another, longer child chain from the parent block already, you can accept this block.


Why do all addresses begin with "1"? Why can't we just delete it? The title is the question :)

All the addresses I have seen - from the very first block http://blockexplorer.com/b/0 to the very last one http://blockexplorer.com/b/229850 all begin with "1".

Why is that? And - if it's really like that - why do we need the redundant number there and not just cut it and make the addresses 1 letter shorter?

If an address begin with "1" then it's a hash of a public key, "3" for a script hash, "5" for a private uncompressed key, etc

You can find a list of all prefixes here: https://en.bitcoin.it/wiki/List_of_address_prefixes


What is the mechanism of determining the transactions of a new block I am newbie in the Bitcoin field.

I have read about the transactions, blocks, blockchain and other materials.
As I know, when a new valid block is found and announced by a user, other users start working on the next block. But what is the mechanism of determining the transactions of the next block. I mean which transaction are going to form the new next block? Is that all transaction broadcasted before the announcing of the last valid block?

Thanks in advance!

All nodes (not just mining ones) maintain something called a mempool, a collection of all of the validated transactions they have seen on the network which have not made it into blocks so far. A miner is free to take all of them that will fit, a subset which satisfy their own requirements, or none of these transactions and assemble them into a candidate block. The block they assemble is invalid until they find proof of work that satisfies the current difficulty, if they find the correct nonce for that block it becomes valid and they can broadcast it to the network. If someone else finds a block before they do, the candidate block is discarded and a new one assembled to work against.


How does a miner insert the hash of a merged-mined alt chain's transaction into a Bitcoin transaction? I've read the how does merged mining work? thread and I'm a bit confused as to how one of the transactions in the bitcoin block "stores" the hash of the Namecoin block. Where is this information stored in the transaction sent to the bitcoin network? As a recipient address? Somewhere else?

A 44-byte header cointaining:

magic: 0xfa, 0xbe, 'm', 'm' (only required if over 20 bytes past the start of the script; optional otherwise)
block_hash: Hash of the Namecoin block header
merkle_size: Number of entries in aux work merkle tree.
merkle_nonce: Nonce used to calculate indexes into aux work merkle tree; you may as well leave this at zero

is included in the scriptSig of the coinbase transaction in the Bitcoin block and sent to the Bitcoin network. Note that it is only sent to the Bitcoin network if it meets the network difficulty of Bitcoin. If it only meets the difficulty of Namecoin, it is only sent to the Namecoin network.

Source: https://en.bitcoin.it/wiki/Merged_mining_specification


Why should one invest in an ICO? When you invest in an ICO, you get a bunch of tokens in return. From what I understand, these tokens don't generate any dividends, hence they are essentially worthless. Why should one buy them?

Let's compare with buying stocks in a company: The reason company shares have any value is because of dividends (or other profit sharing methods). If a company promises to never distribute any profit to its shareholders, the stock is worth exactly zero. No one would buy them.

I'm trying to make sense of this and I'm certainly missing something here.

Do crypto-coins themselves (bitcoin, litecoin, ethereum and 100500 other shitcoins) generate dividends? :))))))))

the answer is: ponzi pyramid scheme. point.


How can one join and leave Blockchain network? As a newbie, it seems a bit abstract for me to imagine how Blockchain works! I'm curious that how my friends and I can join a Blockchain network? When we don't want to stay, can we silently leave and how can we do that?
Well, they may be stupid questions but as a beginner, I really want to understand them as clearly as possible.
Thanks a lot for your help

Let's say you want to send an email, so you type your email adress, your password and log in to your mail box, you type the mail receiver adress, and then send the e-mail
In case of Bitcoin, you want to send 0.001 BTC, so you log in to your wallet (A full node or an application in your phone or your desktop) you type the BTC adress, you type the amount, and then send the coins.
When you log in to your wallet, it's like you are connected to the blockchain via a node, when you sign out from your wallet you are no longer connected to the blockchain


How can I build custom bitcoin network and start with bitcoin codebase I am new to Bitcoin. My understanding about Bitcoin is gained by ready Bitcoin original paper and several blog posts on the Internet. However, my ambition is to understand the whole bitcoin codebase on Github and be able to modify it to support my experiments.

Right now, there are some steps that I think it's beneficial to start with:

Try to run and build up my own custom network (first transaction that initially create 50 bitcoins, create some wallets to spend bitcoins around, try to understand the blockchain on that custom network when it's small).
After that custom network built, I hope I would understand how transactions, blocks, validation, broadcasting, mining reward earning,... are handled.
With those things understood, I try to find, read and understand the corresponding codes in the code base.

Do you think those steps is a good way for me to start with Bitcoin? I'm currently stuck with step 1. I could only compile the codebase and run the bitcoind then get lost, know nothing to do afterward.

Try reading the book Mastering Bitcoins by O'Reilly Chimera, this should help in understanding the bitcoin network, process and the principles involved.

Here is a guide (from bitcointalk.org) on how to make a new altcoin by cloning the bitcoin code.

I would suggest understanding the process before trying to make your own custom network


Sequence of events that can cause lost money in MultiBit If you create a new address in MultiBit, then transferred money to the new address before the wallet was backed up, then your hard drive crashed, will you lose the money?

The first Bitcoin client had 100 addresses, hidden. You could send to a new address and it was most likely already backed up. Does MultiBit do that?

When you create a new receiving address it is written to disk and backed up locally (ie on your disk).

If your disk was destroyed or stolen you would lose your bitcoin yes. This is why we recommend backups on another machine or USB drive.

There is no hidden key pool in MultiBit


How to retrieve Trezor wallet with recovery seed? I've been at this for days now without finding the links to click on.  I have a Trezor wallet that I bought years ago.  It has some bitcoins on it.  I have the recovery seed, but I lost the pin.  From the instructions I understand that I needed to wipe the wallet before I could start the recovery seed process.  I wiped the wallet, but cannot find the proper links to click on in the active wallet window in order to recover the bitcoins from the old seed.  I have spent a lot of time reading all the advise, but still cannot find where to click.  Please Advise, Thank You.

Instructions for recovering Trezors can be found on Satoshi Labs' documentation site here: https://doc.satoshilabs.com/trezor-user/recovery.html


Multibit - Failed to create a Selector I installed MultiBit a few weeks ago and today it's not loading anymore. It displays the following Error in the logs:

    The Blockchain "C:\Users\USER\AppData\Roaming\MultiBit\multibit.spvchain" could not be loaded. The Error was "org.jboss.netty.channel.ChannelException Failed to create a selector.".

I already tried deleting that file and then let multibit recreate it, but it doesn't help.

What am I doing wrong?

It sounds like there is a problem in the locally stored block store file.
You should be able to solve this by doing the following:

Find where MultiBit is storing your user data - this is shown on the very first line in the 'Message' tab when you start up MultiBit. (It is also explained in the help in 'Troubleshooting'.)

Shut down MultiBit

Go to your MultiBit user data directory - worked out above - and delete the file multibit.spvchain

Start up MultiBit again

MultiBit then syncs from a month or two ago and you should be running ok at that point.


What prevents broadcasting of fraudulent transactions I see a lot of questions and articles about why someone can't generate fake coins, maliciously attack the network, and essentially security discussions focused on the generation and interception of coins.  With the blockchain being described as a ledger, what prevents someone from simply broadcasting a transaction moving a small amount (fractions) of coins from one account to theirs?  Or can coin movements only be originated from the source address?

Validation.

You can totally broadcast a fraudulent transaction, but nodes in the network will ignore it as it is invalid.

Furthermore, nodes will also ignore any blockchain which contains any fraudulent transaction. As a result, miners are financially disincentivized from doing so.


What's the difference between a Bitcoin Wallet and a Bitcoin Exchange? I was thinking about investing a small amount of money in Bitcoin: actually I'm having second thoughts about this, after all the fraud stories I've been told about on the Personal Finance site. However, that doesn't affect this question.

Reading this Investopedia article, I discovered that one should create a Bitcoin Wallet before buying Bitcoins on a Bitcoin Exchange such as Coinbase or Kraken. I don't understand why I should do that, isn't enough to download the Coinbase app, for example? Also, the link says that

  While exchanges offer wallet capabilities to users, it’s not their primary business. Since wallets need to be kept safe and secure, exchanges do not encourage storing of Bitcoins for higher amounts or long periods of time. Hence, it is best to transfer your Bitcoins to a secure wallet.

What's the reason for that? If I buy stock options, no one would object to me keeping them invested for years. Then why can't I leave my investment on a Bitcoin Exchange for a long period?

Do I risk that the Exchange goes bankrupt?
Do I risk that someone hacks my account on the Exchange? If so, is that common?
Something else?

Basically, I want to understand if, for the sake of investing a small amount of money in Bitcoins, it makes sense to put my "pocket  money" in a Bitcoin Exchange and leave it there for a few years, or if the risk  of fraud/hacking is so high that I should not do that. Note that this has nothing to do with the volatility of the Bitcoin investment - I'm ok with making a risky investment (a gamble) since it's just very little money. But I'm not ok at all with having my money stolen, even if it's a small amount.

A bitcoin (or any crypto) wallet is simply a set of public/private keys. If you own the keys, you own any coins that those keys can access.

An exchange is very similar to a stock exchange. You exchange one asset for another. Exchanges come in many forms, such as decentralized (etherdelta), wallet-less (Shapeshift, Changelly), and the more traditional ones such as Bitfinex and Binance.

The first two kinds don't offer a wallet service. Coins are sent directly from a wallet you control to the exchange, and whatever you bought is sent directly to your wallet. These exchanges effectively offer no custodial service. It's like going shopping at a store. You take out cash from your wallet, give it to the store, and collect your goods and leave.

These exchanges, while around, are harder to use for the average user, and considerably slower due to the transactions needed to move crypto in and out. This results in less than ideal pricing and liquidity.

The regular exchanges solve this by offering both a wallet service and an exchange service. You can deposit coins and leave them in the exchange's custody, and then trade the amount you deposited instantly, without needing to make a transaction. Coins you buy are similarly credited to you on the exchange's platform, but are not truly in your control until you withdraw them to your own wallet. This is more akin to shopping at Amazon - You pay them, and you're told "Hey, you've paid me, and this item now belongs to you". But until the item is actually shipped to your own house (and thus put under your control), there is still a possibility that Amazon could default on that promise.

By using exchanges that act as wallets, you definitely run the risk that the exchange is fraudulent or can get hacked, or your account can be compromised. The general advice is that one only keeps funds they are actively trading on an exchange. If you plan on just buying a coin and keeping it for weeks/months/years, it is recommended you buy it and withdraw to a paper or hardware wallet.

For smaller amounts of money, you can also use programs such as Electrum to create a wallet that you control, and withdraw your coins to that.


Bitcoin initial communication diagram I'm trying to understand how exactly does the Bitcoin client communicate initially with another client, as I'm making my own client and learning new things about TCP protocol. As I understand, the Bitcoin client uses the standard port (8333) as a server port that is listening to other clients' communication, and the client opens up new ports as it is trying to communicate with other clients. As I'm not sure if I understand the communication correctly, I made this chart:

My question is: is this diagram and my assumptions correct, or did I make some mistake in understanding how the protocol works?

You're pretty close, with the deviations being I think primarily in terminology.

Client A listens for connections on port 8333. Listening is a server activity.

Client A chooses an ephemeral port and opens a connection to the address of Client B on port 8333, on which Client B is listening. At the TCP level, there is a three-way handshake to establish the connection. Imagine this connection as a bi-directional pipe to and from which both clients can read and write.

Once established, Client A sends Version and Client B receives it. Client B sends Version and Client A receives it. Client A sends Verack and I think Client B also sends Verack, which is an acknowledgement of the version compatibility or receipt.

This is my understanding.


bitcoind getrawtransaction has no value for vin, what am I doing wrong? I’m able to get the value for vout but my node is not returning the value for vin, how do I get the value for vin?


Does the Merkle Root get constantly updated inside the block or does it only get added once the block is completed? So, pretty much just the title. I'm just wondering how the Merkle Root works exactly. I know it's the result of pairing transactions and then hashing them until the last transaction in the block, but when is this done? Is it constantly updated while the block is getting mined, or is the Merkle Root only calculated when the block is completed?
Thanks.

Once the mining pool has the list of all of the transactions they are including in that block, they calculate the merkle root for this list of transactions, then they distribute the block header, that includes the merkle root, to miners to work on.
So, no, it's not constantly being updated, unless for some reason a new transaction was being added or removed from the list of transactions being included in the block.


How can we use Blockchain for Land Registration Use Case? How and where can we integrate Blockchain in this use case?

Say buyer and seller visits the registration office with sale deed they prepared.
The details in the sale deed is compared by the registration analyst with the land database.If the details match the registration officer will sign off the document.

Have some good old fashioned digital signatures from buyer/seller/registration officer on the documents and use opentimestamps.org to securely timestamp it. Let all parties involved keep a copy (encrypted or not) of the documents and you're done.

You don't need a blockchain.


Is a Bitcoin address guaranteed to be unique? I may have misread this but apparently every time you generate an address it is not checked against any other addresses generated? The reason being the sheer scale of the amount of possible addresses that could be generated makes the probability of generating two of the same addresses almost impossible. If that is the case, that would mean the same for the private key. What would happen if by some chance two addresses were generated equal?

It is correct: new addresses are not checked against any existing address.
Cryptographically speaking, those addresses look like completely random strings (that is they are indistinguishable from a real random string).
Interestingly, Bitcoin addresses used in transactions are not even bound to be real: you can put whatever random string (of course in that case you would lose your money :).

Now, still cryptographically speaking, that "almost impossible" means that the probability of that event to happen is the same for you to be hit by a lightning 5 times in a row on a sunny day...(or something like that :)
What I mean is that even though the event is mathematically possible, it is impossible in practice.

That said, in case it actually happens,
the person who generated the colliding address would also have the same private key, giving them the ability of spending all the coins associated to the original address.


What technologies one should learn to become mature in cryptocurrency I am a web developer. I've been reading a book about BitCoin, decentralization, and the blockchain, which has blown my mind and piqued my curiosity. I am now thinking about taking the CryptoCurrency train.

My goal is to have a full understanding of the Blockchain technology in the future, and all the technologies linked to it; to be able to understand problems and find solutions, and contribute to open source software.

I am aware that this field includes cryptography, security, programming, and networking, although my experience is very limited in these areas.

I'd appreciate it if someone could point me to the most central and specific things I need to learn first in order to move faster in my learning of these topics.

Studying Bitcoin and it's core protocols is the best place to start if you want to take the 'blockchain train'. Almost all cryptocurrencies today are bitcoins code forked and changed for their respective implementations However, for the concepts required in understanding bitcoin, I suggest the following pre-requisites.

Mathematics

Probability: Basic probability theory for understanding the calculations about the probabilities of deriving private keys using brute force. Although you might not be able to fully understand whats given in the white paper, for which you might need some more knowledge.
Permutations and Combinations: Basic knowledge to calculate the numbers involved in finding the probabilities.
Byzantine General's Problem: Understand the problem and the possible solutions

Cryptography

Cryptographic hash functions (SHA-2, RIPEMD160): In depth knowledge would obviously help, but just a gist of what they do would suffice
Digital Signatures: After getting a grasp over what they are, you should take an in depth look into ECDSA's which would help you in appreciating the mathematics and the sort of 'invincibiltiy' of the underlying algorithm and further strengthening of the same in the bitcoin implementation

Data-Structures

Linked Lists: Basic knowledge of linked lists
Trees: Basic knowledge of trees, different kinds of trees. Concentrate more on binary trees and later on what merkle trees are
Stacks: How stacks work and some basic implementations of the same

Networking

Basic knowledge of networking like IP, broadcasting/multicasting, P2P networks (torrents) would suffice

After getting a good grasp on the above topics you can continue with the book you have mentioned, or if you want videos, then there is a playlist on youtube by Princeton University on Bitcoin and cryptocurrencies, the first three lectures would be enough for you to start programming and getting your hands dirty with the Bitcoin Core software


Should I be worried that bitcoincore.org now suddenly only provides an "unsigned" Bitcoin Core installer? My security script for downloading and verifying new versions of Bitcoin Core barked at me the other day, when the new v0.21.1 was released. (Which still is nowhere to be found on bitcoin.org, BTW.)
At first, I thought it was a temporary glitch, but now it's been like this for at least three full days. The reason it "barked" is that my script is expecting ...win64-setup.exe, but that file no longer exists. Instead, it's called: ...win64-setup-unsigned.exe.
See for yourself: https://bitcoincore.org/bin/bitcoin-core-0.21.1/
So, they are no longer making "signed" installers? Beginning with Taproot? Hmm... Something about this feels scary to me. Maybe I'm too paranoid, but after all, you can't be too sure when it's about your entire "wealth".
Isn't it something bad if the installer is no longer "signed"? Isn't that a step backwards security-wise, when a major update is being added to Bitcoin Core? Smells a bit fishy to me, frankly.

Beginning with Taproot? Hmm... Something about this feels scary to me.

Your mistrust is misguided.

So, they are no longer making "signed" installers?

The releases are still signed with the release GPG key, what is lacking is the Windows specific binary signatures which have to be made by a paid certificate by one of several authorities Microsoft has trusted. Bitcoin Core being an open source project is having issues getting a new one issued, this is called out specifically in the release notes.
The only thing this changes is that there will be a warning when the binary is first run, it is completely meaningless  to the actual security of the system as there are other stronger verification methods already in place.

Binaries in that folder are still built using Gitian and are still verifiable as being compiled from the source code if you so choose.
Gitian binaries are still signed by hoards of people who attest that they got the same result as everybody else.
Binaries are still signed by the same GPG release key as always.

Which still is nowhere to be found on bitcoin.org, BTW

See this issue on GitHub for discussion.


Connect to regnet from my WalletAppKit Android app I'm developing a simple app to learn how to use the bitcoinj library. I'm using the WalletAppKit object to simplify the process and I'm following the official documentation.

When developing I prefer to use bitcoind regtest mode as it's faster than the testnet3 and I don't need to be connected to the i

if (params == RegTestParams.get()) {
    // Regression test mode is designed for testing and development only, so there's no public network for it.
    // If you pick this mode, you're expected to be running a local "bitcoind -regtest" instance.
    kit.connectToLocalHost();
}

I was playing with the WalletTemplate example desktop app and it works just fine on the regnet. Now I'm trying to do the same on my Android app but I don't know how to connect it to my regnet instance running on my machine.

Does anyone know how can I do that?

Thanks in advance,

Felipe

If you're connecting to a bitcoind regtest node and you're trying to connect as an RPC client to it via bitcoinj, it's possible.

Figure out what your Android's IP address is, say x.y.z.w and use the -rpcallowip parameter in bitcoind to allow your (remote) Android app to talk to the regtest bitcoind node.

Spawn bitcoind like this, for example:

bitcoind -debug=1 -printtoconsole -server \
    -regtest -listen -rpcport=8332        \
    -rpcuser=yourrpcuser -rpcpassword=yourrpcpass -rpcallowip=18.138.5.97

WARNING: Security-wise, keep in mind that the RPC password is transmitted over the network in plaintext.


Is my idea of getwork protocol for bitminer right? I am trying to understand the idea behind getwork protocol, by sniffing my communication with a bitminter miner pool.

Previously I have read the discussion here, but looking at my packets, I think that there are some things which are implemented differently. I can understand that my question can be too vague, because mostly I am expressing my ideas how the protocol works, which can be totally wrong. But please do not be too harsh.

I want to go through the protocol and explain my thoughts, if I am wrong at any point of time, please explain me were I am wrong:

1) my client is authorizing on the server by sending post request

POST/HTTP/1.1
Content-Type:application/json
Accept:application/json
X-Mining-Extensions:longpollbcidmidstaterollntime
X-BCID:somenumber
X-Mining-Hashrate:my
Authorization:mySignature
Content-Length:39
Host:mint.bitminter.com:8332
Connection:Keep-Alive
User-Agent:BitMinter/1.3.0[BitMinter]

As far, as I understood the client is just telling what extensions it can support, his hashrate (based on this a server will give him a work to do), his authorization credentials.

A few things I can not understand here. What is X-BCID and what prevent client for submitting wrong hashrate? As far as I understood the server can not verify the work of all clients, so he will not be able to spot the wrong hashrate. I understand that most probably I am wrong here, but I just can not understand how is it done

2) after accepting approval for clients credentials it is asking to get work. Sometimes it has a huge string inside the params field. I can not understand what that string represents and why is it appears.

{
  "method":"getwork",
  "params":[],
  "id":1
}

3) the server is replying with the information that he supports, time after which the replies to the server would be outdated. Here also appears this X-BCID which I can not understand.

HTTP/1.1 200 OK
X-Stratum:stratum+tcp://eu1.bitminter.com:3333
X-Long-Polling:/lp
X-BCID:someNumber
X-Roll-NTime:expire=7Date:Mon,07Jan201319:52:20GMT
Server:Outpost/1.1.0 beta1
Content-Length:374
Content-Type:application/json;charset=UTF-8
Connection:Keep-Alive
Keep-Alive:timeout=895,max=5

4) together with the work that client has to do:

{
  "result":{
     "data":"huge string",
     "target":"smaller string"
  },
  "error":null,
  "id":1
}

from the above mentioned source, I understood that huge sting contains the information about the work for client (from which string to which string it has to iterate and calculate hashes) and to compare it to smaller string. So, if during the calculations I will encounter value, hashes of which will give me a smaller string, I will finish a block.
I did not understand why do I have an error field here. What is it testing?

So, my questions are:

what is X-BCID field in request 1 and 3
how the server validates the hashrate, which is submitted by the client in request 1
what is the params field in request 2, why sometimes it is empty
is my understanding about the request 4 correct, and why do we need 'error' : null, response. Is this just because of the standard of JSON-RPC and it is always null, or there can be reasons when it will be null.

X-BCID is a custom extension used only by BitMinter's getwork implementation. It's a block change ID. In case long poll isn't working optimally or block changes happen too fast for long poll to catch all of them, seeing a new block change ID makes the client aware that it missed a block change.

The server doesn't validate the hashrate submitted by the client. At the BitMinter pool it is currently used by the variable difficulty (vardiff) implementation to determine the initial worker difficulty, until the pool has enough data to estimate a hashrate.

The params for getwork are empty when the client requests new work and has data when the client is sending in a proof of work. This is a silly thing with the getwork protocol, the rpc function is "getwork" both if you are getting work and if you are sending in work results.

The error field in the response is always present as this is required by the JSON-RPC standard. You can read more about JSON-RPC at http://json-rpc.org/


call bitcoin API from Remote PC I want to make some test on testnet using the API and I would like to fetch datas from a remote computer.
The client is on raspberry which has an internal IP,than I have a dyndns address which pings my router on a given port(3400) -> from router I redirect the request to raspberry PI's IP with clients port for API calls(192.168.178.40:8332) and I have this in my

rpcallowip=192.168.178.40

but I get 403 status code

It isnt clear what you're doing, and I get the impression that you dont speak english natively, so I doubt we're going to get a better explanation of what you're trying to do. Given your question I can only assume your RaspberryPi's IP is 192.168.178.40, it is running bitcoind, and your trying to access the API on it from a computer somewhere on the internet (because you mention dyn-dns), and that there is a router in front of the RaspberryPi performing NAT. If you want any computer on the internet to be able to access the API

rpcallowip=0.0.0.0/0

or if you only want a single computer on the internet with a static IP to be able to access it, then you'd put in the IP address of that computer rather than the RaspberryPi's IP address.

If I got it wrong, try rephrasing your question, because as I said, we don't know how your network is configured.


Security advise on setting up a gambling Bitcoin site I have written a Bitcoin gambling site and am planning on the best approach to host it/manage it securely.
The site is implemented in Java using the BitcoinJ API and servlets etc are handled via the Play framework.

Here is an overview of what the site does at high level:

Communicates to a datastore where "receive/return addresses" inputed by user are stored.
Creates a unique receive address for the user (also stores this).
Stores the answers chosen by user.
Checks for verified transactions and updates datastore with this info.

Finally, when the app has a return address to send winnings to and confirmed verified and confirmed winner, the winnings are sent out.

I am thinking about how to best host this application. Would the best way be to proceed to purchase a dedicated server and run the whole app on there? Are there better/more secure ways that this can be done (also cheaper methods i.e. shared hosting?).

Thanks for your help!

EDIT
Potential alternative option:

Lightweight app on web which communicates directly to a database.
Database holds a big list of readily created "receive addresses" by a wallet held off server.
Off server process runs on my PC continuously checking the database for "work".

This approach is probably a lot safer and would also remove the need for a dedicated server. The downsides would be having to run a PC 24-7 at home which constantly checks for work.
The off server process would create more addresses when needed and add them to the database (remotely). It would also send out bitcoins to winners and transfer the bulk of BTC to an offline wallet.

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.


Holding of 9% of all bitcoins? In this discussion:
https://bitcoin.stackexchange.com/a/9057/10490
One of the users mentions a wallet with 9% of all bitcoins.

My question is: Is this true? What could be the source of this information? Is the identity of users not kept secret?

The blockchain is a public ledger and all transactions can be viewed.  But it doesn't contain any names or other personal information.  So you could determine that a particular bitcoin address owns 9% of all coins, but you couldn't determine who has the private key associated with that address.

That said, you can follow a chain of transactions and make inferences based on the addresses used.  For example, if address A and address B are both used as inputs in the same transaction, then you can assume that the addresses are owned by the same individual.  If you sent coins to somebody at address A and you know their identity, then there is a good chance that you know the identity of the owner of address B as well.


How to list all addresses in a deterministic wallet? Deterministic wallets generate a key space following established standards, using a random passphrase as seed. I have a couple of questions:

How many keys can be generated by a deterministic wallet?
Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?

How many keys can be generated by a deterministic wallet?

Effectively infinitely many. The same as a non-deterministic wallet which just keeps generating random private keys. There is a limit, 2^256, but you are never going to reach that. It is effectively infinite.

  Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?

It depends. If you are using hardened derivation, then no.

Also, because there are effectively infinitely many addresses, this would be impossible to do. You could reasonably generate enough addresses that you would ever use in your lifetime though.


Do I need both bitcoin client and guiminer to do mining? I am using bitcoin for the first time. Do I need to run both bitcoin-qt and guiminer to start mining? I have installed both programs and currently bitcoin-qt is running and synchronizing with network and there are around 60 more weeks to go.

So I guess once synchronizing is done I will get a wallet? And then I can run guiminer so I can start mining in "Slush" mining pool? (I have already registered for an account and worker)

And once synchronizing is done I can close bitcoin-qt and then just use guiminer?

If you are mining at a pool, you don't need a client to be running - the pool will provide you with all necessary information.

If you are mining by yourself, you need to run the client to know what you need to put in a new block.


Can bitcoins be "sold short"?  Or are there "put" options? Borrowing an asset and "selling it short" facilitates finding the appropriate price for the asset, allowing people to bet that the asset is overpriced (e.g. in a "bubble").  Can bitcoins be sold short?  Where and how?

Update (from Serith's answer): how about put options, which are similar?

Not only will Bitcoins soon be able to be sold short through several exchanges, but once that service is available, Bitcoin banks that pay interest will be possible.

A Bitcoin bank could pay interest on Bitcoin deposits by converting the Bitcoins into the least inflationary national currency available, investing those funds in loans or businesses, and using the profits to buy back more Bitcoins later to pay back depositors.

However, this plan has one flaw -- what if the price of Bitcoins goes way up, beyond the interest you can collect. You would then take a loss when you purchased back Bitcoins to pay back your depositors.

Normally, you would offset this risk by holding Bitcoins. But that would defeat the entire point of investing them. So you need some way to make money and risk money as if you were holding Bitcoins without actually holding any bitcoins. How can you do that?

And the answer is, you offset the risk that Bitcoins will go up in value by selling shorts. Selling shorts is like holding Bitcoins without having to actually hold them, allowing you to make money if they go up and lose money if they go down just like someone holding Bitcoins would. If Bitcoins go down, you lose on the shorts but make it up by making extra profits when you buy back Bitcoins to pay depositors. If Bitcoins go up, you lose when you buy back Bitcoins, but make it up on the shorts.

With the right combination of shorts, currencies, and investments, this should make the risk associated with interest-bearing bank accounts denominated in Bitcoins no greater than the risk with other currencies. (And if you sell the shorts directly to investors, you can make a profit on them as well, taking the commissions.)

It is entirely possible that this is part of the reason the exchanges are considering selling shorts. Not only would they pocket the commissions, but they could safely convert a fraction of the many, many Bitcoins they're holding into interest-bearing accounts denominated in national currencies, pocketing the interest.


Is it possible to spend the unspent outputs of a burn address? If a burn address is created without a private key to prevent access to the bitcoin there, is not possible to create a transaction which would spend the utxos since there is no private key to sign the transaction?

not possible to create a transaction which would spend the utxos since there is no private key to sign the transaction?

Yes. That's the whole point of a burn address - to have an address where no one is able to spend the coins.

Of course, in theory, someone could find a private key that corresponds to a burn address, but the probability is so small that it is effectively 0.


What is the maximum number of bytes the coinbase scriptSig (coinbaseaux) can hold? Since the scriptSig of the coinbase transaction of a block can contain arbitrary data, what is the maximum number of bytes it can contain? I've seen various mentions of a limit around 100 bytes, but can't find that defined anywhere.

The maximum is 100 bytes and is checked and defined here: https://github.com/bitcoin/bitcoin/blob/master/src/consensus/tx_verify.cpp#L195


Validation for a seed collision Came across this post while researching, and it claims:

This mnemonic: weary weapon unseen like like like like like like like like like and this one: sister glide dude near muse sent like like like like like like both produce the same binary seed (which is this
in hex: 0x1003ca7a7000000000000000000000000) and they both produce
the same address list (starting with
17A2fgCpcKEbg7CbfiJwAb8sjdEzUWD2y2)
4/1000 number comes from this: (# of mnemonic permutations / # of
binary seeds) - 1 == (1626^12 / 2^128) - 1 == about 4/1000. So about 4
in 1000 mnemonics correspond to two binary seeds / two address lists.

Can someone explain/verify the reality of this? Is this true? Applicable to only 12-words mnemonic or to all? Or not valid at all?
When I went ahead and tried to use the 12-word mnemonic provided, I found out that "weary" is not even a word in BIP39 English wordlist, but words are not chosen on the basis of security but rather to reduce human error in reading and transcribing the words. Does the claim hold up? And after reading tons of information on the subject, this is the first and only source that I have seen mentioned mnemonic -> seed collision.

Let's start from looking at electrum's wordlist (same as BIP39 english). From your example words:
weary
unseen
dude
muse
sent

don't exist in this wordlist. There are dune, museum, wear and sentence. Unseen isn't close to any of the words. If the author of the post provide mnemonic in the form of number it may be possible to calculate, from seed there is no way of getting the mnemonic (it's a HMAC function) and confirming his claim.


Is there any way to recover a bitcoin private key using some parts of the key ? I have a bitcoin wallets private key , but it's incomplete like you can say it's 70% of the private key , there is some alphanumeric missing for the middle of the key , is there anyway to recover it using that 70% of it ?

It depends on how much information you are missing.

A Wallet Import Format key is base58 encoded. Thus, each character in the key can be one of 58 characters.

You mention in the comments that you are missing 21 characters. Assuming you know exactly which 21 characters are missing (i.e., you know that the first 21 are missing), you have 21^58, or 4.88336... × 10^76 possibilities. This is outside the range of bruteforcing.

Moreover, if you don't know which 21 characters are missing, you have many, many more possibilities, as you not only need to iterate all 58 possibilities for each characters, but also try all their possible locations within the key.

Unless you are able to find more information, the key cannot be recovered.


As of 2017 is it still possible to get a transaction confirmed without a fee? In the past it was possible to get a transaction without a fee confirmed if the inputs and outputs had a high enough priority and followed some rules. As of 2017 is a "free" transaction still possible if you don't care about how fast it will be confirmed? Several hours or even a day or two would be acceptable.

The Bitcoin consensus rules do not require transactions to have a fee, so it's still theoretically possible for a free transaction to be confirm.

It is, however, unlikely that any miners today will confirm free transactions.  You can test this by sending yourself a free transaction to see if it confirms (but be sure you use a quality wallet, such as Bitcoin Core, that has features for handling transactions that never confirm).


What are the script size limitations according to consensus rules and are they enforced on TestNet? I'm trying to figure out the limitations that scripts have regarding their size, limits that would make a script invalid (ignoring standardness). According to this question and also these lines of code in bitcoin core's source code 1 2 3 it appears that the following rules are in place:

Maximum script size = 10,000
Maximum data size to be pushed to the stack = 520

To test these rules I made a bunch of transactions on TestNet, all of which breaking some rule and were included in blocks (all sent from n3eynMTEiGgPTuoKPApnRjE9pAuaAk3gkB)? Example:
Tx ID: 88bac1e84c235aa0418345bf430fb43b336875974b6e87dc958de196f9222c35
PubkeyScript length=0xfd1527=10,005 script=4d11275b2c...394e75orPush_10001_byte<5b2c...394e> OP_DROP
As you can see the length of the script is already 10,005 > 10,000 and the first data push is 10,001 > 520. In other words I broke both rules.
Also as far as I know the "consensus" rules are exactly the same on TestNet (with one exception: difficulty adjustment), is that correct? So how is this transactions valid?

Those consensus rules are indeed the same for testnet and mainnet.

However, they do only apply when scripts are executed. So you have to create an input trying to spend it to test this.


Why maturity rule on coinbase tx requires too many confirmations w.r.t an arbitrary tx? For an arbitrary tx, it is often said that 6 confirmations is sufficient. However, maturity rule states that coinbase tx can't be spent until it receives 101 confirmations. Why do we have this disperancy?

Why 6 confirmations on coinbase transaction is not considered as sufficient for example ?

If a normal tx is honest, has 6 confirmations, and there happens to be a reorg 6 blocks deep, the tx will just go back to the floating pool, and join one of the next blocks, with no harm done to any party.

If a coinbase tx has only 6 confirmations and there is a reorg, the original coins vanish from existence, invalidating the transaction, and any subsequent transactions that depend on it. These transactions can no longer be accepted into a block, and even if all parties involved are honest and willing to go through the effort of resending, this cannot be done because the original miner no longer has coins to send, and neither do the other parties.

Since a reorg invalidating a coinbase tx is catastrophic, a safety net of 100 blocks is required to make the chance of this happening vanishingly small.


Bitcoin Core LevelDB Index saves forked blocks I've noticed that bitcoind will permanently save unverified blocks that it receives even if they turn out to be small blockchain forks, likely occurring from the relatively simultaneous discovery of two blocks of equal height. This doesn't cause a problem for Bitcoin Core's functionality, as there is surely a process written into the source that ignores such small forks, however, it's curious to me that the data persists in the data saved to the .dat and .ldb files in .bitcoin/blocks/ and .bitcoin/blocks/index nonetheless. Is there a way to prune these invalid blocks that belong to small forks in the blockchain without -reindexing the entire blockchain? Would -reindex even remove them?

They're kept because it is complicated to remove them (it would require rewriting the block storage files), and there is hardly any cost to keeping them (they're a small fraction of the total). Furthermore, close to the tip we want to have forks available, in order to be able to reorganize quickly if one of them ends up becoming the main chain.

More technically, the $DATADIR/blocks directory for Bitcoin Core is not a representation of the blockchain. It's a store of all valid blocks we've ever downloaded. Which out of them end up being considered the main chain is a different issue, and dealt with independently.

Also note that in pruning mode all old blocks are removed - including these small forks.


Creating a virtual wallet to display balance in a store I have a store that uses bitcoin as a payement.
I want to make users deposit to their balance in the site, as I saw in many sites,
a bitcoin address is generated for each user to deposit funds to it, and use his dashboard in the site to withdaw it to his BTC address anytime.
I am using PHP. How to do it?

It is a way much better practice to generate a new address for every new order and not per user, as this would imply address reuse for returning customers, which is generally discouraged. Then the users won't have to keep their funds on your website and will only pay the exact amount for each order.

You can take a look at these open source projects for bitcoin written in PHP for starters.


How is mining of bitcoins done What makes this mining process so computationally intensive and can this mining activity be substituted by other hard labors in physical world?
Does this mining effort alone adds intrinsic value to the bitcoin like gold?

The mining process is similar to a brute force attack and, assuming you already appreciate the nature of such attacks, mining is computationally intensive.  More specifically, mining involves repeatedly, and as fast as your computer allows, guessing at the solution to a problem that cannot be solved quickly by the human brain.  There are now dedicated computers, made specifically for the Bitcoin community, able to make billions of guesses per second.

The mining process is hard by design as it does make the Bitcoin generation process harder, almost like mining for gold.

The mining activity cannot be substituted by other hard labors in the physical world.  BUT, you can buy Bitcoins on an exchange with the dollars you earned in the physical world.


How to unstuck a low-fee transaction with Electrum? I've sent a transaction with Electrum, but accidentally included too little fee. What can I do to speed up the transaction's confirmation or to replace it?

This is a complementary question to Why is my transaction not getting confirmed and what can I do about it? which answers the question's broader implications and proposes mitigation mostly focused on Bitcoin Core.

I've just visited #electrum on IRC to get some advice. While restoring from a seed may make your wallet forget a transaction and allow you to resend it with a higher fee, abpa there told me that this sometimes doesn't work because the server will remind the client about the transaction if it's still in the server's mempool.

abpa suggested using child-pays-for-parent to unstuck transactions, i.e. to send a transaction that spends the change output of the previous transaction with a higher fee to pay for both transactions. (Update:) Apparently, the Electrum developers have added GUI-support for CPFP in Electrum 2.8.0 on 2017-03-09.

In general it is recommended to activate replace-by-fee when using Electrum. This allows updating the fee after the transaction was broadcast if it turns out that the first estimate was insufficient. The setting can be found at Tools > Preferences > Fees > Enable Replace-by-Fee.


bitcoin core makefile addtions I have a custom set of functions that I want to run on my bitcoin client. I have a file that I need to link to net_processing.cpp. The makefile is complicated and I do not want to break anything. How do I link my .h and .cpp files?

The files are named monitor.h/.cpp

Thank you

Add them to Makefile.am. Search where net_processing.{cpp,h} are mentioned and add your own.