예제 #1
0
 def __init__(self, datadir):
     keyfile = path.join(datadir, 'ethkey.json')
     if path.exists(keyfile):
         data = json.load(open(keyfile, 'r'))
         self.priv = keys.decode_keystore_json(data, "FIXME: password!")
     else:
         self.priv = os.urandom(32)
         data = keys.make_keystore_json(self.priv, "FIXME: password!")
         json.dump(data, open(keyfile, 'w'))
     self.address = keys.privtoaddr(self.priv)
예제 #2
0
 def __init__(self, datadir):
     keyfile = path.join(datadir, 'ethkey.json')
     if path.exists(keyfile):
         data = json.load(open(keyfile, 'r'))
         self.priv = keys.decode_keystore_json(data, "FIXME: password!")
     else:
         self.priv = os.urandom(32)
         data = keys.make_keystore_json(self.priv, "FIXME: password!")
         json.dump(data, open(keyfile, 'w'))
     self.address = keys.privtoaddr(self.priv)
예제 #3
0
 def new(cls, password, key=None, uuid=None, path=None):
     """Create a new account.
     Note that this creates the account in memory and does not store it on disk.
     :param password: the password used to encrypt the private key
     :param key: the private key, or `None` to generate a random one
     :param uuid: an optional id
     """
     if key is None:
         key = mk_random_privkey()
     keystore = keys.make_keystore_json(key, password)
     keystore['id'] = uuid
     return Account(keystore, password, path)
예제 #4
0
파일: accounts.py 프로젝트: hughhhh/casper
 def new(cls, password, key=None, uuid=None, path=None):
     """Create a new account.
     Note that this creates the account in memory and does not store it on disk.
     :param password: the password used to encrypt the private key
     :param key: the private key, or `None` to generate a random one
     :param uuid: an optional id
     """
     if key is None:
         key = mk_random_privkey()
     keystore = keys.make_keystore_json(key, password)
     keystore['id'] = uuid
     return Account(keystore, password, path)