BTC
- Bitcoin creation
- From mining
- dig
- Verify transactions + solve math problems
- Issuance and settlement of BTC (Mining award –> issuance of BTC, verification trade –> settlement)
- Bitcoin protocol
- The difficulty is dynamically adjusted and stabilizes at an average of 10 minutes per block
- The total amount is fixed at 21 million BTC
- Halve the amount of BTC awarded for mining every four years
- Characteristics of Bitcoin
- Bitcoin network
- Purpose: To propagate transaction blocks to each node in a P2P network
- Bitcoin Client (Wallet APP)
- Full client (full node — all Bitcoin transactions, user wallet)
- Lightweight client (relying on third parties for transaction verification, etc.)
- Online client (fully dependent on third parties)
- Most wallet applications are lightweight, saving only utXOs in the current wallet
- The wallet application can receive the new transaction transmitted in the P2P network, or create a new transaction and send it to the P2P network, which can be obtained and transmitted by all the participating nodes (clients) in the P2P network
- Bitcoin wallet
- It must be protected by a password (private key) known only to the user
- The password must be complex. If stolen, BTC can be easily transferred to currencies around the world
- Bitcoin client use
- The client will automatically create: wallet, Bitcoin address (can be multiple addresses, anyone can transfer bitcoin to this address)
- A wallet can correspond to multiple addresses (1: N, where transactions are associated with the same wallet)
- The newly created wallet is empty, without Bitcoin
- The acquisition of the first Bitcoin
- Offline — private transactions between friends
- Online – Sell personal skills in exchange
- Online — exchange purchase
- Online – Open an account in the currency market
- Bitcoin transactions
- Wallet generated randomly –> private key + Bitcoin address
- Not trading bitcoin address only know themselves, in the bitcoin ledger (chain) is not found, only the transaction will be “on the chain”, can query the balance, will be known by the whole network of users
- Under the table:
- A provides his BTC address and 100 USD, B queries the exchange rate between BTC and USD, and then transfers the corresponding number of BTC to the Abtc address
- B opens the BTC transaction software (website), enters A’s BTC address and corresponding BTC quantity, and sends it
- The transaction was signed using B’s private key, which immediately generated A transaction, broadcast the entire network, and A’s BTC address became publicly known for the first time
- After the transaction is completed, there is no on-chain. BTC will be confirmed only after the “miner” has packaged all the transactions in the period into a block “block”. Otherwise, it will remain in the “unconfirmed” state. Confirmed transactions can be considered “trusted”. Only BTCS in confirmed transactions can be used.
- Bitcoin balance query
- With UTXO there is balance, without UTXO there is no balance
- After the transaction, there will be output. If there is output without phone fee, then the wallet still has BTC to continue to use, and utXO will be output
- Therefore, before creating a new transaction, you must first check whether the UTXO of the current wallet meets the condition (BTC enough or not), either from the UTXO copy of the local wallet application or from the blockchain network (Bitcoin network)
- Trade creation
- Bitcoin does not need to connect to the bitcoin network to create a transaction, only to execute the transaction
- Create transaction input:
- It will check whether a single UTXO meets the payment. If not, it will check other “loose change” UTXO to pay together
- Create trade output:
- If the input is greater than the BTC to be paid, the output of the transaction is divided into two parts
- Pay part, output a script (only the receiver’s key can be unblocked utXO, can be controlled by it)
- The rest (to their own BTC address, also only their own key can be unblocked UTXO)
- With the transaction fee, the mining union priority packaging, will be more probability of success
- Transaction propagation
- dig
- Miners are nodes in the Bitcoin network that also download the mining application?
- When a miner receives all the transactions since the last block, they are placed in a temporary, unverified “trade pool” local to the node, from which they are added to the block as new blocks are built.
- When adding transactions to a new block, transaction fees are prioritized from highest to lowest, and transactions are packaged in direct proportion to transaction fees
- When miners receive a new block from the Bitcoin network, they will realize that they have lost the competition and immediately enter the competition for the next block. They will construct the new block using the fingerprint of the previous new block + the transaction received by their own nodes as the input of the next block
- Miners add a special transaction to the blocks they build: they transfer 25BTC to their own Bitcoin address, and some join a mining alliance, which in this case is the BTC address of the entire alliance. When a block is successfully packaged and added to the public chain, it is awarded this reward, which the members of the consortium divide according to their work.
- When the miners to mine, will be the new block to the Bitcoin network to notify everyone, everyone after verification (other nodes how to verify), and then the new block competition
- How to understand the further, the more credibility increases? How does the new block relate to the amount of work done on the previous block?
- Bitcoin data structure
- Bitcoin ownership
- Necessary factors: digital key, Bitcoin address, digital signature
- Digital keys are wallets, which are generated by users and do not exist on the network, but in files or small databases. The key can only be known and kept by the user, independent of the Bitcoin network, so that the user has the ownership of their own Bitcoin assets. Unlike traditional bank card passwords, they are stored in the bank’s database and not only known by the user. If the user forgets the key, it can never be retrieved, and their bitcoin is lost forever
- Every BTC transaction requires a valid digital signature to be stored on the blockchain
- How are Bitcoin addresses created? What’s the relationship with the public key?
- The key
- Public key Encryption, key pair, public key, and private key
- The private key is a randomly generated 256-bit binary number
- A key can be used to generate a public key
- Can be used to generate a digital signature for a transaction
- Generate the private key
- Page 46 bitcoinbook. Info/wp – the content /…
- Private key Generates public key
- What private key generates public key functions that can be directly called for programming?
- The public key generates the bitcoin address
- The input is the public key, and the output is the BTC address, a string starting with “1”
- Bitcoin wallet
- A wallet is a container for the private key
- Seed? Seed generates the child private key
- There is a key pair (private key + public key) in the wallet.
- Seed wallets??
- HD Wallet (Layered Deterministic Wallet)
- HD purse: www.5bite.com/post/799.ht…
- At first glance, the term “hierarchical determinism” may seem “fancy”, and various documents describe it as “foggy”, but the principle itself is very simple, and can be explained in two sentences:
- First, a random number is used to generate the master (root) private key, just like any bitcoin wallet generates any private key. Then, a deterministic and irreversible algorithm is used to generate any number of child private keys based on the master private key.
- What are the functions of the public and private keys of a wallet?
- The most simple and straightforward understanding, can be understood as a "private key" password, "public key" as a card number, and "wallet" is our bank card in the blockchain world! - link: [https://www.jianshu.com/p/7070b710015a] (https://www.jianshu.com/p/7070b710015a)Copy the code
- The relationship between the private key, public key, and wallet addresses
- www.jianshu.com/p/23e42860e…
- The data included in the transaction: receiver address, transfer amount, payer’s signature, payer’s public key
- What are the functions of the payer’s signature and the payer’s public key?
- How does a public key verify a signature?
- Since the private key can generate a public key (one to one), seeing the public key can tell that it has the corresponding private key, which can be easily verified based on cryptography. But the private key is invisible, because there is no way to derive the private key from the public key. That way I can keep my private key safe and prove that I own it.
- Bitcoin transactions
- Does the first received node validate the transaction? A successful transaction message will be returned to the user and broadcast to other nodes connected to the blockchain network for verification. If the authentication fails, a transaction failure message is returned to the user and the transaction is rejected.
- The propagation of transactions in p2p networks
- Transaction data structure
- Bitcoin balance concept
- Transactions are created from UTXO
- The BTC address of the payment account is calculated by the private key of the payment account. So the transaction signature, the need to use the private key for verification, is again using the private key to generate the same calculation results of the BTC address to compare the BTC address??
- Transaction output structure
- Transaction input structure
- Transaction fee
- The input and output of transactions
- Each transaction takes at least one input and produces at least one output, and each transaction input can be traced back to the previous UTXO up to the initial mining proceeds. A Bitcoin transaction created from the proceeds of mining is the first transaction in each block. Also known as a Coinbase transaction, it is created by miners and does not output the previous transaction.
- UTXO:
- Lock script:OP_DUP OP_HASH160<pubKeyHash>OP_EQUALVERIFY OP_CHECKSIG
- pubKeyHash = ripemd160(sha256(pubKey))
- The unlock script verifies that UTXO belongs to you and includes your digital signature and your public key. Sign with a private key, and the public key validates the signature.
- Verify UTXO ownership:
- OP_DUP OP_HASH160* * * *OP_EQUALVERIFY OP_CHECKSIG
- Transaction process:
- P2P network node
- Each Bitcoin node is a set of features: routing, blockchain database, mining, wallet services.
- Classification:
- Full node: wallet + miner + complete blockchain + network routing node
- 六四运动