Search in sources :

Example 1 with LedgerInitAttributes

use of com.jd.blockchain.sdk.LedgerInitAttributes in project jdchain-core by blockchain-jd-com.

the class GatewayQueryServiceHandler method initLedgerBaseSettings.

/**
 * 初始化账本的基本配置
 *
 * @param ledgerAdminInfo 账本信息
 *
 * @return
 */
private LedgerInitAttributes initLedgerBaseSettings(LedgerAdminInfo ledgerAdminInfo) {
    LedgerMetadata_V2 ledgerMetadata = ledgerAdminInfo.getMetadata();
    LedgerInitAttributes ledgerBaseSettings = new LedgerInitAttributes();
    // 设置参与方
    ledgerBaseSettings.setParticipantNodes(ledgerAdminInfo.getParticipants());
    // 设置共识设置
    ledgerBaseSettings.setConsensusSettings(initConsensusSettings(ledgerAdminInfo));
    // 设置参与方根Hash
    ledgerBaseSettings.setParticipantsHash(ledgerMetadata.getParticipantsHash());
    // 设置算法配置
    ledgerBaseSettings.setCryptoSetting(ledgerAdminInfo.getSettings().getCryptoSetting());
    // 设置种子
    ledgerBaseSettings.setSeed(initSeed(ledgerMetadata.getSeed()));
    // 设置共识协议
    ledgerBaseSettings.setConsensusProtocol(ledgerAdminInfo.getSettings().getConsensusProvider());
    // 设置账本结构版本号
    ledgerBaseSettings.setLedgerStructureVersion(ledgerMetadata.getLedgerStructureVersion());
    // 设置什么认证模式
    ledgerBaseSettings.setIdentityMode(ledgerMetadata.getIdentityMode());
    // 设置账本证书
    ledgerBaseSettings.setLedgerCertificates(ledgerMetadata.getLedgerCertificates());
    // 设置创世用户
    ledgerBaseSettings.setGenesisUsers(ledgerMetadata.getGenesisUsers());
    // 设置合约运行时配置
    ledgerBaseSettings.setContractRuntimeConfig(ledgerMetadata.getContractRuntimeConfig());
    return ledgerBaseSettings;
}
Also used : LedgerInitAttributes(com.jd.blockchain.sdk.LedgerInitAttributes) LedgerMetadata_V2(com.jd.blockchain.ledger.LedgerMetadata_V2)

Aggregations

LedgerMetadata_V2 (com.jd.blockchain.ledger.LedgerMetadata_V2)1 LedgerInitAttributes (com.jd.blockchain.sdk.LedgerInitAttributes)1