BlockchainCharlotte / blockchain

A simple Blockchain in Python
MIT License
0 stars 2 forks source link

Add transaction hash and timestamp to transactions #7

Closed lancekrogers closed 7 years ago

lancekrogers commented 7 years ago

In order to reference previous transactions we need to timestamp each transaction, hash the transaction and add the hash to the the transaction as a transaction id

rcherukuri83 commented 7 years ago

also Lance, the below transaction appears by default when we mine, this need not happen correct? { "amount": 1, "recipient": "93b56664c4ac4735bd4e61a3409d547f", "sender": "0" }

jcopley commented 7 years ago

This is actually the mining reward for producing the block. Look in the mine function for details. The recipient is the node_identifier, a random Id created when the application is instantiated. In production it wouldn’t work this way; the miner would have some way of controlling what address would receive the reward.

rcherukuri83 commented 7 years ago

hank you Joe, I notice this piece ..

TODO add block halving algorithm based on chain length

blockchain.new_transaction(
    sender=“0”,
    recipient=node_identifier,
    amount=1,
) 

.. until you mentioned I did not realize it is the reward :slightly_smiling_face:

lancekrogers commented 7 years ago

I justed push this addition to Master. I also created a new branch called io_transactions that uses references to unspent transactions instead of recipient and sender addresses.