Blockchainのトランザクション

transaction1 = {“time”: “”, “sender”: “C”, “receiver”: “D”, “amount”: 1}

トランザクションの作成

import datetime

time_now = datetime.datetime.now(datetime.timezone.utc).isoformat()
transaction1 = {"time": time_now, "sender": "C", "receiver": "D", "amount": 1}

time_now = datetime.datetime.now(datetime.timezone.utc).isoformat()
transaction2 = {"time": time_now, "sender": "D", "receiver": "E", "amount": 3}

transactions = [transaction1, transaction2]
print(transactions)

$ python3 transaction.py
[{‘time’: ‘2023-09-23T06:31:46.973357+00:00’, ‘sender’: ‘C’, ‘receiver’: ‘D’, ‘amount’: 1}, {‘time’: ‘2023-09-23T06:31:46.973375+00:00’, ‘sender’: ‘D’, ‘receiver’: ‘E’, ‘amount’: 3}]