コード例 #1
0
def MakeUserAccount(UserID, Users):
    """
    UserID : <int>
    Users : <dict> 
    Returns account (Account object)
    """
    #Make a Account and for the scenario,
    #Assume every User has 10 equipment and 10000 tokens
    user = Account(UserID)
    user.save_Equipment(100)
    user.save_Balance(10000)
    #stor user object in 'Users' dictionary
    Users[UserID] = user
    #create Transaction data to store in the block
    trx = Transaction(sender=AdminID,
                      receiver=UserID,
                      amount=10000,
                      obj=['Equipment', 10])

    return user, trx
コード例 #2
0
MinerID = 111

UserID = [random.randint(200, 800)
          for i in range(10)]  #Create  10 Users randomly
Users = {}  #Store User object Userid : <class>account
size = 10
PC = {}  #Store every Private channel in storage

#Total Property in Server
Total_Token = 10000000  # 10000000 tokens
Total_Equipment = 1000  # 1000 equipments
# Total_ETC = 10000

#Creating Admin account, Setting primary numbers of Tokens and Equipments
Admin = Account(AdminID)
Admin.save_Equipment(1000)
# Admin.save_ETC(10000)
Admin.save_Balance(10000000)

Transactions_que = []  #Temporary Storage for new transactions
# Temporary_que = [] #The transaction will wait till six blocks added

PrivateChannel_Network = np.zeros(
    (size, size))  #Graph of PrivateChannel among users
PrivateChannel_Network[:][:] = 999
for i in range(size):
    PrivateChannel_Network[i][i] = 0

#First Transaction of the server is setting the primary properties in Admin account
Base_Trx = Transaction(sender=000,
                       receiver=AdminID,