text:
When running bitcoind I keep getting - boost::filesystem::space: Operation not permitted

Bitcoin Client Software and Version Number: Bitcoin Core 0.15.1
Operating System: Ubuntu 16.04
System Hardware Specs: 2.4 GHz Intel Core CPU with 16 GB RAM and 750 GB free hard drive space.
Description of Problem: bitcoind refuses to start up. Keep getting the same error over and over.

I have a 250GB SDD and a 750GB HDD which I use as storage on my ubuntu 16.04. I have been running a full bitcoin node for a few weeks which I just use to practice interacting with the bitcoin client. A few days ago I turned on my node and got this

EXCEPTION: N5boost10filesystem16filesystem_errorE
  boost::filesystem::space: Operation not permitted        bitcoin in
  AppInit()
Error: Error: A fatal internal error occurred, see debug.log for
  details
  Error: Error: A fatal internal error occurred, see debug.log
  for details

I have NO idea how to proceed. I have uninstalled bitcoin core from my system, reformatted my storage drive, reinstalled ubuntu, and just spend hours trying to debug this f'ing issue. I have posted on several message boards and have received literally no helpful replies. My storage HDD is located within the media folder, which I changed permissions on for any user to use. Occasionally bitcoind will start and simply just stay at block 0.... Really frustrated and quite frankly im on the verge of moving on to other projects. Any help me would be greatly appreciated.
Screenshot of the problem:

debug.log:
2017-12-02 05:15:59 Bitcoin version v0.15.1
2017-12-02 05:15:59 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2017-12-02 05:15:59 Assuming ancestors of block 0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a have valid signatures.
2017-12-02 05:15:59 Setting nMinimumChainWork=000000000000000000000000000000000000000000723d3581fe1bd55373540a
2017-12-02 05:15:59 Using the 'standard' SHA256 implementation
2017-12-02 05:15:59 Using RdRand as an additional entropy source
2017-12-02 05:15:59 Default data directory /home/ancientevil/.bitcoin
2017-12-02 05:15:59 Using data directory
2017-12-02 05:15:59 Using config file bitcoin.conf
2017-12-02 05:15:59 Using at most 125 automatic connections (1024 file descriptors available)
2017-12-02 05:15:59 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2017-12-02 05:15:59 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2017-12-02 05:15:59 Using 4 threads for script verification
2017-12-02 05:15:59 scheduler thread start
2017-12-02 05:15:59 HTTP: creating work queue of depth 16
2017-12-02 05:15:59 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2017-12-02 05:15:59 HTTP: starting 4 worker threads
2017-12-02 05:15:59 init message: Verifying wallet(s)...
2017-12-02 05:15:59 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2017-12-02 05:15:59 Using wallet wallet.dat
2017-12-02 05:15:59 CDBEnv::Open: LogDir=database ErrorFile=db.log
2017-12-02 05:15:59 Cache configuration:
2017-12-02 05:15:59 * Using 56.2MiB for block index database
2017-12-02 05:15:59 * Using 8.0MiB for chain state database
2017-12-02 05:15:59 * Using 385.8MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2017-12-02 05:15:59 init message: Loading block index...
2017-12-02 05:15:59 Opening LevelDB in blocks/index
2017-12-02 05:15:59 Opened LevelDB successfully
2017-12-02 05:15:59 Using obfuscation key for blocks/index: 0000000000000000
2017-12-02 05:15:59 LoadBlockIndexDB: last block file = 0
2017-12-02 05:15:59 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2017-12-02 05:15:59 Checking all blk files are present...
2017-12-02 05:15:59 LoadBlockIndexDB: transaction index enabled
2017-12-02 05:15:59 Initializing databases...
2017-12-02 05:15:59 Opening LevelDB in chainstate
2017-12-02 05:15:59 Opened LevelDB successfully
2017-12-02 05:15:59 Using obfuscation key for chainstate: fa63baf2491fc7eb
2017-12-02 05:15:59 init message: Rewinding blocks...
2017-12-02 05:15:59  block index              22ms
2017-12-02 05:15:59 init message: Loading wallet...
2017-12-02 05:15:59 nFileVersion = 150100
2017-12-02 05:15:59 Keys: 2002 plaintext, 0 encrypted, 2002 w/ metadata, 2002 total
2017-12-02 05:15:59  wallet                   64ms
2017-12-02 05:15:59 setKeyPool.size() = 2000
2017-12-02 05:15:59 mapWallet.size() = 0
2017-12-02 05:15:59 mapAddressBook.size() = 1
2017-12-02 05:15:59

************************
EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::space: Operation not permitted
bitcoin in AppInit()

2017-12-02 05:15:59 scheduler thread interrupt
2017-12-02 05:15:59 Shutdown: In progress...
2017-12-02 05:15:59 *** System error while flushing: boost::filesystem::space: Operation not permitted
2017-12-02 05:15:59 Error: Error: A fatal internal error occurred, see debug.log for details
2017-12-02 05:15:59 *** System error while flushing: boost::filesystem::space: Operation not permitted
2017-12-02 05:15:59 Error: Error: A fatal internal error occurred, see debug.log for details
2017-12-02 05:15:59 Shutdown: done

bitconi.conf:
##
## bitcoin.conf configuration file. Lines beginning with # are comments.
##

datadir=/media/ancientevil/Storage/BitcoinBlocks
txindex=1

# Network-related settings:

# Run on the test network instead of the real bitcoin network.
#testnet=0

# Run a regression test network
#regtest=0

# Connect via a SOCKS5 proxy
#proxy=127.0.0.1:9050

# Bind to given address and always listen on it. Use [host]:port notation for IPv6
#bind=<addr>

# Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6
#whitebind=<addr>

##############################################################
##            Quick Primer on addnode vs connect            ##
##  Let's say for instance you use addnode=4.2.2.4          ##
##  addnode will connect you to and tell you about the      ##
##    nodes connected to 4.2.2.4.  In addition it will tell ##
##    the other nodes connected to it that you exist so     ##
##    they can connect to you.                              ##
##  connect will not do the above when you 'connect' to it. ##
##    It will *only* connect you to 4.2.2.4 and no one else.##
##                                                          ##
##  So if you're behind a firewall, or have other problems  ##
##  finding nodes, add some using 'addnode'.                ##
##                                                          ##
##  If you want to stay private, use 'connect' to only      ##
##  connect to "trusted" nodes.                             ##
##                                                          ##
##  If you run multiple nodes on a LAN, there's no need for ##
##  all of them to open lots of connections.  Instead       ##
##  'connect' them all to one node that is port forwarded   ##
##  and has lots of connections.                            ##
##       Thanks goes to [Noodle] on Freenode.               ##
##############################################################

# Use as many addnode= settings as you like to connect to specific peers
#addnode=69.164.218.197
#addnode=10.0.0.2:8333

# Alternatively use as many connect= settings as you like to connect ONLY to specific peers
#connect=69.164.218.197
#connect=10.0.0.1:8333

# Listening mode, enabled by default except when 'connect' is being used
#listen=1

# Maximum number of inbound+outbound connections.
#maxconnections=

#
# JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
#

# server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commands
server=1

# Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6.
# This option can be specified multiple times (default: bind to all interfaces)
#rpcbind=<addr>

# If no rpcpassword is set, rpc cookie auth is sought. The default `-rpccookiefile` name
# is .cookie and found in the `-datadir` being used for bitcoind. This option is typically used
# when the server and client are run as the same user.
#
# If not, you must set rpcuser and rpcpassword to secure the JSON-RPC api. The first
# method(DEPRECATED) is to set this pair for the server and client:
rpcuser=rpcUser
rpcpassword=WITHHELD

#
# The second method `rpcauth` can be added to server startup argument. It is set at intialization time
# using the output from the script in share/rpcuser/rpcuser.py after providing a username:
#
# ./share/rpcuser/rpcuser.py alice
# String to be appended to bitcoin.conf:
# rpcauth=alice:f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae
# Your password:
# DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E=
#
# On client-side, you add the normal user/password pair to send commands:
#rpcuser=alice
#rpcpassword=DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E=
#
# You can even add multiple entries of these to the server conf file, and client can use any of them:
# rpcauth=bob:b2dd077cb54591a2f3139e69a897ac$4e71f08d48b4347cf8eff3815c0e25ae2e9a4340474079f55705f40574f4ec99

# How many seconds bitcoin will wait for a complete RPC HTTP request.
# after the HTTP connection is established.
rpcclienttimeout=6

# By default, only RPC connections from localhost are allowed.
# Specify as many rpcallowip= settings as you like to allow connections from other hosts,
# either as a single IPv4/IPv6 or with a subnet specification.

# NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED,
# because the rpcpassword is transmitted over the network unencrypted.

# server=1 tells Bitcoin-Qt to accept JSON-RPC commands.
# it is also read by bitcoind to determine if RPC should be enabled
#rpcallowip=10.1.1.34/255.255.255.0
#rpcallowip=1.2.3.4/24
#rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96

# Listen for RPC connections on this TCP port:
rpcport=8332

# You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
# running on another host using this option:
rpcconnect=127.0.0.1

# Create transactions that have enough fees so they are likely to begin confirmation within n blocks (default: 6).
# This setting is over-ridden by the -paytxfee option.
#txconfirmtarget=n

# Miscellaneous options

# Pre-generate this many public/private key pairs, so wallet backups will be valid for
# both prior transactions and several dozen future transactions.
#keypool=100

# Pay an optional transaction fee every time you send bitcoins.  Transactions with fees
# are more likely than free transactions to be included in generated blocks, so may
# be validated sooner.
#paytxfee=0.00

# Enable pruning to reduce storage requirements by deleting old blocks.
# This mode is incompatible with -txindex and -rescan.
# 0 = default (no pruning).
# 1 = allows manual pruning via RPC.
# >=550 = target to stay under in MiB.
#prune=550

# User interface options

# Start Bitcoin minimized
#min=1

# Minimize to the system tray
#minimizetotray=1

What are the permissions for /media/ancientevil/Storage/BitcoinBlocks including all intermediate directories? It looks like Bitcoin-Core does not have read or execute permissions to your datadir. Failing that, what is the output of df -h for that directory?

The permission for /media and all files/folders within are read/write for anyone.

Filesystem                   Size  Used Avail Use% Mounted on
udev                         7.8G     0  7.8G   0% /dev
tmpfs                        1.6G  9.5M  1.6G   1% /run
/dev/mapper/ubuntu--vg-root  204G   40G  154G  21% /
tmpfs                        7.8G  188M  7.6G   3% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
tmpfs                        7.8G     0  7.8G   0% /sys/fs/cgroup

/dev/sdb2                    473M  126M  323M  28% /boot
/dev/sdb1                    511M  3.4M  508M   1% /boot/efi
/dev/sda1                    688G   20G  634G   3% /media/Storage
tmpfs                        1.6G   80K  1.6G   1% /run/user/1000

Also what happens if you don't set datadir and let it use the default location?

It looks like your disk is mounted on /media/Storage/ but your datadir is set to /media/ancientevil~. What does df -h /media/ancientevil/Storage/BitcoinBlocks produce?

O sorry I changed my data dir since I last posted. My datadir=/media/Storage/Blocks

When I comment out my datadir bitcoind -reindex runs but it stuck on block 0

df -h /media/Storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       688G   20G  634G   3% /media/Storage

df -h /media/Storage/Blocks? ls -lhd /media/Storage/Blocks?

ls -lhd /media/Storage/Blocks - drwxrwxr-x 2 ancientevil ancientevil 4.0K Dec  4 16:23 /media/Storage/Blocks
df -h /media/Storage/Blocks
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       688G   20G  634G   3% /media/Storage

I managed to reproduce your error message on both 0.15.1 and the current master (c17f11f7b) with the following bitcoin.conf:
datadir=/home/nick/.bitcoin2

...where /home/nick/.bitcoin2 is a directory that doesn't exist.
My error log:
$ ./src/bitcoind -reindex

************************
EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::space: Operation not permitted
bitcoin in AppInit()

Error: Error: A fatal internal error occurred, see debug.log for details
Error: Error: A fatal internal error occurred, see debug.log for details

When this happens, bitcoin emits the debug.log into my working directory, instead of putting it in the data directory.
Based on this, I think you're running into the same problem.
Can you doublecheck that your datadir is a directory that exists?

I also suspected that but we verified in the comments to the question that the directory exists.

Yes my directory definitely exists. Its so strange that my bitcoin client use to work just fine the way I had set it up

The problem is that you specify the datadir in the bitcoin.conf file. You should not do this as it can result in some strange behavior, especially because the bitocin.conf file is supposed to be in the datadir. Instead of specifying it there, you should specify it as part of the command to start Bitcoin Core.

Isnt bitcoin.conf suppose to be in ./bitcoin? So you suggest placing my bitcoin.conf file where my storage is and simply starting bitcoind like this $ bitcoind -datadir=absolutatePath ?

The bitcoin.conf file is supposed to be in the Bitcoin Core datadir. It does not need to be in ~/.bitcoin nor should it be unless ~/.bitcoin is your datadir (which it is by default). Yes, I am suggesting that you start bitcoind like that.


text:
Electrum I requested wrong amount QR code but paid larger amount from luno?
I requested "Receive" bitcoin on Electrum and mistakenly entered my amount in "mBTC" instead of "BTC". (My first time) I then scanned the QR code with LUNO under Send bitcoin. It gave me the incorrect BTC amount (not realising it was because I entered in mBTC in Electrum) so I corrected it on LUNO and clicked send. Now electrum says under the mBTC transaction "PAID" but its not the full amount. Under the bottom left corner BALANCE it says "0" but with the correct amount in brackets saying (0.01... UNCONFIRMED). Does this mean the funds will still find their correct wallet destination even though the QR request scanned was for the wrong amount?

In Bitcoin, the sender chooses the amount to send. Because you corrected the amount in Luno and the correct 0.1 amount is showing (although currently unconfirmed) in electrum, you know this is the balance you will receive once the transaction is confirmed.
To understand why it is currently unconfirmed, see Why is my transaction not getting confirmed and what can I do about it?

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Who can change the code governing how much of BTC is released?
I understand that BTC's will be continually released by the year 2040, when it will reach 21M coins. Actual numbers don't really matter, but I'm interested in who has the power to change this rule. Is this an individual, a "github community"?

It's a bit complicated. Anyone can do it and nobody can...
Let's assume that you want to increase the total number of bitcoins to 42M. To do so you need to:

implement it in code
convince the community that it is a good thing
make a hard fork and hope that miners and users will support you

Something similar but in a smaller scale was happening for the last few years. It was about bitcoin block size, not the amount, but the principle was similar: people were suggesting 2MB blocks, 8MB blocks, variable size blocks and many other things and were trying to convince people that it is necessary, making there own forks and hoping they will become a real bitcoin (Bitcoin Cash, Bitcon ABC, Bitcoin Insert Your Fork Name Here)
As you can see, the block size is still 1MB. The same is with the total amount of bitcoins - you need to convince the majority of the community, then it can become true. But I doubt that anyone could ever do it.

Probably worth mentioning: increasing the supply is explicitly mentioned in the list of prohibited changes

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
If I transfer bitcoin into Trezor that has been on a paper wallet since 7-31-17. Can I still get BCH and BTG?
If I transfer bitcoin into Trezor that has been on a paper wallet since 7-31-17. Can I still get BCH and BTG? Trezor has a coin-splitting tool, but it says that I had to have held Bitcoin in my Trezor on before August 1st.

The reason you cannot use the coin-splitting tool is that the private key of your offline wallet is where the new BCH and BTG coins were created at the time of the fork. By sending your BTC to Trezor, you are only spending the BTC part, the BCH and BTG are still associated with your paper wallet's key.
After your send the BTC to Trezor, you need to import your paper wallet's private key into a Bitcoin Cash and Bitcoin Gold wallet, and then send the coins to a new fork-specific addresses from there. Make sure to send the BTC away first before you start exposing your paper wallet's key, to ensure you do not lose the BTC in the process. See How to claim Bitcoin Cash & Bitcoin Gold from paper wallet for more information.

You simply need to own BTC on-or-before the split date.  If you own the private key for the wallet that contained those keys, then you can create a BCH wallet with that private key and get an equivalent amount of BCH that you had in your BTC wallet.
Presumably, the paper "wallet" is either the private key, or an HD-compatible set of words you can use to recreate the wallet.  I'm not sure how Trezor handles you recreating a wallet, but certainly it must let you manually specify either the private key or the mnemonic phrase that represents the private key.


text:
Lookup Full Address For Casascius Coins
Can anyone tell me how I would check the public address on my old Casascius Bitcoins? I have 3 total cons but I am unable to find where or how to check the public addresses on the coins for they only have 8 characters. I have listed all 3 of the pubic addresses below if anyone can help. Thank you in advance.
1) 134xRg9x
2) 1359wf1p
3) 1348FHtv
Thank YOU!

Here is the full list of casascius coins.
According to that your addresses are:

134xRg9xsjvmyGxA2ndDbfEw3keqizwzWG
1359wf1p4wvw7SLa8Fktsg6eJMkbUaXp5y
1348FHtvGk6Cwv9PkFw52BKSQnm1Ujf9zb


text:
How do the people who work on Bitcoin Core get paid?
I'm wondering how the people who work on or manage Bitcoin Core get paid, e.g.  Wladimir J. van der Laan.
Do they do the work just... as volunteers?

Those who work for increasing of security and those who are enjoy transparency of blockchain are involved in proof-of-work. So this system balanced until balanced this two sides.

The majority of Bitcoin Core developers are volunteers or started as volunteers. They worked on Bitcoin Core in their free time and contributed without anyone paying them.
Later, when a developer becomes more prominent and devotes more time to the project, they may seek out someone (a person or company) to sponsor them to continue to work on the project. Alternatively a person or company may wish to sponsor or hire an active and prominent Bitcoin Core developer so that they may contribute to Bitcoin Core's development and help to keep the software maintained and growing. Some are paid to work on Bitcoin Core full time, others to work on it part time.
Currently many of the most active contributors are either sponsored or employed to work on Bitcoin Core specifically. However many others contribute as volunteers in their free time and are not paid to work on Bitcoin Core.

Thank you Andrew.
Just one more, when the contributors are sponsored or employed, who can pay them? I'm curious about the subject's finance.

Generally those that sponsor or employ Bitcoin Core developers to work on Bitcoin Core are people or companies with lots of spare cash. Paying someone to work directly on Bitcoin Core won't gain a company any profit directly, but by doing so they are helping to improve Bitcoin and thus allowing them to continue to earn money in the future as Bitcoin remains maintained.

Ah, so it's a bit like fundraising or donation!
Thank you again Andrew. I really appreciate!


text:
How to get the available balance of a specific address using blockchain.info?
There seem to be two calls. What's the difference between them ? I basically want to know the total amount available to spend on each address(actually on the whole wallet but there is no such api call so I have to calculate the amount from all the addresses).

Unspent outputs
https://blockchain.info/unspent?active=$address

Multiple Addresses Allowed separated by "|"   Address can be base58
  or xpub
Optional limit parameter to show n transactions e.g. &limit=50
  (Default: 250, Max: 1000)
      Optional confirmations parameter to limit the minimum confirmations e.g. &confirmations=6
The tx hash is in reverse byte order. What this means is that in order
  to get the html transaction hash from the JSON tx hash for the
  following transaction, you need to decode the hex (using this site for
  example). This will produce a binary output, which you need to reverse
  (the last 8bits/1byte move to the front, second to last 8bits/1byte
  needs to be moved to second, etc.). Then once the reversed bytes are
  decoded, you will get the html transaction hash.
{
    "unspent_outputs":[
        {
            "tx_age":"1322659106",
            "tx_hash":"e6452a2cb71aa864aaa959e647e7a4726a22e640560f199f79b56b5502114c37",
            "tx_index":"12790219",
            "tx_output_n":"0",
            "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac", (Hex encoded)
            "value":"5000661330"
        }
    ]
}

Balance
https://blockchain.info/balance?active=$address
Multiple Addresses Allowed separated by "|"
Address can be base58 or xpub

List the balance summary of each address listed.
{
    "1MDUoxL1bGvMxhuoDYx6i11ePytECAk9QK": {
        "final_balance": 0,
        "n_tx": 0,
        "total_received": 0
    },
    "15EW3AMRm2yP6LEF5YKKLYwvphy3DmMqN6": {
        "final_balance": 0,
        "n_tx": 2,
        "total_received": 310630609
    }
}

Your question:

How to get the available balance of a specific address using blockchain.info

The description for the /balance API:

List the balance summary of each address listed.

So use /balance.
/unspent lists all the outputs for all addresses you provide in one big list, not grouped by address. But since you're just adding them all anyway, it doesn't make much difference for you. The /balance result is shorter and simpler.

basically want to know the total amount available to spend on each address(actually on the whole wallet but there is no such api call

Have you checked the Wallet API? "Fetching the wallet balance" looks like what you need.

Ok, I will use the /balance call. The wallet API is  confusing and basically useless because it says it may include double spends and unconfirmed transactions...why would I need that? I just want to send the total amount from one address to another one...I don't want to generate invalid transactions.


text:
A question about mining difficulty
I have read quite a few threads about this topic. I understand the general concept now but with a few holes:

Why is mining being compare to lottery?

The total number of possible hashes = hashes below the target + hashes above the target
As I start to mine, I am reducing the numbers of hashes in the "hashes above the target" group", so as I make many attempts, my chance of getting the right one should be raising (because the total number of hashes is finite and I crossed out many bad attempts). If this is the case, then why does this article say:

After working on it for 24 hours, your chances of solving it are equal to what your chances were at the start or at any moment

Why does a lower target mean higher difficulty?

Is it because the number of correct answers become less and less?

A "bad attempt" (i.e. a block whose hash is above the target) isn't "crossed out".  It is entirely possible that you will later find a different block whose hash has that same value.  Nothing prevents it.  Every hash behaves like an independent trial.
It's easier to understand with smaller numbers.  Say you have a 6-sided die and you want to roll it until you get a 6.  If you roll a 3 on the first roll, that doesn't "cross out" the number 3; it is entirely possible that you will roll 3 again on future rolls.  The die has no "memory".  For that reason, there is no guarantee that you will get a 6 within 6 rolls; there's a chance it could be 7 rolls, or 12, or 100 rolls, before you get a 6.
Even if this were true, it wouldn't really make much difference: the number of hashes that you, or all the world combined, have ever computed, is a negligibly small fraction of the total number possible.  2^256 is an extremely large number.
http://bitcoin.sipa.be/ estimates that a total of 10^26 hashes have been performed on the Bitcoin network to date.  That's  100000000000000000000000000.  The total number of possible hashes is 115792089237316195423570985008687907853269984665640564039457584007913129639936.  So about 0.0000000000000000000000000000000000000000000000001% of them have been seen so far.  Even if they had been somehow "crossed out" it would not appreciably change the number that remained.
As to number 2, you are correct: since the goal is to find a hash that is less than the target, a smaller target means it is harder to find a successful hash.  The number usually called "difficulty" is computed as the maximum possible target (which is 2^224) divided by the current target, so a smaller current target means a larger difficulty number.

Hi Nate, really appreciate your answer! I have a follow up question, What is the reason of not being able to "cross out" numbers? Is it because more than one input will produce the same hash so that even if you cross out a hash, there is no guarantee that the same hash will not appear again?

@Cheng: yes, that's right.

According to this SO post, the rate of SHA256 collision is exetremely rare, but I guess as you stated, 2^256 is enormous, even if we assume there is no hash collision, it will still takes a lot computing power to find the right answer?

Hi Nate, I asked a follow up question here if you are interested: http://bitcoin.stackexchange.com/questions/51474/how-many-correct-hashes-are-there-giving-a-difficulty


text:
How much testing is done on each pull request before it is merged?
Frequently after one pull request is merged, multiple other pull requests follow to clean up a problem created by the first PR
Recent example:
https://github.com/bitcoin/bitcoin/pull/7957
https://github.com/bitcoin/bitcoin/pull/8164
https://github.com/bitcoin/bitcoin/pull/8171
Normally no real harm is done. Is this no big deal or a sign that more testing should be done before Bitcoin pull requests are merged?

Each pull request usually isn't that big, so it's not hard to look through every line of code. Each pull goes through meticulous testing, in case of any malicious code or an unintended flaw. Why do you think it takes usually more than one month after the pull is made to get added, even though there is alot of discussion in the comments?

I have seen this a lot too. It is a very difficult question to answer as it really depends on the specifics and magnitude of the problem that got merged.
Personally, I think pull requests shouldn't be merged as quickly as they sometimes are as there should be time given for review of even minor changes. The maintainers are in a tricky spot though as sometimes pull requests get no review, are left open for weeks or months and go stale (require rebases). For good reason sometimes maintainers merge pull requests with very little collective review if they deem them low risk.
In an ideal world there would be instant testing and review of every pull request and then the maintainers wouldn't have to make a judgement on what is low risk and not in need of much collective review. But we are not in an ideal world and generally (in my unqualified opinion) I think the maintainers get these judgements right.
The most important thing obviously is to avoid problems making into a release. If problems get resolved in additional pull requests prior to a release it is comparatively less of an issue.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How do I reset my wallet (bitcoin qt)
I lost my wallet pass, but thankfully didn't have any money there. How do I reset this thing and get a new fresh wallet with a new password?

I know people always recommend encrypting the wallet, but IMO loss is a much more serious problem than theft. If you do encrypt make sure the password is stored properly, preferably both in your memory and in multiple physical locations.

If you had funds in there, here's an interesting thread  to read.  A person encrypted the wallet but made a typo when entering the pass phrase and then the same typo during the second verification as well.
Fortunately, some cracking efforts were able to find the variation off the expected pass phrase and the coins were recovered.  https://bitcointalk.org/index.php?topic=85495.0

Go to Bitcoin's Application Data directory (in Windows 7 it's UserFolder\AppData\Roaming\Bitcoin) and delete the wallet.dat file.

@sean: I added a link to a Bitcoin wiki page detailing the location of the data directory on various OSes; according to it, on a Mac it is ~/Library/Application Support/Bitcoin/.


text:
Is there an application or a site grouping addresses by user graphically?
Addresses can be grouped as belonging to the same user (or, better, same "account") by grouping together the addresses that participate as inputs to a single transaction, and doing it transitively. This has been done in the recent paper by Shamir and Ron, by some previous researchers and can be done by znort's parser. I know this is not 100 % accurate but I'm fine with it.
What I'm looking for is a site that displays the results of such grouping graphically, possibly with transactions between accounts as well.
I've read about such a site on bitcointalk.org, but I can't find the topic any more. I'm looking for the url of the (now possibly defunct) site or the bitcointalk topic describing it.

Wouldn't that be dependent on being able to associate a transaction with a geographic location?

I found the bitcointalk topic:
https://bitcointalk.org/index.php?topic=103609.0

If anyone knows what happened to blockviewer.com (the site's offline now), or if there are any similar applications/sites, I'm still interested.

It is still being developed.  The latest is found here: http://toolongdidntread.com

The tool is called Blockviewer.  The website, blockviewer.com, no longer exists.  However, the source code is available on Github: https://github.com/thallium205/BitcoinVisualizer.  Thus, you might be able to download the source code, compile it, and run it on your own machine.
You can also read the original blog post introducing some of the ideas behind it.

The above-mentioned site, blockviewer.com, is now down.
There should be some type of search/querying engine that allows you to find the addresses associated with a given address based on the classic user-generating algorithm.
Anecdotally, my university might be hosting such an engine by the end of the summer. We're also looking at Javascript-based visualization engines to host the data through.
Sadly, however, it seems that no such visualizer (or even public data source) currently exists, as far as I can tell.


text:
What happens when the same wallet (private key) is used on several machines?
Let's say I copy my wallet to another computer and start using it there. What happens? Can both computers send and receive payments to the same address(es) in the wallet?
A different scenario with the same results: someone steals my computer and starts using my wallet. I have a backup and start using that. Can we do it?

A wallet is a combination of private keys, and transactions that spend from/to it.
Since somewhere in the 0.3 series, bitcoin will detect transactions from a key of yours that you did not create yourself, and count them as spends.
This means that if you duplicate your wallet on several machines, they will all be able to do spends, and observe spends by others. Probably as much as you would hope for, but there are a few caveats:

The wallet contains 100 pre-generated keys to simplify backups, so the first 100 new keys used by both clients will remain the same, but afterwards they will diverge, i.e. start using different keys. You do not want this to happen, which means you will need to synchronize the wallet files at least once every 100 transactions (i.e., copy from one place to the other).
If one of the clients is not yet aware about a spend done by the other (for example, it was offline at the time of the transaction submit, and hasn't caught up with the block chain yet), it may produce a transaction that uses the same input, in other words: a double spend. The software is not able to deal with this, as it will consider its own transactions unquestionably valid. This will probably result in an unusable wallet.

In short: there are some provisions for detecting spends by copy of a wallet, but it's certainly not an encouraged or supported use case.

Basically, my advice would be that you simply should not do this until the software has better support for it. You need at least a fully-deterministic generation of new accounts and some way to cleanly recover from transactions that are in the local wallet but invalid on the client's accepted blockchain.

To answer the part about the stolen wallet, the thief would immediately transfer the balance of your stolen wallet into his own wallet, and repeat the process regularly.  So whenever you added more Bitcoins to your wallet, they would vanish as the thief stole them.  So you would be able to share the stolen wallet with the thief, but it would be a very unbalanced kind of sharing, where you did all the depositing and he did all the withdrawing.
You would be better off making a new wallet, transferring the Bitcoins out to the new wallet before the thief empties it, and never using any of the addresses from the old wallet as receiving addresses again.  This would involve giving new addresses to anyone or any site that stores an address of yours and is likely to ever send coins to it.

This should work just fine, for the most part, though it's not recommended. What would not be fine is multiple PCs accessing the same wallet.dat from, say, dropbox at the same time. The BerkeleyDB format Bitcoin uses for its wallet is not intended to be a multi-user database and as such this can cause problems if both systems attempt an action at the same time.
It should also be noted that if you copy your wallet to a new system and make a transaction it can become out-of-sync with the old copy of the wallet, since Bitcoin generates new addresses to receive the "change" from each transaction by default.
In short, two systems using the same wallet can be done but it's not recommended because of the unexpected results it can produce. If you're simply talking about a backup/restore of the wallet.dat then that's much less troublesome.

@chris-moore says: "The wallet contains 100 pre-generated keys to simplify backups [...]. [...] you will need to synchronize the wallet files at least once every 100 transactions [...]." - This seems to imply that one address is "used" per transaction, which I don't understand since I may only use one address (or a few addresses) all the time. David Perry seems to clarify this a bit with ''[...] Bitcoin generates new addresses to receive the "change" from each transaction by default.'', but I don't understand this either. Could someone clarify?

Bitcoin internally does not transfer amounts from address to address: transactions explicitly refer to old "coins" they consume, and create ones of arbitrary sizes. So, if you have a 10 BTC coin and want to pay me 7 BTC, the software will consume the 10 BTC coin, create two new coins from it (a 7 BTC one addressed to me, and a 3 BTC one addressed to yourself). To improve anonimity, the change goes back to a different address of yourself.


text:
How would changes to the Bitcoin protocol be decided upon? What constitutes a "majority"?
We know that the Bitcoin protocol can be updated at any time. Larger updates and hard forks can be difficult to push through, but as long as a majority of the Bitcoin community supports the update, it can happen.
However, it's unclear to me exactly what "majority" means. Which players have the most weight in the decision-making process?

Does it mean "a majority of holders of bitcoin"? If an update is so drastic that it would threaten confidence in Bitcoin, they would likely sell and would vote with their wallets. However, if the update isn't particularly drastic, currency holders would likely have no course of action. If they only use Coinbase, for example, they don't have a choice of which version of the protocol to use.
Does it mean a majority of people with software running a version of the Bitcoin protocol? Currency holders with wallets like Bitcoin-Qt? They decide which version to run.
Does it mean a majority of nodes? (This is distinct from #2, as a person running 10 nodes in this scenario would get 10 votes instead 1 vote). Someone can flood the network with nodes running the protocol, and if there is a hard fork, people may mistakenly check to see how many nodes support each version, basing their decision on that ratio.
Does it mean a majority of merchants? They can decide whether to continue accepting Bitcoin, and they decide whether to convert BTC immediately or to continue to hold it.
Does it mean a majority of mining power? The miners are the ones who decide which blocks to accept and work off of.
Does it mean a majority of the developers (weighted by their influence)? Some have pointed out that that Gavin has a lot of influence and could probably convince people to adopt a particular change, as long as the change is small enough. Are there ways for the developers to  surreptitiously exert control over the progression of the protocol?

I started wondering about this after I read the following question: How could the bitcoin protocol be changed? Has this ever occurred?
In the comments, @Muhd says:

So it follows that changes will likely only be implemented and adopted if it benefits a large majority of participants. I suppose most security updates would qualify. Technically, isn't it the case that we only need a majority of miners (>50%) to switch over? Or does it require more than that?

@meni-rosenfeld responds:

No, a majority of miners is irrelevant. If miners try to change the protocol on their own, they will simply be ignored by the rest of the network, and their "mining rewards" will be worthless. A change requires an economic majority - adoption by the users and businesses who give the currency value.

P.S. This question is important because there are certain protocol changes that would be good for some parties but bad for others. For example, increasing the block size would be good for payers, but bad for miners (it would be easier to get a transaction in the blockchain, so there'd be lower mining fees).

"...if it benefits a large majority of participants.", nobody proposes anything ever that will not, at least be presented as, 'benefiting a large majority of participants'.  From 'trickle down economics' to 'you might not agree now with me on this proposal, but you'll agree with me later' gives the people that set the agenda and write, defend and prepare these proposals and technical changes a lot of influence.
secondly, normal politics (as this is politics, not engineering primarily, as for instance now BIP16 and BIP17 are evaluated for implementation and the developers do not agree and seem to have valid points.)
Although i don't get the impression that the bitcoin developers have dark motives, or don't want the best, i am worried about what is going to happen when the US government starts to try to exert influence over bitcoin. There are already BIP proposals that for instance make it possible for someone to request a payment from a customer, and this greatly reduces anonymity but increases tracability vs. for instance the implementation of zerocoins which would build in automatic mixing and increase anonimity. the US govt, or any government for that matter will use their influence and also power to try to safeguard its (perceived) interests. (i don't know which BIP's these are - but you get the picture)
Actually, if i am not mistaken there is no bitcoin protocol as such, there is just the bitcoin-qt client, a piece of C++ code that is hard to understand (unless you're a C++ programmer) and by the sound of it not unambiguous. This is the protocol, the protocol is written according to how this program works.
Anybody has any illuminating thoughts or facts on this issue?

Users have the ultimate power because they decide which blockchain to use. It doesn't matter how much mining power you throw at a blockchain if nobody uses it.

Can you please clarify? It sounds like you are suggesting that my second hypothesis is correct ("majority of people with software running a version of the Bitcoin protocol").

Yes. Imagine two groups in disagreement with different Bitcoin protocols. One group has a lot of hashing power but very few people are using it, trading with it or buying stuff with it. The second group has comparatively little hashing power but it has a huge number of people using it. Which is the real Bitcoin? It's the version with a lot of people using it.

This article describes such a hard-fork scenario and how a transition might occur (i.e. betamax vs vhs)

Hm, @Bitlab.co your comment definitely makes sense, but I'm skeptical it would actually work that way in practice. I'm worried that users of services like Coinbase & blockchain.info won't really have a vote, and most of the influence on which version people decide to use will come from those with a lot of nodes, bitcoins (distributed across many addresses), and mining power. With these resources, they can make it seem like a lot of people are behind a particular protocol version. I also agree w/ bitcointrader that those with a lot of influence in the community can direct the conversation.

authors: Vîçký Màtãñg


text:
Attack on bitcoin network with modified client?
Scenario:

Mallory, Alice and Bob found block on their farm.
They disconnect from internet, simulating split and change all of nodes in their segment to malicious.
Malicious nodes decrease complication of block founding, and dramatically outrace whole of world.
After a week, they restore original clients on their nodes and plug the network back.
Their chain bigger than world's and they gather total week's bounty 25,200 btc, more than 2,520,000 $.

Is it possible?
What part of code protect us? Raw code is appreciated.
Related question:
Is the Bitcoin protocol secure if two parts of the network have no connection?

Scenario: disaster splits the Internet into dozens unconnected fragments
What would happen if a portion of the Bitcoin network was separated from the rest of the network?
What's the impact of net-splits on block generation... over a long period of time?

possible duplicate of Is it possible to change to protocol, mine lots of blocks offline, and then change it back?

Is it possible?

Yes and no.
The behaviour you are describing a normal feature of the functioning network, that is, the most difficult to produce (often but not necessarily the longest) chain will always win.

Malicious nodes decrease complication of block founding, and dramatically outrace whole of world.

When the two networks rejoin, the second one having a lower difficulty, the new blocks would be instantly rejected. This is due to bitcoin looking for the most difficult chain to produce, not the ultimate highest block. A shorter chain with a higher cumulative difficulty is preferred over a longer, easier to product once.
Moreover, it would take a very large amount of computing power even just to ride the difficulty down. A single entity or group solving just a single block at difficulty 112M is unlikely, and they would need to solve up to 2015 of them to reach the next adjustment period. If they had enough hashpower to do that, they would be a lot better off financially just mining on the real network rather than attempting to attack it.

Even though checkpoints currently exist to protect to chain up to some hardcoded points, they only exist to enable a performance optimization (dropping signature verification before the last checkpoint). A new block synchronization mechanism that is being developed will perhaps allow dropping those checkpoints enitely. In any case, they don't exist as a security mechanism on themself - they're way too infrequently updated for that, and relying on them would be strong centralization.

Alright, I've removed that sentence from the answer. I mainly added that as an afterthought as the difficulty-not-height renders an attack like that impossible anyway.

No, this attack is not possible.
The chosen branch is the one representing the highest total difficulty, not the highest number of blocks.
Unless the attacker has more hashrate than the honest network combined, he will not be able to find a chain with higher total difficulty, even if in its chain the number of blocks is higher.


text:
Bitcoin mining question about hashrate helping you exponentially
I am a total newb in the crypto mining world and was researching the profitability of bitcoin mining when I came across bitclub which offers almost 4x more profit than mining by yourself. Their argument is that they have more hashpower so they make more bitcoins exponentially. Is that true? Do we make more bitcoins exponentially if we have more hashpower? If I were mining with a super computer, would I make exponentially more bitcoins or would it be the same as per 1H/s multiple by the hash power you have?

That seems to good to be true and probably is a scam. The word 'exponentially' is being used with no regard to what it really means.
To mine 'exponentially' more coins you have to have 'exponentially' more hashpower.


text:
block decode failed (-22) error solo mining while submitting block
Hi I have developed hardware/software to mine bitcoin it's working and getting me the results (getting nonce since the design takes only .2sec to complete the task)i am trying to submit in my local bitcoin wallet its  error message is
Traceback (most recent call last):
  File "./submit_b.py", line 282, in <module>
    rpc_submitblock(rpc_con(),block_miner(rpc_getblocktemplate(rpc_con()),binascii.b2a_hex('Bitmatriz'.encode()).decode(), "19DvxDw7zfiBDcvZCyhboNjJ2VW6d2mD2P"))
  File "./submit_b.py", line 124, in rpc_submitblock
    message = rpc_con.submitblock(param)
  File "/home/bitmatriz/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 141, in __call__
    raise JSONRPCException(response['error'])
bitcoinrpc.authproxy.JSONRPCException: -22: Block decode failed

Below is the data generated from the script
[encoded data, 6017 characters]

Can you please copy and paste the output as text, instead of a screenshot image?  It will be much easier for people to look at.  If you indent it four spaces, it will show up as "code".

The first problem is that the output of your script has an odd number of characters which means it is not valid hex. I'm guessing that you forgot a 0 when you copy and pasted it. So adding a 0 to the front of the data, there's still several things wrong with it.
If this is meant to be a Bitcoin block, then you are missing one of these fields in the block header: time, bits, or nonce (I can't tell which because all three are 4 bytes).
Then after that, you have serialized incorrectly the compact size unsigned integer for  the number of transactions. Firstly, it looks like you are missing a byte for it; you have 0xfd which indicates that the number should be two bytes. However the number you have put is only 1 byte. Secondly, that integer is in the wrong order. The serialization itself should have 0xfd first, and then the number that follows in little endian.
Next in your coinbase transaction, it looks like you have missed the segwit marker byte.
These are the things I see wrong with the beginning of your block; something else may be wrong further in the block.

Of course I could be completely wrong if the format of your block is not the same as Bitcoin's.

Thank you! I built the complete structure using https://raw.githubusercontent.com/vsergeev/ntgbtminer/master/ntgbtminer.py Let me know if anything is wrong in this


text:
Private Key Problem
I made an blockchain.info wallet and I want to obtain the private keys for my addresses.
In my old blockchain.info wallet, I could find the private keys, but in the new one the private keys are not there.
Can you help me please ?

I don't think blockchain.info stores private keys unless they are imported. Rather they use BIP 32 to derive private keys from a seed and just store the seed. The seed can be exported as a BIP 39 mnemonic - it is the recovery phrase that you wrote down when you created the wallet and can be found in the settings.
This recovery phrase can be used with any software that supports BIP 39, so just enter it into any such software which also shows you the private keys and you can get your private keys from there.
You can use https://iancoleman.io/bip39/ to do this. However you should never enter your seed into a website; rather you can just download the source code for this site and open that up locally in your browser (preferably with your Internet connection also disabled at this time).

As far as I remember, Blockchain.info's recovery phrase is local to their own site - You cannot use it to directly restore your keys via BIP39 in another wallet.

They changed that. The recovery phrase used to be something for their site. It is now a BIP 39 mnemonic.

Blockchain.info recently made an update to their wallet.
Before the update, they were generating a random wif therefore an address, but after the update, they are generating mnemonic phrase (BIP 39 - 32) and derive wallets from that mnemonic phrase.


text:
Importprivkey problem for Litecoin clone
I have cloned an older version of Litecoin using a tutorial. I chose the starting letter for the public addresses to be lower case "x". Everything is working fine except for importprivkey. It will always gives error 5 wrong format. I tried using paper wallet generated keys (paper wallet generated private keys starting with addreses K,L and J) while the windows-qt wallet dumprivkey dumps private keys starting with nr 2 but that can not be imported as well. Is it because of letter x? FYI I have compiled a clone using letter "L" (same like Litecoin) and everything works so i doubt there is a coding error.

What tutorial did you follow? What code have you changed. This is most definitely a coding error as you probably did not change something that you needed to.

Hi Andrew.The cone process involved generating a new Merkle root,changing network identifiers,etc.As I said everything is working good and up to date about 22 million coins were mined..we have blockchain explorer..mining pool etc..but the importprivkey will not work.However when I changed the letter x with L and started a separate test blockchain importing private keys worked...here is the github code https://github.com/OracolXor/Oracol-XOR-Coin  if you want to have a look.At this point i am prepared to pay for your time if you believe you can solve the problem.Thanks for the reply.Adrian

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

Hi Andrew.Yes i understand and yes the dumped private key from my wallet they start with 2...i have tried to import dumped private keys from other wallets and it does not import .same error..now regarding the paper wallet ..the paper wallet does not generate addresses in WIF format that start with 2 ..the paper wallet WIF format keys start with K L or J..the paper wallet link is here https://www.oracol.mobi/paperwallet/index.html by the way...i noticed the same with Litecoin ..the bumped private keys start with T but the imported privete keys startvwith 6 ...

.so ho do i get my wallet to import private keys ? the link to the oracol-qt windows wallet is here https://uploadfiles.io/ilu34 ..again i really appreciate taking the time to look into this .I can send you a btc contribution if  you can point me in the right direction or help me solve this .Adrian

P.S.- I had so far two people with good programming skills look into it and they could not find the solution ...

Your paper wallet generator is using the wrong prefix, so of course it is wrong. You are using 0x109 which is invalid; the prefix byte is only one byte, this is more than one byte. The issue here is that you are overflowing the one byte, so instead of allowing the default behavior of adding 128 to the address prefix, you should set the prefix byte explicitly in all software.

Yes...so if i may "translate" this in my own terms it  means that because the sum  of 137 (x)  + 128 = 265 (or 0x109)  is > 256 ?? I thought of that but could not fin any reference what is the work around..if 0x109 is wrong what is  the correct way of calculating it or implementing it ( or as you mentioned - you should set the prefix byte explicitly in all software ) I used the info on this bitcointalk thread to calculate the values https://bitcointalk.org/index.php?topic=384093.10  Thanks again for helping with this .You have no idea how many nights i did not sleep trying to fix this thing

P.S. - i do not expect you to write the set the prefix byte in all software but if you can give me an example of a line in the code and how to correct it using the right prefix byte value it will be enough to start me ..again many thanks!!!

On https://github.com/OracolXor/Oracol-XOR-Coin/blob/master/src/base58.h#L403, change that line to set an explicit prefix value similar to how it is done above here: https://github.com/OracolXor/Oracol-XOR-Coin/blob/master/src/base58.h#L275. Just choose whatever private key prefix you want that is less than 256.

also am i to understand that because the dumped keys from my qt wallet start with 2 ( you mentioned that is the correct value previously) the only thing to fix really is the paper wallet ?? sorry to ask so many questions ...

No, you need to fix both your coind/coin-qt and the paper wallet generator. Overflowing value is undefined behavior and it may not always result in the same value.

okay...so i have compiled a new oracol-qt and choose "W" ( base58.h - line 403 - PRIVKEY_ADDRESS = 0X49 )..The newly compiled wallet is syncronizing and dumping private keys that begin with letter "B" wich is consistent with the paper wallet that i modified replacing all ECKey.privateKeyPrefix == 0X49 as well ....i have now a working paper wallet that generates private keys beginning with "3" and privateWIF compressed beginning with "B" and when i sent the private keys to  "Wallet Details" they are showing all details and everything it looks normal on the paper wallet side.

The problem is..when i try to import the paperwallet keys the oracol-qt wallet is generating a MinGW Runtime Assertion error - Assertion failed ..file src\key.cpp, Line 313   Expression: fValid.

if i ignore the error it ends up with an error code - Private key outside allowed range (code - 5)

Line 313 in key.cpp is :      assert(fValid);

I feel that i am very close to nail it now ..but again i need your expert opinion please.I really appreciate your help again.

It s working !!! Got it to work finally ..the right value was 201


text:
What's the impact of net-splits on block generation... over a long period of time?
Part 1
For this question, assume the overall hashrate of the environment is constant.

If 25% of the network hashpower were to be isolated (Australia had no Internet for example), what is the effect on block generation?

I suspect that blocks in Australia will take 75% longer to confirm, and the the main chain will confirm  75% faster (Edit: it will take 25% longer for the main chain to confirm, difficulty will adjust downward).
Part 2
If I extrapolate the effects suppose

This outage is long-lasting
A multiple of the 2016th block is reached on the main chain.  Maybe several multiples.
Difficulty is adjusted.

Given that the Bitcoin client is hard coded to prevent a change in difficulty more than 4x the the current difficulty:

What would happen to the isolated Australian chain if it reconnects to the main chain?  (w.r.t. the difficulty adjustment)
Suppose a different percent of the network were to become isolated.  What combination of %isolated, duration, and network hashrate would cause a 4x difficulty to be reached?

possible duplicate of What would happen if a portion of the Bitcoin network was separated from the rest of the network?

If 25% of the network hashpower were to be isolated (Australia had no Internet for example), what is the effect on block generation?

Aussie transactions take 4x longer to confirm, actually. Everybody else's transactions take 33% longer (1.0/0.75)

What would happen to the isolated Australian chain if it reconnects to the main chain? (w.r.t. the difficulty adjustment)

It's instantly blown away, and the main chain is downloaded to all of the Aussie bitcoin clients.

Suppose a different percent of the network were to become isolated. What combination of %isolated, duration, and network hashrate would cause a 4x difficulty to be reached?

Suppose that 3/4 of miners suddenly have no internet access. For 8 weeks. That's when you'd see the difficulty drop to 1/4 of its previous value.

What about the difficulty adjustment?  Would that automatically "heal"?

@makerofthings7 It would use the main chain adjustment. That might mean that stuff confirms 33% faster than it ought to for a week, but that's not so bad.


text:
Specific fee in transaction
Is there any possible way to send transaction with specific fee (not fee per kb) from wallet in bitcoinj? Where should I look to find a solution :)? My code:
Address address = Address.fromBase58(BitcoinNetwork.mode.GetParams(), destAddress);
SendRequest req = SendRequest.to(address, Coin.valueOf(value));
completeTx(req);


text:
Reorganize chain
BitcoinJ:

Is is possible to get somehow transactions from ReorganizeListener in block chain? I'm able to get list of new blocks which are represented by StoredBlock but from StoredBlock I can't get any transaction.
Is BlocksDownloadedEventListener will also trigger for new blocks after split? I want to know if any new block from split point will also trigger BlocksDownloadedEventListener.

Thanks for help :)


text:
What cryptography hardware and/or software does a bitcoin exchange need to employ?
We have an operating equities exchange. To exchange bitcoin or other crypto-currencies, what cryptographic hardware or software would we have to use?

related: What would it take to create my own Bitcoin exchange?, What is needed to make a bitcoin exchange?

An exchange does not necessarily need their own hardware, as they won't be mining anything. However you will defenitely need some hardware.

A server

Where else do you host your exchange? Your laptop?

A dedicated device for cold storage

Every good exchange needs a cold storage wallet, to ensure that if you get hacked, you won't lose all your funds.
-A cold storage wallet is basically a dedicated device that has never touched the internet. This is very effective against malware, as there is no way for malware to access your computer unless the actual hacker has access to your device.

A dedicated device for your own node

You defenitely don't want the guy hosting your node to fake an incoming transaction and get you to credit them with free funds! Host your own node that will not be tamlered with.


text:
Can any Bitcoin client do local peer discovery and blockchain synchronization?
Usually, when a full Bitcoin client such as bitcoind, Bitcoin-QT, or Multibit start on a fresh installation, they connect "to the network" to download the blockchain. If someone has multiple computers or devices, they could end up downloading the whole blockchain several times. This puts a lot of stress on their connection and extra clients on the network that could get their data locally.
Have any clients implemented a standardized way to exchange blockchain data locally, without going over the Internet?
I imagine this would work something like how BitTorrent local peer discovery works, where two clients on the same subnet discover each other through multicast groups and then negotiate transfer of data.

The Bitcoin.org client can be launched with the -connect= parameter.
Simply have it connect to another local node and no outside connectivity occurs.
But once it is caught up to the latest block, the amount of bandwidth is relatively trivial.  There's no reason to do this to save bandwidth once a node has been brought current.

Would there be any merit to an automatic discovery and download? Or would it be better to rely on communication among users about the availability of other nodes on the same network? An example I see is a college network, where nodes are likely to exist but be unknown, as opposed to a home network, where a user will know if they are running Bitcoin on another computer.

Bitcoin is a financial app (i.e., money is involved.  As such, you don't cut corners.)  A node is best secured when run in a manner in which it gets blocks from randomly selected peers.  This approach does cause performance that is less than you can get if you manually connect to other local nodes but you would only do so if you trusted those nodes.  In a college environment, you would not want to trust getting all your blocks from peers within that network.
Again, security is of greater importance than efficient use of bandwidth.

That's an excellent point that I had not considered, that security trumps efficiency. However, given the nature of the blockchain, how difficult would it be for a malicious peer to distribute a fake blockchain if our  client would eventually contact the outside world for updates, or even an initial portion of the blockchain?


text:
Bitcoin without mining
Several months ago I've stumbled an interesting question about the Ripple system: How does Ripple solve the double-spend problem?
Specifically about how double-spending is solved in Ripple. As you can see only @David Schwartz replied to my comments and only he was able to give an answer, given that I think he works for Ripple.
But if he's right, this would be revolutionary in a way, since Bitcoin electricity wasting mining could be replaced by this system.
In any case, my question is: can Bitcoin mining be replaced by a Ripple sort of system? How would that work?

One problem would be that Bitcoin also uses mining to accomplish the initial distribution and generation of the currency. You could add a mining like feature to Ripple's consensus algorithm to do that, but that would kind of defeat the point of trying to avoid wasting electricity.

i think that bitcoin mining costs make it more secure over the 51% attack

Both Bitcoin and Ripple are systems made of many components. One such component is a method to synchronize transactions and secure against double-spending; Bitcoin uses mining based on proof of work for that, while Ripple uses a consensus mechanism. Another component is the initial issuing of coins - Bitcoin uses mining for that as well, while Ripple uses central issuing. Of course, the key component of Ripple, which Bitcoin lacks, is a credit network with pathfinding.
You could build a system which is like Bitcoin in every way except that it uses consensus for synchronization rather than mining. It is likely that the total energy spent on generating new coins will be lower than the total energy spent on synchronizing transactions; so replacing that part with a mechanism that requires less energy is welcome. However, the consensus mechanism is not as proven as the mining mechanism, and is less decentralized thus less consistent with Bitcoin's overall vision.

Nice answer. Could you explain, or provide a link to something explaining why consensus has to be more centralized than mining? It seems like Bitcoin mining has become quite centralized due to pools... Thanks

@dg123: Ripple's consensus mechanism requires every node to define a UNL of nodes that it "trusts". So there's no objective truth determined computationally, rather it is relative to each node's trust. The need to have nodes which are trusted is what makes Ripple more centralized. Pools will not be a cause of centralization when Multi-PPS is implemented.

Ripple is not a Bitcoin without mining, Ripple is more akin to the existing financial services system in that, all ripples are centrally created and tracked, much in the same way Fiat currency is.  I would classify Ripple as more a medium of transfer.  So to use an analogy if bitcoin is the 'Gold' on which we base a financial system a ripple is a proof of ownership contract.  Much the same way the eGold was or even fiat currency before it fundamental value was no longer tracked by gold reserves.

OP didn't suggest that Ripple is Bitcoin without mining. Ripples are centrally created but are not centrally tracked, Ripple uses a consensus mechanism for that. The question was whether this mechanism can be used as a component in a "Bitcoin without mining", which is a valid question.


text:
How to split BTG in electrum and send to new ledger nano s wallet
I currently have all my BTC on my electrum wallet, and I had them before the BTG fork. I haven't done anything regarding splitting since the fork, but now that I have the ledger nano s, I want to move my BTC from electrum to the ledger.
Now I am in no way familiar with a) splitting BTC/BTG and b) replay attacks, but I am afraid of losing any coins in the process. As I understand, I shall do the following:

Make a regular BTC transaction to move all BTC from electrum to the ledger nano s BTC address
Get a BTG wallet, and import electrum's private keys in it. Then, I have 'claimed' the BTG
Make a regular BTG transaction and move the BTG from the BTG wallet to the ledger nano s BTG address

Is this correct? Is there any chance of losing anything with this process?

The steps you stated look good to me. It would be prudent to wait for a few confirmations of your BTC transactions, to make sure your BTC are safe, before exporting your private keys from electrum.

I actually ended up beeing brave and transferring my BTC from electrum to ledger. According to BTG they have replay protection in place, and BTC transactions are invalid on the BTG chain.
The BTC showed up in the ledger just fine. I haven't bothered with claiming BTG yet though, since I don't really need it at the moment. Also I lack a good BTG wallet (I am on macos (not windows) and I don't have android, and not sure if I should trust the iOS one).


text:
Why the difference in send/receive fees on localbitcoins.com?
At least in https://localbitcoins.com/, the fees for sending and receiving Bitcoins (from/to outside localbitcoins, of course) differ by a factor of three, approximately. Currently:
0.08715 mBTC for sending, 0.26144 mBTC for receiving.
Is there some rationale for this?

This is specific to LocalBitcoins.
From the website,

In order  to divide the costs of handling Bitcoin transactions in a
  fair manner we are introducing deposit fees for incoming transactions.
  At the same we will lower Bitcoin sending fees for all customers.
Deposit fees will be larger than the new sending fees, generally we
  expect it to be about 3x the amount of sending fees.

Thanks!
https://localbitcoins.com/blog/new-bitcoin-network-fee-model/


text:
How do I import a private key into Bitcoin-Core?
How do I import a private key into Bitcoin-Qt? bitcoind is nowhere to be found, and pywallet says it requires "bsddb" when I run it, which is also nowhere to be found. I generated some vanity addresses and I want to use them.

Run Bitcoin-Core
Select Help (to the right of Settings)
Select Debug Window
Select Console
If you encrypted your wallet, unlock it by entering walletpassphrase "YourLongPassphrase" 600 next to the > input box
Next to the > input box type importprivkey <bitcoinprivkey> (Note that the private key must not have spaces, remove them if they are included in your backup)

Example: importprivkey 5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS

Thanks! I had to do it twice, though. The first time it didn't show up and the second time it said error code -4 and it worked. Whatever works!

This might also be of help: http://bitcoin.stackexchange.com/a/13303/6375

This is how you do it, too bad that this method seems like an "odd" place to have this.  It reminds me of the IDE Eclipse when you want to import packages...

While adding multiple keys you may want to avoid a time consuming rescan after each key. To do so use the command importprivkey <bitcoinprivkey> '' false for each key and importprivkey <bitcoinprivkey> '' true for the last one. The blank label is needed to pass the true/false flag.

This only works for non-pruned mode.  If pruned, you can't import private keys.  Also, Console is under 'Window' now, not Help.  Latest version here: https://en.bitcoin.it/wiki/Help:How_to_import_private_keys_in_Bitcoin_Core_0.7%2B

If you get "Only legacy wallets are supported by this command (code -4)" it means that you try to import a private key into a descriptor wallet. Either use a legacy wallet or create descriptors for your private keys prior import. The latter is recommend.

For those of you looking to import your Vanity address into your BitCoin QT client, here are the instructions (source):
Backup Your Wallet
Although this process is well tested and used you should always take another backup of your wallet.dat file before starting.
Open Debug Window
Then go to menu: /Help/Debug Window and click on the tab - Console.
Unlock your wallet
If your wallet is encrypted (I hope it is!) you must unlock it. If not just skip this step.
To do this just type into the box at the bottom:
walletpassphrase "YourLongPassphrase" 600

You need the quotes if there is a space in your phrase else there is no need for them. The 600 means your wallet is unlocked for 10 minutes (600 seconds).
Run Import Command in Debug Window
In the console at the very bottom is a text entry box. In here enter:
importprivkey yourPrivateKeyInWalletImportFormat "TheLabelThatIWant"

The private key must not have any spaces, remove them if they existt in your backup. The label may have spaces, the quotes are only needed if you want a space in the label.
You now have to be patient. On a fast PC it takes 2 minutes to import, and during this time it looks like you application has hung. You are now done. But always best to check it worked.
Check Key Imported OK
Once Imported you can check that you have the address by closing the Debug window and going back to your address book. You should see the address here.

Restart your BitCoin QT Client to see the new address in your Receive
"Tab"

Backup Wallet
Your backup of your wallet will not have this key in obviously. So before you do anything else backup the wallet.dat file as normal.

re: "yourPrivateKeyInWalletImportFormat"
is that WIF Compressed or WIF Uncompressed?


text:
Standard CLI tool to calculate a public key out of a private key
Is there a standard, or at least well-accepted, CLI tool that calculates the public key out of a private key?
I've done my homework erading How do you get a Bitcoin Public Key from a Private Key, but it's from May 2014, and hopefully tooling has improved since then.

To the best of my knowledge there is no standard CLI utility.
However, there are some tools which seem to be generally accepted, like bitcoin-bash-tools
Alternatively, you can use some script library, such as pycoin (written in Python), or bitcoinjs.
Personally I like Bitcore libraries (Bitcore is not Bitcoin Core, despite their names are similar). They are also written in Javascript.
I wrote a simple library for handling keys/addresses that can be used from the command line with the NodeJS interpreter: https://github.com/frz-dev/btcutils/blob/master/bitcore-keys-utils.js. In your case you can use the getPubKey function, passing the private key object.
Hope this helps

In fact, there are few CLI utilies that allow you this:

sx : command line Bitcoin to empower the sysadmin
cat key| sx pubkey
pybitcointools : SImple, common-sense Bitcoin-themed Python ECC library
pybtctool privtopub key

Try this: pip3 install btc-address-dump
Here is an example:
$ btc_address_dump c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

This tool also support mnemonic words:
$ btc_address_dump "olympic wine chicken argue unaware bundle tunnel grid spider slot spell need"
mnemonic = olympic wine chicken argue unaware bundle tunnel grid spider slot spell need
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

Caution. This is a post by a new user, promoting new software.


text:
Couldn’t find my transaction
I bought bitcoin from Simplex two days ago but now when I check the blockchain.info website I face to "No transactions found for this address, it has probably not been used on the network yet" error. I will really appreciate it if someone can help me. Is that normal or maybe the problem comes from the seller?
Thanks

Check the transactions section in you dashboard else contact the technical support.
here is the answer i found in their website : https://www.simplex.com/faq/
Usually, payments are processed within the hour; however, some cases require more attention and can take up to 24 hours to be approved.  You will receive an email once your payment has been reviewed.
If your transaction is still pending, it might be because you have yet to submit to a verification request.
In such cases, an email is sent asking for proof of identity or card ownership – which can land in your spam folder. In case of delays, please check your spam folder for a verification email.

They told me the transaction has been approved but I couldn't find it through  https://blockchain.info/ and I faced to "No transactions found for this address, it has probably not been used on the network yet"


text:
Transaction confirmed, bitcoin not received
Is that normal to receive more than 6 confirmation in the Bitcoin transaction process? Because the time delay is unbelievable and I received 64 already. But according to blockchain.info, 6 confirmation enough for Bitcoin transaction.
So my question is, how much exactly transactions I have to receive at the end to be sure it's confirmed?
Because I sent my Bitcoin in the morning and now the night, but it still did not reach its destination and keep sending confirmations.
https://blockchain.info/tx/0e1ed99dc9932ec6725f9e3f0f406ac7305d53e9752f1b56a61dd8259d53f1b4

I've already sent the request to support stuff, but no response at the moment(probably needs some time) The question is, can I cancel the transaction and repay or resend necessary amount BTC again?

Why do you say it did not reach its destination? The image you pasted confirms that it reached its destination.

Closely related: Recipient has “not received” the Bitcoin I sent, but the transaction is confirmed

Your transaction is confirmed. As Rutger said 1 confirmation is enough, more just means more confidence. You should double-check the addresses you used, it's possible the coins were sent to the wrong place.

It's the second day already, but my payment didn't show up, what do I do in that case? Because I checked on the blockchain.info and it looks perfectly fine. Probably there is a place where I might check again?

Where did you get the destination address from? Go back to where you got the address from and find it again, and make sure it is the same as the one in your wallet from your screenshot. Also what is the destination? How do you know it didn't arrive?

Yes, this is completely normal.
It simply means that there are more blocks being build ontop of the block your transaction was put in / originated from.
The more confirmations = less chance of your transaction being reverted in a 51% attack.

So my question is, how much exactly transactions I have to receive at the end to be sure it's confirmed? Because I sent my Bitcoin in the morning and now the night, but it still did not reach its destination and keep sending confirmations.

Usually 1 confirmation would be enough, ( to prevent double-spending, which to this day does still happen quite a bit.)
Theorethically 6 would be the most optimal. ( Unless there is a 51% attack.)

With six confirmations it is essentially mathematically impossible for an attacker with less than 51% of all mining capacity to get six blocks in a row. and still surpass the longest block chain. With 51% or a lot more than 51% the attacker can get six confirmations by creating a parallel blockchain in which only transactions approved by the attacker get included in blocks.

And how long do you think it will take to confirm transaction in my case? It's not an emergency, just to be prepared.

Anything over 1 confirmation with the current state of the network should be seen as confirmed.


text:
Any advice for attorney accepting bitcoin?
I just started accepting bitcoin for potentially anonymous legal consultations.  Does anyone out there have any advice for how to accomplish anonymous yet legally confidential attorney relations?  I firmly believe in attorney-client privilege but know that a court order can force disclosure -- making the reality of confidentiality a question of court order.

Are you sure this is ethical? Wouldn't any opposing party be "obliged to struggle in the dark against unknown forces" with no possible legal redress should your client's actions be deemed malicious or actionable. I thought that attorney client "privilege cannot be used to evade a client's responsibility for the use of legal process".

I'm not qualified to answer about the legal rules surrounding confidentiality. (Though, I imagine you have a better handle on California/United States confidentiality than I do anyway.) However, there are a few technical details you should be aware of.
First, transactions in Bitcoin are essentially public. The transaction amounts and the time of the transaction are both public information. That means that if you're forced to disclose the amount and day of the transaction, someone could figure out the transaction that you were paid by.
Second, transactions are linkable. That means that if someone figures out which transaction you were paid by, they could follow the money that you were paid with, and they might be able to identify your client.


text:
What are cash outlays & expected inflows for an individual miner?
I'm a student and a beginner interested in learning about Bitcoin. I am not interested in attempting to mine at this time, but I would like to know more about how it works.
Per my understanding, adding to the blockchain requires brute-force computing. I know some amateurs attempt to mine with relatively simple setups, spending maybe a few thousand dollars to get the necessary equipment. I also know that others spend significantly more to create complex setups that, all else equal, I would assume are much more effective.
Generally speaking, what are some estimates for what people might spend to get set up to mine bitcoins? Given what people might spend, what might they expect to earn in a year if constantly mining? What I'm most interested in knowing, for context, is what type of an "investment yield" does the average miner generate? For example, if I spent $5 on equipment and earned $25 in a year, my return would be 20%.
Thanks for your thoughts!

There are a bunch of mining profitability calculators here. You just need to fill in how much you're going to spend on the equipment, what sort of hash rate you get from the equipment, how much you pay for electricity and what you think bitcoin will be worth and it'll tell you. These are all highly dependent on what you buy, how much of it you buy, where in the world you are and what bitcoin price will be. Investment yields will differ based on those factors.
An ASIC machine manufactured 2 years ago in Paris is going to be much less profitable (or basically lose lots of money) vs. getting a bulk discount on the latest ASICs in Iceland.
Also, this is a question that gets asked quite often.

Thank you, Jimmy. Apologies, I should have looked more before posting. Thank you for the links and calculators - that's what I was hoping to find!


text:
How to charge a fee to process Bitcoin payments in a mobile point of sale app?
I have a mobile point of sale app for local businesses.  We want to integrate Bitcoin as a new payment processor for our merchants.  We currently charge $.30 per transaction for credit card swipes and we want to charge the Bitcoin equivalent. How do we grab a transaction fee for submitting the transactions on the merchants behalf via our app?  I mean, how do we do this in Bitcoin? Is there a property in BitPay we can use that says pay this API_Key this fee amount?

Firstly Bitpay and Bitcoin are not the same thing.
BitPay is the Paypal equivalent of the Bitcoin world. You may be able to have a percentage of the transaction for yourself, but you will have to work out the business logic. Can't help you there.
Regarding fees on the Bitcoin network, please note that it is designed to be anti-fee, so if you do add fees you must bring something else to the table, but it sounds like you are setting yourself up as an intermediary between the merchant and Bitpay so I don't know exactly what that might be.
Bitcoin is anti-fee because even it's own transaction fees are subject to minimum payment amounts otherwise the fee is zero.
The Bitcoin Transaction fees themselves are not calculated on the amounts but are a function of the number and size of the inputs and outputs, the size of the transaction in kb and whether or not the person has decided to pay a fixed fee or not.
That being said your merchants will not be happy if you apply a fixed fee to their transactions especially if the transaction amount is less than the fixed fee you want.

Thanks, I appreciate your response.  We have to charge a fee as that is part of the service we provide.  We provide the ability for small merchants to sell their products online and on mobile devices.  Our rate is $.25 per transaction instead of the 2+% charged by other companies.  It allows people to sell any items they have created to anyone around the world. So, we have to be able to charge a fee to continue hosting, supporting, adding new features, etc.  We were just asked about integrating bitcoin, and the best way to do that & convert it to dollars is the bitpay exchange.


text:
How to create bitcoin wallet by PHP
I'm new to Bitcoin. I want to use PHP to create a bitcoin wallet on my own website. I came to here https://blockchain.info/api/create_wallet but I don't know how to apply it.
Would like to have good tutorials from some websites or videos.

I would highly discourage writing your own PHP Wallet App, in which without proper security, your wallet and your clients wallets might be compromised in the future.
But if you insist on creating an online wallet, I would highly recommend Blockchain's Online Wallet. You can access the source code here
The application is written in Javascript, which enables a second layer of security (all operations are done on the user's browser). I think you can use this through your PHP application, in which nearly all web apps use Javascript libraries.
Cheers,
-Besir

Great... but can you tell me how to implement this? And where is the HTML or PHP code in source code?

You can find your answer here
Snippet of code
Example from bitcointalk
    <?php
  #Below is full list of available characters.
  #"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
  $fp=fopen("/dev/urandom","r") or die;
  $available_chars="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz";
  do{
    $minikey='S';
    for($i=0;$i<29;$i++){
      while(($c=ord(fgetc($fp)))>=strlen($available_chars));
      $minikey.=substr($available_chars,$c,1);
    }
    $check=hash('sha256',$minikey . '?') . "\n";
  }while(substr($check,0,2)!='00');
  fclose($fp);
  $priv=hash('sha256',$minikey);
  print "Minikey: $minikey\n";
  print "Privkey: $priv\n";
?>

You can find some useful information here

.
You can use Bitcoin-PHP Payment library - https://github.com/cryptoapi/Payment-Gateway
    <?
        require_once( "cryptobox.class.php" );

        $options = array(
        "private_key" => "",        // private key from gourl.io
        "orderID"     => "your_product1_or_signuppage1_etc",
        "amountUSD"   => 2          // 2 USD
        );

        // Initialise Payment Class
        $box1 = new Cryptobox ($options);

        // Display Payment Box or successful payment result
        $paymentbox = $box1->display_cryptobox();

        // A. Process Received Payment
        if ($box1->is_paid())
        {

            // Your code here to handle a successful cryptocoin payment
            // ...
        }
        else $message .= "The payment has not been made yet";
    ?>
    <!DOCTYPE html>
    <html><head></head>
    <body>
    <?= $paymentbox ?>
    <?= $message ?>
    </body>
    </html>


text:
Hash speed attack
I'm discovering alt-coins.
Now, I'm on piratecoin.
{
    "blocks" : 34167,
    "currentblocksize" : 1225,
    "currentblocktx" : 1,
    "difficulty" : 0.14348426,
    "errors" : "",
    "generate" : true,
    "genproclimit" : -1,
    "hashespersec" : 355,
    "networkhashps" : 11127177,
    "pooledtx" : 1,
    "testnet" : false
}

There is somehow calculated networkhashps, seems it is aproximation from difficulty, it is 11,127,177, ~ 11mh/s. I'm count on my own, 350h/s, however, cgminer show me 180Kh/s. Probably it doesn't counts in getmininginfo or recalculated somehow. Anybody?
I've seen persons with much greater speed, its called mining rig. 20-30 may be 100 GPU in a bunch.
What if such huge miner connect to such young alt-coin network, download whole of current blockchain, and start mining off-line. After 5 hours he come back to network, his blockchain will be with bigger difficulty.
Can he attack network in such way?

Yes, read for example CoinDesk: Feathercoin hit by massive attack

Absolutely. When a coin is secured by proof of work, if there is insufficient proof of work, the coin is not secure.

What kind of protection exist? I've heard about PoW, PoS, alphabet blizzard....