java

2018-05-18  本文已影响0人  liuzhangjie

AccountManager

构造方法

AccountManager manager = new AccountManager();

创建钱包

Address address = manager.newAccount(passphrase);

测试钱包账户是否存在

boolean result = manager.contains(address);

获取所有钱包地址构成的列表

List<Address> addresses = manager.accounts();

修改账户密码

byte[] newPassphrase = "newpassphrase".getBytes();
manager.update(address, passphrase, newPassphrase);

根据keystore和密码得到钱包地址

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);

删除钱包

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得到钱包地址

Address address = Address.NewAddressFromPubKey(pub);

转换类型,String to Address

Address address = Address.ParseFromString(addr);

Transaction

计算交易的哈希

byte[] calHash = transaction.calculateHash();

XXX

上一篇 下一篇

猜你喜欢

热点阅读