Bitcoin - ArchWiki

# Bitcoin

This article or section needs language, wiki syntax or style improvements.

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Bitcoin#)

Related articles

- List of applications/Internet#Bitcoin

Bitcoin is a decentralized P2P electronic cash system without a central server or trusted parties. Users hold the cryptographic keys to their own money and make transactions directly with each other, with the help of the network to check for double-spending. Bitcoins, usually denoted by BTC (i.e. '144 BTC'), can also be exchanged for traditional currencies like US dollars.

## Introduction

The Bitcoin network runs on peer-to-peer networking, digital signatures and cryptographic proof to make and verify transactions. Nodes broadcast transactions to the network, which records them in a public record of all transactions, called the block chain. A block is a record of some or all of the most recent Bitcoin transactions that have not yet been recorded in any prior blocks. In order to preserve the integrity of the block chain, each block in the chain confirms the integrity of the previous one, all the way back to the first one, using hashing.

New bitcoins are generated by the network through the process of mining. Mining involves inserting a new block into the current block chain, this is difficult because it requires generating a valid hash (in this case a large integer).

A variation in difficulty is achieved by requiring that this integer is below a certain threshold - the data in the block is perturbed by a nonce value, until the data in the block hashes to produce an integer below the threshold - which takes a lot of processing power. The threshold is set by the number of people currently mining for bitcoins so as to achieve a general speed of about 1 block every 10 minutes.

## Installation

The factual accuracy of this article or section is disputed.

Reason: According to blockchain/README.txt, "As of Bitcoin Core version 0.10.0 and later, the block chain bootstrap torrent hosted here takes more time to download and import than it would to simply start Bitcoin Core and let it sync itself." The recommended method of obtaining the official blockchain is with the bitcoin P2P protocol and client itself. (Discuss in Talk:Bitcoin#)

The original/official Bitcoin application from bitcoin.org is now called "Bitcoin Core" (originally it was called "bitcoin-qt" upstream) and can be installed in Arch with either: (a) the bitcoin-qt or (b) the bitcoin-daemon and bitcoin-cli packages, available in the official repositories. Until release of version 0.10 of Bitcoin Core, bitcoind in bitcoin-daemon served as both RPC server and RPC client. But with 0.10, the Bitcoin Core RPC client is a separate binary (bitcoin-cli). Both bitcoin-qt and bitcoind operate as RPC server, and bitcoin-cli will correctly query whichever server is running. There is no problem with installing all three of these Bitcoin Core packages on one machine, but it is possible to run only one of the bitcoind or bitcoin-qt binaries at once.

This gets the software installed on the computer, however this is just part of the problem; the quick part. The time-consuming part of using Bitcoin Core involves getting the entire BTC block chain, currently (Feb 02015) a 22GB data file, downloaded onto the same machine. If you start either bitcoin-qt or bitcoind then one of the first tasks of the software will be to download the entire BTC block chain. A quicker (and nicer to the Bitcoin network) way to get the entire BTC block chain is using this bootstrap BitTorrent file that is updated by the Bitcoin community from time to time. With this entire bootstrap.dat file located in ~/.bitcoin, one of the first tasks of bitcoind/bitcoin-qt will be to import this bootstrap BTC block chain and then (using much less bandwidth than downloading the entire block chain with bitcoind/bitcoin-qt) update and validate against the Bitcoin network this mostly imported BTC block chain. If you choose this option, then please consider seeding the BitTorrent bootstrap.dat file after downloading it by keeping your BitTorrent application open well after the download completes and at least until seeding is complete (which may be several hours later depending on your upload data rate). Before beginning to download bootstrap.dat over the BitTorrent network, you should also verify the integrity of the torrent bootstrap.dat.torrent and related files using GnuPG.

This is one procedure that worked in release 2015.02.01 of Arch:

1. Verify at least 80GB (22GB * 3 copies + 14GB worth of additional blocks via bitcoind/bitcoin-qt) of free disk space is available
2. Install gnupg, deluge, bitcoin-qt, bitcoin-daemon, and bitcoin-cli from the official repositories
3. Using a browser, download README.txt, bootstrap.dat.torrent, bootstrap.dat.torrent.gpg, and bootstrap.txt
4. Using gnupg, verify the downloaded files as having good signatures (you will need to first import the signer's public key ID A2DB9CCA)
5. Using deluge, download the 22GB bootstrap.dat (perhaps hours depending on your download data rate)
6. When bootstrap.dat download is complete:
   1. leave deluge running until seeding is complete (optional but it helps the community; may require hours or days depending on your upload data rate)
   2. copy (do not move or you will interrupt seeding) bootstrap.dat to ~/.bitcoin (do not use a symbolic link as this file will get renamed by bitcoin-qt after it is fully imported, and that too will interrupt seeding)
7. start bitcoind for background import or bitcoin-qt for import with feedback on progress
   1. bitcoin-qt begins importing the block chain from bootstrap.dat, giving visual and text feedback as to import progress ("Importing from disk..." and eg. "4 years and 24 weeks behind", etc.; this import from disk may require more than one hour)
   2. the import process duplicates the 22GB bootstrap.dat file into ~/.bitcoin/blocks/, thus roughly doubling the size of ~/.bitcoin from 22GB before starting Bitcoin Core to 44GB after import is complete.
8. After import from disk is complete
   1. bitcoin-qt will show "Synchronizing with network..." and eg. "22 weeks behind..." (a wired network connection here will speed this part of the process but several hours to complete synchronization with network is typical)
   2. the bootstrap.dat file gets renamed to bootstrap.dat.old
   3. it should now be safe to remove bootstrap.dat.old from ~/.bitcoin, but a cautious approach would be to
      1. wait until your locally stored block chain is fully synchronized with the network
      2. quit bitcoin-qt
      3. then remove ~/.bitcoin/bootstrap.dat.old
9. After bitcoin-qt indicates that the local copy of the block chain is fully synchronized with the network (~/.bitcoin/blocks filled 34GB in Feb 02015, then consider quitting bitcoin-qt and do either one of the following:
   1. start bitcoind to keep the block chain synchronized; feedback as to block chain status can then be had using bitcoin-cli without the additional memory required of bitcoin-qt.
   2. restart bitcoin-qt running as a minimized window ($ bitcoin-qt -min). Note however that some people have found this commandline argument does not work as advertised.
10. Consider making a backup of your wallet.dat file using bitcoin-qt.
11. See the official Bitcoin wiki for additional guidance.

Lighter software includes multibit and electrum, available in the official repositories too.

You can use this Systemd service file for bitcoin-daemon

(you will probably need to change 'User=' or create bitcoin user)

    /etc/systemd/system/bitcoind.service

    [Unit]
    Description=Bitcoin daemon service
    After=network.target

    [Service]
    Type=simple
    User=bitcoin
    ExecStart=/usr/bin/bitcoind

    [Install]
    WantedBy=multi-user.target

## How to get Bitcoins?

There are a variety of ways to acquire bitcoins:

- Accept bitcoins as payment for goods or services.
- There are several services where you can trade them for traditional currency.
- Find someone to trade cash for bitcoins in-person through a local directory. To find traders near you, you can use bitcoin.local or a bitcoin map.
- Participate in a mining pool.
- If you have very good hardware, you can solo mine and attempt to create a new block (currently yields 25 bitcoins).

For those who are just getting started, you can visit BitcoinReward to get some free coins. For more details and other ways of making Bitcoins see We Use Coins.

### Mining

Note: Mining is only really commercially viable with decent hardware, for a comparison of hardware and their performance see the bitcoin.it wiki. To see if your setup is viable use a Profit Calculator.

The basic concept of Bitcoin mining is that there is a little chunk of each block that contains meaningless random data. Bitcoin miners take all the data in the current top block, shuffle up that random chunk and calculate the hash of the whole thing, repeating this until they obtain a valid block. While hashes are easy to reproduce, they are impossible to predict and they seem to function completely randomly, so the miner has no way of predicting what chunk of random data will produce what hash.

Mining requires the use of a miner, which is program used compute the required hashes and thus to create Bitcoins. To learn more about mining please read this article.

There are several Bitcoin miners in the AUR:

- CGMiner — Multi-threaded multi-pool CPU miner.

  https://github.com/ckolivas/cgminer || cgminer (Note: use cgminer-gpuAUR for GPU mining as its version was the last to support it).

Tip: you need corresponding opencl package to enable GPU mining, opencl-nvidia for Nvidia, and intel-opencl-sdkAUR in AUR for Intel.

- cpuminer — Multi-threaded CPU Miner.

  http://yyz.us/bitcoin/ || cpuminerAUR

- MiningBeast — Multi-platform mining software.

  http://miningbeast.com/ || not packaged? search in AUR

- Phoenix Miner — Efficient, fast, modular, python-based, OpenCL GPU miner.

  https://github.com/jedi95/Phoenix-Miner || phoenix-miner-svnAUR[broken link: archived in aur-mirror]

## Sample config file

An example of a configuration file for bitcoin-qt can be seen below. Make sure to set the mode of the file to `600` using:

    # chmod 600 ~/.bitcoin/bitcoin.conf

    ~/.bitcoin/bitcoin.conf

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

    # Network-related settings:

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

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

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

    # … or 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

    # Do not use Internet Relay Chat (irc.lfnet.org #bitcoin channel) to
    # find other peers.
    #noirc=1

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

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

    # server=1 tells Bitcoin to accept JSON-RPC commands.
    #server=1

    # You must set rpcuser and rpcpassword to secure the JSON-RPC api
    #rpcuser=user
    #rpcpassword=password

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

    # By default, only RPC connections from localhost are allowed. Specify
    # as many rpcallowip= settings as you like to allow connections from
    # other hosts (and you may use * as a wildcard character):
    #rpcallowip=10.1.1.34
    #rpcallowip=192.168.1.*

    # 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

    # Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate
    # with Bitcoin -server or bitcoind
    #rpcssl=1

    # OpenSSL settings used when rpcssl=1
    rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
    rpcsslcertificatechainfile=server.cert
    rpcsslprivatekeyfile=server.pem

    # Miscellaneous options

    # Set gen=1 to attempt to generate bitcoins
    gen=0

    # Use SSE instructions to try to generate bitcoins faster. For muliple core processors.
    #4way=1

    # 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

    # Allow direct connections for the ‘pay via IP address’ feature.
    #allowreceivebyip=1

    # User interface options

    # Start Bitcoin minimized
    #min=1

    # Minimize to the system tray
    #minimizetotray=1

## See also

- Official Bitcoin website
- Bitcoin.it wiki
- Bitcoin forum
- IRC Channels on Freenode :
  - #bitcoin - (General Bitcoin-related)
  - #bitcoin-dev - (Development and technical)
  - #bitcoin-otc - (Over The Counter exchange)
  - #bitcoin-market - (Live quotes from markets)
  - #bitcoin-mining - (GPU mining related)
- blockparser — Fast, quick and dirty bitcoin blockchain parser.

Category:

- Internet applications

Hidden categories:

- Pages or sections flagged with Template:Style
- Pages or sections flagged with Template:Accuracy
- Pages with missing package links
- Pages with broken package links