Exemplo n.º 1
0
	def generate_next_block(self, data):
		index = len(self.blockchain_store)
		previous_hash = self.latest_block().hash
		timestamp = int(time.time())

		params = block_params.BlockParams(index, previous_hash, timestamp, data)
		new_block = block.Block(params)
		self.blockchain_store.append(new_block)
Exemplo n.º 2
0
 def params(self):
     return block_params.BlockParams(self.index, self.previous_hash,
                                     self.timestamp, self.data)
Exemplo n.º 3
0
def create_block(index, previous_hash, timestamp, data):
    params = block_params.BlockParams(index, previous_hash, timestamp, data)
    return block.Block(params)