AccountManager
构造方法
- AccountManager(), parameter:null,return: void
AccountManager manager = new AccountManager();
创建钱包
- newAccount(passphrase),parameter:String,return: Address
Address address = manager.newAccount(passphrase);
测试钱包账户是否存在
- contains(address),parameter:Address,return: boolean
boolean result = manager.contains(address);
获取所有钱包地址构成的列表
- accounts(), parameter:null,return: List
List<Address> addresses = manager.accounts();
修改账户密码
- update(address, passphrase, newPassphrase),parameter:Address, String, String,return: void
byte[] newPassphrase = "newpassphrase".getBytes();
manager.update(address, passphrase, newPassphrase);
根据keystore和密码得到钱包地址
- load(Byte[] out, String passphrase),parameter:Byte[], String,return: Address
Address address = manager.newAccount(passphrase);
byte[] out = manager.export(address, passphrase);
Address got = manager.load(out, passphrase);
Assert.assertEquals(address.string(), got.string());
``
###得到keystore文件
* export(address, passphrase),parameter:Address, String, String,return: Byte[]
```java
byte[] out = manager.export(address, passphrase);
删除钱包
- delete(),parameter:Address, String, String,return: void
manager.delete(address, passphrase);
signHash()
Address
字符串化
Address address = Address.NewAddressFromPubKey(pub);
得到Address的类型
Address address = Address.NewAddressFromPubKey(pub);
Assert.assertEquals(address.type(), Address.AddressType.ACCOUNT);
从pubkey得到钱包地址
- newAddressFromPubKey(),return Address
Address address = Address.NewAddressFromPubKey(pub);
转换类型,String to Address
- parseFromString(String),return Address
Address address = Address.ParseFromString(addr);
Transaction
计算交易的哈希
byte[] calHash = transaction.calculateHash();
XXX
网友评论