当前位置: 首页>>代码示例>>Java>>正文


Java BigIntegers.fromUnsignedByteArray方法代码示例

本文整理汇总了Java中org.spongycastle.util.BigIntegers.fromUnsignedByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java BigIntegers.fromUnsignedByteArray方法的具体用法?Java BigIntegers.fromUnsignedByteArray怎么用?Java BigIntegers.fromUnsignedByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongycastle.util.BigIntegers的用法示例。


在下文中一共展示了BigIntegers.fromUnsignedByteArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public static RemascState create(byte[] data) {
    RLPList rlpList = (RLPList)RLP.decode2(data).get(0);
    byte[] rlpRewardBalanceBytes = rlpList.get(0).getRLPData();
    byte[] rlpBurnedBalanceBytes = rlpList.get(1).getRLPData();

    BigInteger rlpRewardBalance = rlpRewardBalanceBytes == null ? BigInteger.ZERO : BigIntegers.fromUnsignedByteArray(rlpRewardBalanceBytes);
    BigInteger rlpBurnedBalance = rlpBurnedBalanceBytes == null ? BigInteger.ZERO : BigIntegers.fromUnsignedByteArray(rlpBurnedBalanceBytes);

    SortedMap<Long, List<Sibling>> rlpSiblings = RemascStorageProvider.getSiblingsFromBytes(rlpList.get(2).getRLPData());

    byte[] rlpBrokenSelectionRuleBytes = rlpList.get(3).getRLPData();

    Boolean rlpBrokenSelectionRule;

    if (rlpBrokenSelectionRuleBytes != null && rlpBrokenSelectionRuleBytes.length != 0 && rlpBrokenSelectionRuleBytes[0] != 0) {
        rlpBrokenSelectionRule = Boolean.TRUE;
    } else {
        rlpBrokenSelectionRule = Boolean.FALSE;
    }

    return new RemascState(rlpRewardBalance, rlpBurnedBalance, rlpSiblings, rlpBrokenSelectionRule);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:23,代码来源:RemascState.java

示例2: create

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public static Sibling create(byte[] data) {
    ArrayList<RLPElement> params = RLP.decode2(data);
    RLPList sibling = (RLPList) params.get(0);

    byte[] hash = sibling.get(0).getRLPData();
    byte[] coinbase = sibling.get(1).getRLPData();
    byte[] includedBlockCoinbase = sibling.get(2).getRLPData();

    byte[] bytesPaidFees = sibling.get(3).getRLPData();
    byte[] bytesIncludedHeight = sibling.get(4).getRLPData();

    RLPElement uncleCountElement = sibling.get(5);
    byte[] bytesUncleCount = uncleCountElement != null? uncleCountElement.getRLPData():null;

    BigInteger paidFees = bytesPaidFees == null ? BigInteger.ZERO : BigIntegers.fromUnsignedByteArray(bytesPaidFees);
    long includedHeight = bytesIncludedHeight == null ? 0 : BigIntegers.fromUnsignedByteArray(bytesIncludedHeight).longValue();
    int uncleCount = bytesUncleCount == null ? 0 : BigIntegers.fromUnsignedByteArray(bytesUncleCount).intValue();

    return new Sibling(hash, coinbase, includedBlockCoinbase, paidFees, includedHeight, uncleCount);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:21,代码来源:Sibling.java

示例3: runCreate01Resource

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
@Test
public void runCreate01Resource() throws FileNotFoundException, DslProcessorException {
    DslParser parser = DslParser.fromResource("dsl/create01.txt");
    World world = new World();
    WorldDslProcessor processor = new WorldDslProcessor(world);
    processor.processCommands(parser);

    Transaction transaction = world.getTransactionByName("tx01");

    Assert.assertNotNull(transaction);

    TransactionInfo txinfo = world.getBlockChain().getTransactionInfo(transaction.getHash());

    Assert.assertNotNull(txinfo);
    BigInteger gasUsed = BigIntegers.fromUnsignedByteArray(txinfo.getReceipt().getGasUsed());

    Assert.assertNotEquals(BigInteger.ZERO, gasUsed);
    // According to TestRPC and geth, the gas used is 0x010c2d
    Assert.assertEquals(BigIntegers.fromUnsignedByteArray(Hex.decode("010c2d")), gasUsed);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:21,代码来源:DslFilesTest.java

示例4: getRewardBalance

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getRewardBalance() {
    if (rewardBalance!= null) {
        return rewardBalance;
    }

    DataWord address = new DataWord(REWARD_BALANCE_KEY.getBytes(StandardCharsets.UTF_8));

    DataWord value = this.repository.getStorageValue(this.contractAddress.getBytes(), address);

    if (value == null) {
        return BigInteger.ZERO;
    }

    return BigIntegers.fromUnsignedByteArray(value.getData());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:16,代码来源:RemascStorageProvider.java

示例5: getBurnedBalance

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getBurnedBalance() {
    if (burnedBalance!= null) {
        return burnedBalance;
    }

    DataWord address = new DataWord(BURNED_BALANCE_KEY.getBytes(StandardCharsets.UTF_8));

    DataWord value = this.repository.getStorageValue(this.contractAddress.getBytes(), address);

    if (value == null) {
        return BigInteger.ZERO;
    }

    return BigIntegers.fromUnsignedByteArray(value.getData());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:16,代码来源:RemascStorageProvider.java

示例6: decodeBigInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public static BigInteger decodeBigInteger(byte[] data, int index) {
    RLPElementView info = RLPElementView.calculateFirstElementInfo(ByteBuffer.wrap(data, index, data.length - index));
    if (info.getType() == RLPElementType.NULL_ITEM) {
        return BigInteger.ZERO;
    }

    return BigIntegers.fromUnsignedByteArray(info.getOrCreateElement().getRLPData());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:9,代码来源:RLP.java

示例7: safeToBigInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
private static BigInteger safeToBigInteger(byte[] data) {
    return data == null ? BigInteger.ZERO : BigIntegers.fromUnsignedByteArray(data);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:BridgeSerializationUtils.java

示例8: getGasPriceAsInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getGasPriceAsInteger() {
    return (this.getGasPrice() == null) ? null : BigIntegers.fromUnsignedByteArray(this.getGasPrice());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:Transaction.java

示例9: getGasLimitAsInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getGasLimitAsInteger() {
    return (this.getGasLimit() == null) ? null : BigIntegers.fromUnsignedByteArray(this.getGasLimit());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:Transaction.java

示例10: getNonceAsInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getNonceAsInteger() {
    return (this.getNonce() == null) ? null : BigIntegers.fromUnsignedByteArray(this.getNonce());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:Transaction.java

示例11: getMinGasPriceAsInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
public BigInteger getMinGasPriceAsInteger() {
    return (this.getMinimumGasPrice() == null) ? null : BigIntegers.fromUnsignedByteArray(this.getMinimumGasPrice());
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:Block.java

示例12: parseBigInteger

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
private static BigInteger parseBigInteger(byte[] bytes) {
    return bytes == null ? BigInteger.ZERO : BigIntegers.fromUnsignedByteArray(bytes);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:4,代码来源:BlockHeader.java

示例13: parseLong

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
private long parseLong(byte[] nrBytes) {

        if (nrBytes == null) return 0;
        BigInteger b = BigIntegers.fromUnsignedByteArray(nrBytes);
        return b.longValueExact();
    }
 
开发者ID:rsksmart,项目名称:rskj,代码行数:7,代码来源:FreeBlockHeader.java

示例14: parseInt

import org.spongycastle.util.BigIntegers; //导入方法依赖的package包/类
private int parseInt(byte[] nrBytes) {

        if (nrBytes == null) return 0;
        BigInteger b = BigIntegers.fromUnsignedByteArray(nrBytes);
        return b.intValueExact();
    }
 
开发者ID:rsksmart,项目名称:rskj,代码行数:7,代码来源:FreeBlockHeader.java


注:本文中的org.spongycastle.util.BigIntegers.fromUnsignedByteArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。