

























There are three Bitcoin protocols
The nonce is only 32 bits, Changing that might not be sufficient to get the desired number of difficulty(70+ zeros). Therefore, changes can be made to the Coinbase transaction (explained below) to generate more randomness.
A coinbase transaction is the first transaction of the block where the miner assigns new money to them based on the creation rate rules. It can contain an arbitrary string that can be changed to generate the hash of the desired difficulty. The order of transactions in the transaction Merkle tree also impacts the hash.
Reset every 2016 blocks (= 2 weeks/10 minutes).
Dnew = Dold * (tLast - tFirst)/(14 * 24 * 60)
This has an off-on-one error; it should have been 20150 and not 20160. Difficulty goes up quickly. This cannot be changed, and it’s part of the Bitcoin ecosystem.
A binary tree with all the transactions in leaves. All parents are hashes of the children concatenated. This is stored outside the Bitcoin block hashes.
Bitcoin has no notion of accounts and balances. Ethereum has. Bitcoin ledger consists of UTXO (unspent transaction outputs), which are outputs of a transaction. As soon as a UTXO is used as input for another transaction, it cannot be used again. Previous transaction output is referenced via its hash and an index into its outputs. Therefore, each transaction uses all the UTXO inputs. This UTXO set is growing pretty rapidly as well. Small-value UTXOs are nick-named dust.
Bitcoin is not limited to sending money to a public key address. All the money is spent via Bitcoin scripts. You send money to a function f(), and anyone who can produce an x such that f(x) is true can redeem it. The Bitcoin script is a stack-based language with no loops or backward jumps => code always finishes and is not Turing complete. It has no big number support or floating points either. What most transactions look like in theory is f(sig, key) { if key == k and verify(sig, key, transaction) { return true } }. This is expressed in a complicated Bitcoin script. This can be used for writing smart contracts. What happens in practice is more complicated. The UTXO (output transaction) has the redemption script “scriptPubKey” and the spending transaction (input transaction which is using the UTXO) specifies the signature “scriptSig”. Bitcoin VM runs “scriptSig || scriptPubKey” and waits for true as an output. Anything except true (including a crash) is a failure outcome. Try out the language here.
Some examples:
<sig> <pubKey> - scriptSig and OP_DUP OP_HASH160 <pubkeyhash?> OP_EQUALVERIFY OP_CHECKSIG - scriptPubKey is the standard spending transaction.</pubkeyhash?>OP_RETURN - Nobody can spend. Proof of burn to get something else in return. OP_RETURN can be followed by 40 bytes of the data on the chain permanently.此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。