本文整理了Java中io.nuls.kernel.model.Address.fromHashs()
方法的一些代码示例,展示了Address.fromHashs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.fromHashs()
方法的具体详情如下:
包路径:io.nuls.kernel.model.Address
类名称:Address
方法名:fromHashs
暂无
代码示例来源:origin: nuls-io/nuls
public static Address fromHashs(String address) throws Exception {
byte[] bytes = AddressTool.getAddress(address);
return fromHashs(bytes);
}
代码示例来源:origin: nuls-io/nuls
@Override
public void parse(NulsByteBuffer byteBuffer) throws NulsException {
byte[] bytes = byteBuffer.readBytes(Address.ADDRESS_LENGTH);
this.address = Address.fromHashs(bytes);
this.m = byteBuffer.readUint32();
this.pubKeyList = new ArrayList<>();
long count = byteBuffer.readUint32();
for (int i = 0; i < count; i++) {
pubKeyList.add(byteBuffer.readByLengthByte());
}
}
代码示例来源: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
public Address(String address) {
try {
byte[] bytes = AddressTool.getAddress(address);
Address addressTmp = Address.fromHashs(bytes);
this.chainId = addressTmp.getChainId();
this.addressType = addressTmp.getAddressType();
this.hash160 = addressTmp.getHash160();
this.addressBytes = calcAddressbytes();
} catch (Exception e) {
Log.error(e);
}
}
代码示例来源:origin: nuls-io/nuls
private void initGengsisTxs(Map<String, Object> jsonMap) throws Exception {
List<Map<String, Object>> list = (List<Map<String, Object>>) jsonMap.get(CONFIG_FILED_TXS);
if (null == list || list.isEmpty()) {
throw new NulsRuntimeException(KernelErrorCode.CONFIG_ERROR);
}
CoinData coinData = new CoinData();
for (Map<String, Object> map : list) {
String address = (String) map.get(CONFIG_FILED_ADDRESS);
AssertUtil.canNotEmpty(address, KernelErrorCode.NULL_PARAMETER.getMsg());
Double amount = Double.valueOf("" + map.get(CONFIG_FILED_AMOUNT));
AssertUtil.canNotEmpty(amount, KernelErrorCode.NULL_PARAMETER.getMsg());
Long lockTime = Long.valueOf("" + map.get(CONFIG_FILED_LOCK_TIME));
Address ads = Address.fromHashs(address);
Coin coin = new Coin(ads.getAddressBytes(), Na.parseNuls(amount), lockTime == null ? 0 : lockTime.longValue());
coinData.addTo(coin);
}
CoinBaseTransaction tx = new CoinBaseTransaction();
tx.setTime(this.blockTime);
tx.setCoinData(coinData);
String remark = (String) jsonMap.get(CONFIG_FILED_REMARK);
if (StringUtils.isNotBlank(remark)) {
tx.setRemark(Hex.decode(remark));
}
tx.setHash(NulsDigestData.calcDigestData(tx.serializeForHash()));
List<Transaction> txlist = new ArrayList<>();
txlist.add(tx);
setTxs(txlist);
}
代码示例来源:origin: nuls-io/nuls
/**
* 从数据库中删除该账户
*/
@Override
public Result<Boolean> removeMultiSigAccount(String address) {
try {
Address addressObj = Address.fromHashs(address);
Result result = this.multiSigAccountStorageService.getAccount(addressObj);
if (result.isFailed() || result.getData() == null) {
return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
}
return this.multiSigAccountStorageService.removeAccount(addressObj);
} catch (Exception e) {
Log.error(e);
return Result.getFailed();
}
}
}
代码示例来源:origin: nuls-io/nuls
/**
* 根据地址获取本地存储的多签账户的详细信息
* Get the details of the locally stored multi-sign account based on the address
*
* @param address 多签地址
* @return 多签账户的详细信息
*/
@Override
public Result<MultiSigAccount> getMultiSigAccount(String address) throws Exception {
byte[] bytes = this.multiSigAccountStorageService.getAccount(Address.fromHashs(address)).getData();
if (null == bytes) {
return Result.getFailed(KernelErrorCode.DATA_NOT_FOUND);
}
MultiSigAccount account = new MultiSigAccount();
account.parse(new NulsByteBuffer(bytes, 0));
List<AliasPo> list = aliasStorageService.getAliasList().getData();
for (AliasPo aliasPo : list) {
if (aliasPo.getAddress()[2] != NulsContext.P2SH_ADDRESS_TYPE) {
continue;
}
if (Arrays.equals(aliasPo.getAddress(), account.getAddress().getAddressBytes())) {
account.setAlias(aliasPo.getAlias());
break;
}
}
return Result.getSuccess().setData(account);
}
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!