Ejemplo n.º 1
0
 def test_Account(self):
     resp = accounts.new(self.nodeServer, ent=128)
     print('new', resp)
     if resp['done'] == True:  # 如果返回结果为true,
         _newSecret = resp['data']['secret']  # 获取新建账号返回结果中的地址和公钥
         _newPublicKey = resp['data']['publicKey']
         _newAddress = resp['data']['address']
         print('open', accounts.open(self.nodeServer, _newSecret))
         print('open2', accounts.open2(self.nodeServer, _newPublicKey))
         print('getBalance',
               accounts.getBalance(self.nodeServer, _newAddress))
         print('getPublicKey',
               accounts.getPublicKey(self.nodeServer, _newAddress))
         print(
             'generatePublicKey',
             accounts.generatePublicKey(self.nodeServer,
                                        self.genesisSecret))
         print('getDelegates',
               accounts.getDelegates(self.nodeServer, _newAddress))
         print('getAccount',
               accounts.getAccount(self.nodeServer, _newAddress))
         print('accountOnChain',
               accounts.accountOnChain(self.nodeServer, _newAddress))
         print('delayOrders',
               accounts.delayOrders(self.nodeServer, _newAddress))
         print('delayOrders',
               accounts.delayOrders(self.nodeServer, _newAddress, 1))
Ejemplo n.º 2
0
 def test_newAccount(self):
     r = accounts.new(self.nodeServer, ent=128)
     print('new', r)
     s = r['data']['secret']
     p = r['data']['publicKey']
     a = r['data']['address']
     return s, p, a
Ejemplo n.º 3
0
def set_newAccount():
    url = 'http://39.105.210.35:5000'
    r = accounts.new(url, ent=128)
    r['url'] = url
    r['suppersecret'] = 'race forget pause shoe trick first abuse insane hope budget river enough'
    r['superpublickey'] = 'bd93add22ab931a279f0ef741b768796afc3756ec697f76bef4e2f634969294d'
    r['reciptionid'] = 'AMFcPgkRndYVgjMs9gKTKMEwW72yGivw3z'
    print('new', r)
    account = json.dumps(r)  #把返回的json对象转成字符串用dumps()保存写入txt,先转字符串后写
    f = open('./account.txt', 'w', encoding='utf-8')
    # account=str(r)
    f.write(account)
    return account
Ejemplo n.º 4
0
#!/usr/bin/env python 
# -*- encoding: utf-8 -*-

import accounts

_nodeServer = 'http://39.105.210.35:5000'

_genesisSecret = 'fluid bracket forum either face bird toy april boss stamp february pencil'
_genesisPublicKey = '220ca36be9d82e9b88abf25d2bdf8de9fd858f381a3cbd5a01d20a1637f28835'
_genesisAddress = 'AKEfwcTExJ4NZZ9C5o3P7q5mQcrvuL9vAi'

if __name__ == "__main__":
    accounts.addDelegates(_nodeServer, _genesisSecret, remove='a08dc0d7b170a0e12caff0a7faaef952741e65f3585905a5847e4d877d650f07')
    resp = accounts.new(_nodeServer, ent=128)
    print('new', resp)
    if resp['done'] == True:  #如果返回结果为true,
        _newSecret = resp['data']['secret']   #获取新建账号返回结果中的地址和公钥
        _newPublicKey = resp['data']['publicKey']
        _newAddress = resp['data']['address']
        print('open', accounts.open(_nodeServer, _newSecret))
        print('open2', accounts.open2(_nodeServer, _newPublicKey))
        print('getBalance', accounts.getBalance(_nodeServer, _newAddress))
        print('getPublicKey', accounts.getPublicKey(_nodeServer, _newAddress))
        print('generatePublicKey', accounts.generatePublicKey(_nodeServer, _newSecret))
        print('getDelegates', accounts.getDelegates(_nodeServer, _newAddress))
        print('getAccount', accounts.getAccount(_nodeServer, _newAddress))
        print('accountOnChain', accounts.accountOnChain(_nodeServer, _newAddress))
        print('delayOrders', accounts.delayOrders(_nodeServer, _newAddress))
        print('delayOrders', accounts.delayOrders(_nodeServer, _newAddress, 1))

    print('===========================================')