Stuff About Computer Networking and Computer Security
:)
Saturday, April 2, 2016
Pasabuy
Sunday, August 28, 2011
Bitcoin Transactions
We describe the simplest case of transactions in Bitcoin. Bitcoin defines a coin as a chain of transactions. When transferring coins from A to B, A gets a hash of the previous transaction. A generates a new asymmetric key pair. A digitally signs using her generated private key the hash of the current transaction. The transaction will now consist of the hash of the previous transaction, the digital signature, A's public key, the hash of B's public key (B's address) and the coins that will be sent. A broadcasts the transaction to other nodes.
All nodes receiving the transaction verifies the ownership of the coins in that transaction. A user only stores private keys in their wallet. However, the public key can be easily generated from the private key in an asymmetric key pair (but not vice versa). So B receiving the transaction generates all her public key. She hashes the each key and compares it to the address in the transaction. If one is equal, this means that she now owns the coins in that transaction.
The first transaction in a transaction chain is the generation transaction, which gives 50 Bitcoins to a node that solves a block. The generation transaction is also the first transaction in a valid block.
Friday, August 26, 2011
How POW is a solution to synchronization and global view.
One would question how the system handles consistency of block chains (or the transactions database) of every node. Each of the nodes must have all the transactions in their block chains.
Transactions are publicly announced and are broadcast to the network. If two same transactions are propagated nearly the same time, nodes will only accept the first one that arrives and incorporate it in their potential block, rejecting the second transaction. Now if the two transactions are almost sent to the network at the same time, majority of the nodes would receive the first transaction while the remaining nodes would accept the second one. The first transaction will obviously have a huge advantage on being included on the valid block and the block chain first since the collective CPU power of the majority nodes is greater than the other nodes. Note that the time of finding a proof-of-work by solving a block is proportional to the CPU power of all the nodes working on it. When a proof-of-work is found, the valid block will be propagated to other nodes. Nodes will drop their current potential block, add the received valid block to their block chain and work on a new block. The second transaction after seeing that the first transaction is in the new block chain will be considered as invalid.
Blocks are created every 10 minutes. If the average time becomes shorter up to a certain threshold, the difficulty of creating a block doubles. Suppose two different blocks (with slightly different transactions) are solved and propagated throughout the network nearly at the same time. A node keeps them both but only the first one that arrives is accepted to the chain. The transactions in the second valid block which are not in the first block will be included into the new potential block.