'Select An Option:\n1. Create User\t2. Mine Block\t3. Get Balance\t4. Create Transaction\t5. Exit\n' )) if main_choice == 1: name = input('Enter Name:\n') address = input('Enter Address (Numeric):\n') newUser = User(name, address) users.append(newUser) print('User Created Successfully!') elif main_choice == 2: address = input('Enter Your Address:\n') for user in users: if address == user.address: RYCOIN.minePendingTransactions(user.address) print('Block Mined Successfully!') elif main_choice == 3: address = input('Enter Your Address:\n') for user in users: if address == user.address: bal = RYCOIN.getBalance(user.address) print('Your Balance is: ' + str(bal)) elif main_choice == 4: toAdd = input('Enter Reciever\'s Address:\n') fAdd = input('Enter Your Address:\n') amount = int(input('Enter Amount\n')) newTransaction = Transaction(toAdd, fAdd, amount) RYCOIN.createTransaction(newTransaction) print('Transaction Made Successfully!') elif main_choice == 5: print(RYCOIN) exit()
from blockchain import BlockChain from wallet import wallet #Robin Danz - Joris Monnet #He-Arc - Security if __name__ == '__main__': firstChain = BlockChain() firstChain.createFirstBlock() print(firstChain) firstWallet = wallet.create_wallet() secondWallet = wallet.create_wallet() print("Second Wallet values = " + str(secondWallet)) firstChain.mine(firstWallet["address"]) firstChain.mine(secondWallet["address"]) firstChain.createTransaction(firstWallet["address"], secondWallet["address"], 5) print(firstChain) secondChain = BlockChain() secondChain.createFirstBlock() secondChain.mine(firstWallet["address"]) secondChain.mine(firstWallet["address"]) secondChain.mine(firstWallet["address"]) print(secondChain) firstChain.replaceChain(secondChain.getChain()) print(firstChain)