简单的区块链代码入门(python演示原理和solidity 的truffle发布)实验
好久没回CSDN了 本文是几个教程的更新和融合,一部分通过python实现展示简单的区块链结构和过程,一部分用truffle发布简单的solidity智能合约脚本,算是区块链入门(不算吧。。) python区块链模拟脚本(本地) 环境 : 3.7 python win10 import hashlib # class Block: # def __init__(self, data, prev_hash): # self.previous_hash = prev_hash # self.data = data # # # calculate hash # @property # def hash(self): # message = hashlib.sha256() # message.update(str(self.data).encode('utf-8')) # return message.hexdigest() class Block(): """" """ def __init__(self,data,prev_hash): self.previous_hash = prev_hash self.data = data self.nonce = "" @property def hash(self): message = hashlib.sha256() message