def listtarns(): AccountName = '66053664cae16a575ea087ce17c2b400326c366d64580818f14db15b27dbdf86' newBlockChain = BlockChain() newBlockChain.FileTo() tranList = AccountAllTrans(AccountName, newBlockChain) for tran in tranList: print(tran)
def listcoins(): newBlockChain = BlockChain() newBlockChain.FileTo() AccountName = '66053664cae16a575ea087ce17c2b400326c366d64580818f14db15b27dbdf86' coinList = AccountAllCoins(AccountName=AccountName, BlockChain=newBlockChain) for coin in coinList: print(coin)
def miner(): AccountName = miner[0] while True: newblockChain = BlockChain() newblockChain.FileTo() God = CreateAccount() God.FileTo() ex_mesg = "" newBlock = MiningOneBlock(AccountName, newblockChain, God, ex_mesg) newblockChain.AddBlockToChain(tx_list=[], newBlock=newBlock) newblockChain.ToFile() print('已完成')
def MingBlock(AccountName): blockChainObject = BlockChain() blockChainObject.FileTo() God = CreateAccount() God.FileTo() ex_mesg = "" global newBlock global flag flag = 1 newBlock = MiningOneBlock(AccountName, blockChainObject, God, ex_mesg) print("new block succeed!!") flag = 0