本文整理了Java中io.nuls.kernel.model.Address.getBase58()
方法的一些代码示例,展示了Address.getBase58()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getBase58()
方法的具体详情如下:
包路径:io.nuls.kernel.model.Address
类名称:Address
方法名:getBase58
暂无
代码示例来源:origin: nuls-io/nuls
public void removeAccount(Address address) {
this.cacheMap.remove(address.getBase58());
}
代码示例来源:origin: nuls-io/nuls
/**
* 缓存一个账户
* Cache an account
*
* @param account Account to be cached
*/
public void putAccount(Account account) {
this.cacheMap.put(account.getAddress().getBase58(), account);
}
代码示例来源:origin: nuls-io/nuls
public MultiSigAccountDto(MultiSigAccount account) {
this.address = account.getAddress().getBase58();
this.pubkeys = new ArrayList<>();
for (byte[] bytes : account.getPubKeyList()) {
Map<String, String> map = new HashMap<>();
map.put("pubkey", Hex.encode(bytes));
map.put("address", AddressTool.getStringAddressByBytes(AddressTool.getAddress(bytes)));
pubkeys.add(map);
}
this.m = account.getM();
this.alias = account.getAlias();
if (null == alias) {
this.alias = "";
}
}
代码示例来源:origin: nuls-io/nuls
@Override
public String toString() {
StringBuilder str = new StringBuilder();
for (MeetingMember member : this.getMemberList()) {
str.append(Address.fromHashs(member.getPackingAddress()).getBase58());
str.append(" ,order:" + member.getPackingIndexOfRound());
str.append(",packTime:" + new Date(member.getPackEndTime()));
str.append(",creditVal:" + member.getRealCreditVal());
str.append("\n");
}
if (null == this.getPreRound()) {
return ("round:index:" + this.getIndex() + " , start:" + new Date(this.getStartTime())
+ ", netTime:(" + new Date(TimeService.currentTimeMillis()).toString() + ") , totalWeight : " + totalWeight + " ,members:\n :" + str);
} else {
return ("round:index:" + this.getIndex() + " ,preIndex:" + this.getPreRound().getIndex() + " , start:" + new Date(this.getStartTime())
+ ", netTime:(" + new Date(TimeService.currentTimeMillis()).toString() + ") , totalWeight : " + totalWeight + " , members:\n :" + str);
}
}
}
代码示例来源:origin: nuls-io/nuls
Account account = po.toAccount();
list.add(account);
addressList.add(account.getAddress().getBase58());
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
代码示例来源:origin: nuls-io/nuls
/**
* 初始化缓存本地所有账户的余额信息
*/
public void initAccountBalance() {
balanceMap.clear();
Collection<Account> accounts = accountService.getAccountList().getData();
if (accounts == null) {
return;
}
for (Account account : accounts) {
try {
calBalanceByAddress(account.getAddress().getAddressBytes());
} catch (NulsException e) {
Log.info("getbalance of address[" + account.getAddress().getBase58() + "] error");
}
}
}
代码示例来源:origin: nuls-io/nuls
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
代码示例来源:origin: nuls-io/nuls
public Result getEncryptedPrivateKey(String address, String priKey, String password) {
if (!ECKey.isValidPrivteHex(priKey)) {
return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
}
Account account;
try {
account = AccountTool.createAccount(priKey);
if (!address.equals(account.getAddress().getBase58())) {
return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
}
account.encrypt(password);
} catch (NulsException e) {
return Result.getFailed(AccountErrorCode.FAILED);
}
return Result.getSuccess().setData(Hex.encode(account.getEncryptedPriKey()));
}
代码示例来源:origin: nuls-io/nuls
public AccountDto(Account account) {
this.address = account.getAddress().getBase58();
this.alias = account.getAlias();
this.pubKey = Hex.encode(account.getPubKey());
this.createTime = account.getCreateTime();
if (account.getExtend() != null) {
this.extend = Hex.encode(account.getExtend());
}
this.encrypted = account.isEncrypted();
this.remark = account.getRemark();
}
代码示例来源:origin: nuls-io/nuls
byte[] priKeyBytes = AESEncrypt.decrypt(Hex.decode(priKey), password);
Account tempAccount = AccountTool.createAccount(Hex.encode(priKeyBytes));
if (!address.equals(tempAccount.getAddress().getBase58())) {
return Result.getFailed(AccountErrorCode.PARAMETER_ERROR).toRpcClientResult();
代码示例来源:origin: nuls-io/nuls
public void initAllTokensForAllAccounts() {
Result<Collection<Account>> result = accountService.getAccountList();
if(result.isFailed()) {
return;
}
Result<List<ContractAddressInfoPo>> allContractInfoListResult = contractAddressStorageService.getAllNrc20ContractInfoList();
if(allContractInfoListResult.isFailed()) {
return;
}
List<ContractAddressInfoPo> contractAddressInfoPoList = allContractInfoListResult.getData();
Collection<Account> list = result.getData();
for(Account account : list) {
Address address = account.getAddress();
String addressStr = address.getBase58();
for(ContractAddressInfoPo po : contractAddressInfoPoList) {
initialContractToken(addressStr, AddressTool.getStringAddressByBytes(po.getContractAddress()));
}
}
}
代码示例来源:origin: nuls-io/nuls
public Result setRemark(String address, String remark){
if (!AddressTool.validAddress(address)) {
return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
}
Account account = accountService.getAccount(address).getData();
if (null == account) {
return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
}
if (StringUtils.isBlank(remark)) {
remark = null;
}
if (!StringUtils.validRemark(remark)) {
return Result.getFailed(AccountErrorCode.NICKNAME_TOO_LONG);
}
account.setRemark(remark);
Result result = accountStorageService.updateAccount(new AccountPo(account));
if (result.isFailed()) {
return Result.getFailed(AccountErrorCode.FAILED);
}
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
return Result.getSuccess().setData(true);
}
代码示例来源:origin: nuls-io/nuls
@Override
public Result removeAccount(String address, String password) {
if (!AddressTool.validAddress(address)) {
return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
}
Account account = getAccountByAddress(address);
if (account == null) {
return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
}
//加过密(有密码)并且没有解锁, 就验证密码 Already encrypted(Added password) and did not unlock, verify password
if (account.isEncrypted() && account.isLocked()) {
if (!account.validatePassword(password)) {
return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
}
}
Result result = accountStorageService.removeAccount(account.getAddress());
if (result.isFailed()) {
return result;
}
accountLedgerService.deleteUnconfirmedTx(account.getAddress().getAddressBytes());
accountCacheService.localAccountMaps.remove(account.getAddress().getBase58());
return Result.getSuccess().setData(true);
}
代码示例来源:origin: nuls-io/nuls
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
代码示例来源:origin: nuls-io/nuls
public AccountOfflineDto(Account account) {
this.address = account.getAddress().getBase58();
this.alias = account.getAlias();
this.pubKey = Hex.encode(account.getPubKey());
this.createTime = account.getCreateTime();
if (account.getExtend() != null) {
this.extend = Hex.encode(account.getExtend());
}
this.encrypted = account.isEncrypted();
if (encrypted) {
this.encryptedPriKey = Hex.encode(account.getEncryptedPriKey());
this.priKey = "";
} else {
this.priKey = Hex.encode(account.getPriKey());
this.encryptedPriKey = "";
}
this.remark = account.getRemark();
}
代码示例来源:origin: nuls-io/nuls
continue;
calcRewardHistory(account.getAddress().getBase58(), list, startHeight);
代码示例来源:origin: nuls-io/nuls
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
代码示例来源:origin: nuls-io/nuls
return Result.getFailed(AccountErrorCode.FAILED);
accountCacheService.localAccountMaps.put(account.getAddress().getBase58(), account);
} catch (NulsException e) {
Log.error(e);
代码示例来源:origin: nuls-io/nuls
public BlockDto(BlockHeader header) throws IOException {
long bestBlockHeight = NulsContext.getInstance().getBestBlock().getHeader().getHeight();
this.hash = header.getHash().getDigestHex();
this.preHash = header.getPreHash().getDigestHex();
this.merkleHash = header.getMerkleHash().getDigestHex();
this.time = header.getTime();
this.height = header.getHeight();
this.txCount = header.getTxCount();
this.packingAddress = Address.fromHashs(header.getPackingAddress()).getBase58();
this.scriptSign = Hex.encode(header.getBlockSignature().serialize());
this.extend = Hex.encode(header.getExtend());
this.confirmCount = bestBlockHeight - this.height;
try {
BlockExtendsData roundData = new BlockExtendsData(header.getExtend());
this.roundIndex = roundData.getRoundIndex();
this.roundStartTime = roundData.getRoundStartTime();
this.consensusMemberCount = roundData.getConsensusMemberCount();
this.packingIndexOfRound = roundData.getPackingIndexOfRound();
if(roundData.getStateRoot() != null) {
this.stateRoot = Hex.encode(roundData.getStateRoot());
}
} catch (Exception e) {
Log.error(e);
}
}
代码示例来源:origin: nuls-io/nuls
public BlockHeaderDto(BlockHeader header) throws IOException {
long bestBlockHeight = NulsContext.getInstance().getBestBlock().getHeader().getHeight();
this.hash = header.getHash().getDigestHex();
this.preHash = header.getPreHash().getDigestHex();
this.merkleHash = header.getMerkleHash().getDigestHex();
this.time = header.getTime();
this.height = header.getHeight();
this.txCount = header.getTxCount();
this.packingAddress = Address.fromHashs(header.getPackingAddress()).getBase58();
this.scriptSign = Hex.encode(header.getBlockSignature().serialize());
this.confirmCount = bestBlockHeight - this.height;
this.extend = Hex.encode(header.getExtend());
try {
BlockExtendsData roundData = new BlockExtendsData(header.getExtend());
this.roundIndex = roundData.getRoundIndex();
this.roundStartTime = roundData.getRoundStartTime();
this.consensusMemberCount = roundData.getConsensusMemberCount();
this.packingIndexOfRound = roundData.getPackingIndexOfRound();
if(roundData.getStateRoot() != null) {
this.stateRoot = Hex.encode(roundData.getStateRoot());
}
} catch (Exception e) {
Log.error(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!