【问题标题】:How to manually generate network parameters in Corda如何在 Corda 中手动生成网络参数
【发布时间】:2020-04-10 16:34:04
【问题描述】:

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

【问题讨论】:

    标签: x509certificate corda


    【解决方案1】:

    所以我想出了一种创建网络参数的方法:

    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】:

      您可以使用网络引导程序使用的开发证书签署您的证书:https://github.com/corda/corda/tree/master/node-api/src/main/resources/certificates

      如果这对您不起作用,您可以试试这个实验性工具:https://github.com/corda/corda/blob/master/experimental/netparams/src/main/kotlin/net.corda.netparams/NetParams.kt。不过,我不能保证它适用于 Corda 3.3。

      【讨论】:

      • 两个链接现在都是 404
      猜你喜欢
      • 2019-05-06
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      • 2017-02-02
      • 2019-02-17
      • 2019-02-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多