如何在Corda中手动生成网络参数

3
我已经手动创建并分发了Corda节点所需的证书。现在,为了让节点启动,它们需要拥有网络参数等内容。问题是,如果我使用Corda网络启动工具生成网络参数,该文件将由另一个颁发机构签名(“C = UK,L = London,OU = corda,O = R3,CN = Corda Node Root CA”),这与我的证书颁发机构不同。我的问题是,如何手动创建网络参数,以便我可以指定正确的颁发机构,避免节点启动期间的冲突?

enter image description here

2个回答

3

我已经想到了创建网络参数的方法:

private fun getSignedNetworkParameters(): NetworkParameters {

        //load the notary from a Keystore. This avoids having to start a flow from a node in order to retrieve NotaryInfo
        val notary = loadKeyStore("\\path-to-keystore\\keystore.jks", "keystore-password")

        val certificateAndKeyPair : CertificateAndKeyPair = notary.getCertificateAndKeyPair("entry-alias", "entry-password")
        val notaryParty = Party(certificateAndKeyPair.certificate)
        val notaryInfo = listOf(NotaryInfo(notaryParty, false))

        //map contract ID to the SHA-256 hash of its CorDapp contracts&states JAR file
        val whitelistedContractImplementations = mapOf(
                TestContract.TEST_CONTRACT_ID to listOf(getCheckSum(contractFile))
        )

        return NetworkParameters(minimumPlatformVersion = 3, notaries = notaryInfo,
                maxMessageSize = n, maxTransactionSize = n, modifiedTime = Instant.now(),
                epoch = 1, whitelistedContractImplementations = whitelistedContractImplementations)
    }

2

两个链接现在都是404错误。 - max taldykin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接