Bitcoin

提供: ArchWiki
2020年12月15日 (火) 14:15時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→‎Bitcoin ソフトウェア: 警告を和訳)
ナビゲーションに移動 検索に移動

Bitcoin は中央サーバーや信用機関を必要としない分散型の P2P の電子通貨システムです。ユーザーは貨幣として暗号鍵を保有して互いに直接取り引きを行い、ネットワークの力を借りて二重使用をチェックします。しばしば BTC と表記される (例: '0.1 BTC') Bitcoin は、米ドルなどの従来の通貨に交換することもできます。

イントロダクション

Bitcoin ネットワークはピアツーピアネットワーク上で稼働し、電子署名と暗号証明によって取引を作成・確認します。ノードは取引をネットワークに流すため、全ての取引は公に記録されます。これはブロックチェインと呼ばれます。ブロックとは先行するブロックに記録されていない一部または全ての Bitcoin の最新取引の記録です。ブロックチェインの整合性を保持するため、チェインの各ブロックは一つ前のブロックの整合性を確認し、ハッシュを使うことで最終的に一番最初のブロックまで遡ります。

新しい Bitcoin はマイニングによってネットワークから生成されます。マイニングでは新しいブロックを最新のブロックチェインに追加することが行われますが、有効なハッシュ (この場合巨大な整数) を生成する必要があるため、マイニングには計算力を必要とします。

検証を行うにはこの整数を一定の閾値以下にする必要があります。ブロックのデータはノンス値によって撹拌されています。ブロックのデータが閾値以下の整数になるまで大量の処理能力が費やされます。閾値はビットコインのマイニングを行っている人の数によって決まるため、1ブロックを処理するのに大体10分ほどかかります。

コンセンサス

コンセンサス とは、P2Pネットワークの参加者の互換性を表す Bitcon 特有の用語であり、コンセンサスルールは順守すべきプロトコルの実装の詳細を記述したものである。

Bitcoin.it wikiから:

The consensus rules are the specific set of rules that all Bitcoin full nodes will unfailingly enforce when considering the validity of a block and its transactions. For example, the Bitcoin consensus rules require that blocks only create a certain number of bitcoins. If a block creates more bitcoins than is allowed, all full nodes will reject this block, even if every other node and miner in the world accepts it. Adding new consensus rules can generally be done as a softfork, while removing any consensus rule requires a hardfork. Rules regarding the behavior of the mere network protocol are not consensus rules, even if a change to the network protocol behavior breaks backward-compatibility. The consensus rules are only concerned with the validity of blocks and transactions.
These rules are called consensus rules because Bitcoin requires that all participants in the Bitcoin economy have consensus (with the meaning of the next definition) as to the consensus rules. If the economy disagrees about the consensus rules, then the currency and economy splits into two or more totally-independent pieces.
警告: あなたが使用することができるbitcoinソフトウェアは、それを同意している当事者とのみ取引することができ、同じ結果を得るために同じ規則 (アルゴリズム) を実装することを理解することが必要です。もしソフトウェアのネットワークとの合意が破られたり、ネットワーク全体の合意が破られたりすると、ソフトウェアはまだ合意している関係者としか取引できなくなります。

Nature of consensus failure

The nature of consensus is a very strict yet completely voluntary uncoordinated interaction of many independent users. It is both a requirement of the networks correct operation, and a facilitator of its correct operation at the same time. You can be considered to be in consensus with any other node that will accept any data structure relevant to consensus as valid that you have accepted as valid (ignoring of course an instance where two different miners both find valid blocks at the same time and each relay theirs to part of the network, the next valid block will decide which preceding block was valid based on which one it extends from). Consensus can be broken violating explicit consensus rules (violating a rule explicitly spelled out as a consensus rule, i.e. the cap of 21 million bitcoin, rate at which they are issued, the maximum size of a block, that a transaction is only valid if citing a valid unspent coin, etc.) or violating unexplicit rules (due to a bug or unintended consequence of design, i.e. a valid structure erroneously being invalidated due to software bug/improper format/etc., or the use of an attack avenue to overstress the node with load due to a bug or bad design). Both types of consensus failures could potentially come to be intentionally or unintentionally.

A discussion of two consensus breaks in Bitcoin Core's history, one explicit, one unexplicit: https://bitcointalk.org/index.php?topic=702755.0

A discussion of design flaw on reddit (with citation links to official developers discussion): https://www.reddit.com/r/Bitcoin/comments/5h70s3/bitcoin_unlimited_bu_the_developers_have_realized/

Bitcoin の入手方法

ビットコインを入手する方法はいくつかあります:

  • 商品やサービスの対価としてビットコインを受け取る。
  • 伝統的な通貨 とビットコインを交換できるサービスが複数存在しています。
  • 直接会って現金とビットコインを交換してくれる人が近くにいないか探す。あなたの近所にいるトレーダーは bitcoin.localbitcoin map で見つけられます。
  • マイニングプール に参加する。
  • 高機能なハードウェアを持っている場合、単独で採掘を行って新しいブロックを作成することもできます (12.5 BTC 産出されます)。

初めてビットコインを触る場合、BitcoinReward にアクセスすることで無料のコインが貰えます。Bitcoin を手に入れる方法の詳細は We Use Coins を見て下さい。

Bitcoin ソフトウェア

警告: 他のクライアントとの取引や対話を行うには、互換性のあるソフトウェアを実行している必要があります。これは現在、Bitconコミュニティでは複雑で論争の的となっています。インストールと継続的な使用のための選択を非常に慎重に調査することをお勧めします。

Some points to illustrate above warning:

  • As mentioned earlier, different clients implement different rules on #Consensus. For example:
    • A #Thin client does per se not implement all rules, but only a subset.
    • A #Full node client may be forked to allow customizing options which are incompatible with the network Consensus at large.
    • Another full node may be programmed to validate in Consensus until it has itself reached a majority coverage, in order to leverage majority to implement different rules. The assumption is that the minority will follow suit, see #Nature of consensus failure for examples.
  • A lot of Linux distributions do not officially package bitcoin clients, and one reason are its special requirements to function on the P2P network. Some bitcoin developers even come to the conclusion the clients should not be packaged at all. See a related fedora request for further information. Using a rolling release distribution does pose additional risks in this respect.

The above implies you should also take continuous due care to test related updates.

ノート: As a consequence of highly conflicting and non-resolvable opinions of contributors to this article on how the different available packages should be described, it had to be exceptionally decided not to list any individual packages at all.

シンクライアント

The thin clients are also named Simple Payment Verification (SPV) clients.

Thin clients do not fully validate the blockchain or compute a full Unspent Transaction Output Set (UTXO). They derive their security in proxy by connecting to a fullnode and downloading the blockheaders. They are still able to guarantee the Proof of Work behind a block is valid, and each blockheader contains a merkle root of all the transactions in the block. This allows them to query full node clients for the blockheaders and the data to prove their transaction is in the merkle root in the blockheader. They however must trust that miners are mining valid blocks, and have no way to make sure rules like the issuance rate or cap of Bitcoins are being followed.

警告: In the event of a consensus failure at large on the network, or one affecting the node(s) an SPV client is connected to, the SPV client is incapable of detecting which partition of the network it is on, or communicating to, or being sent information by. It is extremely insecure to send or receive money with an SPV client in the event of such a consensus failure occurring.

There are several Bitcoin thin client implementations in the official repositories and in the AUR.

フルノード

A full node is a bitcoin client which starts with the initial genesis block of the blockchain, and sequentially validates the signature chain of every historical Bitcoin transaction and validity of each historical block to construct upon arriving at the tip of the chain the current Unspent Transaction Output Set (UTXO). This is the current set of unspent coins, and which private keys they are encumbered to. It is called a full node because it obviously verifies the cryptographic integrity of the UTXO set itself. A full node client may or may not also participate in relaying unconfirmed transactions around the network and operate a mempool of all unconfirmed transactions, and may or may not participate in serving the full historical blockchain to new full node clients bootstrapping themselves.

There are several Bitcoin full node implementations in the official repositories and in the AUR.

If you decide to install one: It is possible to run a full node that deletes almost all historical blocks, only keeping the recent history to a certain threshold, but only after having downloaded (260GB as of October 2019) and verified them (which is CPU intensive) in sequence to arrive at the present period it retains. This is to ensure the same guarantee of the cryptographic integrity of the UTXO set. Afterwards, one may reduce storage and limit bandwith.

The initial download of the blockchain can be sped up by increasing the database cache as much as your RAM allows, add dbcache=M to ~/.bitcoin/bitcoin.conf where M is the number of megabytes of RAM to allocate.

マイニング

ノート: マイニングで本当に稼ぐには専用のハードウェアが必須です。ハードウェアとパフォーマンスの比較は bitcoin.it wiki を見て下さい。Profit Calculator を使ってあなたのセットアップで利益が出るか確認することができます。

Bitcoin マイニングの基本概念は各ブロックには意味のないランダムなデータが含まれているということです。Bitcoin マイナーは最新のブロックから全てのデータを取得して、ランダムなデータを混ぜ合わせて全体のハッシュを計算します。有効なブロックが見つかるまでとにかく計算し続けます。ハッシュの複製は簡単ですが、ハッシュの予測は不可能であり、完全にランダムな値が生成されるため、マイナーはハッシュを生成するランダムなデータが何なのか予測するすべがありません。

マイニングするにはマイナーを使う必要があります。マイナーはハッシュを計算して Bitcoin を作成するプログラムです。マイニングに関してはこちらの 記事 が詳しく記述しています。

公式リポジトリAUR には Bitcoin マイナーがいくつか存在します。

インストール

bitcoin.org から出されている公式の Bitcoin アプリケーションは現在 "Bitcoin Core" と呼ばれており (元は "bitcoin-qt" と呼称されていました) Arch の公式リポジトリからインストールすることができます: (a) bitcoin-qt または (b) bitcoin-daemon bitcoin-cli パッケージ。Bitcoin Core のバージョン 0.10 までは、bitcoin-daemon の bitcoind は RPC サーバーと RPC クライアント 両方の働きをしていました。しかし、バージョン 0.10 から、Bitcoin Core の RPC クライアントは別のバイナリに分けられています (bitcoin-cli) 。bitcoin-qt と bitcoind はどちらも RPC サーバーとして機能するため、bitcoin-cli はどちらのサーバーも使うことができます。マシンに Bitcoin Core のパッケージを3つともインストールしても問題ありませんが、一度に実行できるのは bitcoind または bitcoin-qt のどちらか 片方だけ です。

ソフトウェアをコンピュータにインストールしても、それだけで Bitcoin は使えません。それはあくまですぐ終わることです。Bitcoin Core を使うにあたって時間がかかるのは BTC ブロックチェインの取得で、現在 (Feb 02015) は 22GB のデータファイルをマシンにダウンロードする必要があります。bitcoin-qt や bitcoind を起動すると、まず最初にソフトウェアは BTC ブロックチェインを全てダウンロードします。

軽量ソフトウェアとして公式リポジトリには multibit[リンク切れ: アーカイブ: aur-mirror]electrum があります。

以下の systemd サービスファイルで bitcoin-daemon を使うことができます ('User=' は変更するか bitcoin ユーザーを作成する必要があります):

/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


サンプル設定ファイル

以下は bitcoin-qt の設定ファイルの例です。次のコマンドを使ってファイルのモードを 600 に設定してください:

# 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

参照

Informational sites

  • Bitcoin Whitepaper - The original whitepaper published by Satoshi Nakamoto before the launch of the live Bitcoin network.
  • bitcoin.org - Today the site is an independent open source project with contributors from around the world. Final publication authority is held by the co-owners, but all regular activity is organized through the public pull request process and managed by the site co-maintainers.
  • bitcoin.it Wiki - Bitcoin Wikipedia.
  • Satoshi Nakamoto Institute - Thoughts and quotes from the designer.
  • Coin Dance - Broad purpose network statistics.
  • Introduction to Bitcoin concepts. - at 21.co

Discussion groups

  • bitcointalk.org - Forum
  • IRC Channels on Freenode:
    • #bitcoin - General Bitcoin-related
    • #bitcoin-mining - Mining discussion

Blockchain explorers