我研究了corda-settler
项目并参与其中。按照文档中的建议,我创建了一个自定义ethereum
模块(其轮廓类似于ripple
模块),提供了使用ETH
中的分类帐付款来清算债务的选项。实施(https://github.com/vladichhh/corda-settler)
由以下重要部分组成:
flows
MakeEthPayment
services
ETHClient
ETHService
types
EthPayment
EthSettlement
token
registered DigitalCurrency for ETH
oracle
added logic for ETH payment verification
MakeEthPayment.kt
@Suspendable
override fun makePayment(obligation: Obligation<*>, amount: Amount<T>): EthPayment<T> {
// get ETHService client
val ethClient = serviceHub.cordaService(ETHService::class.java).client
val recipient = obligation.settlementMethod?.accountToPay.toString()
val amountToSend = amount.quantity.toString()
// trigger ETH transfer
val txHash = ethClient.sendEth(recipient, amountToSend)
// return the payment
return EthPayment(txHash, amount, PaymentStatus.SENT)
}
ETHClient.kt
fun sendEth(recipient: String, amount: String): String {
val weiAmount: BigInteger = Convert.toWei(amount, Convert.Unit.GWEI).toBigInteger()
val credentials: Credentials = WalletUtils.loadCredentials(walletPassword, walletFile)
val transactionReceipt: TransactionReceipt = Transfer
.sendFunds(web3j, credentials, recipient, BigDecimal(weiAmount), Convert.Unit.WEI)
.send()
return transactionReceipt.transactionHash
}
为了将所需的ETH金额发送到指定的接收者帐户,我们必须做一些以太坊特定的工作:
这里是问题:
corda-settler/ethereum/src/main/resources/file.tmp
corda-settler/cordapp/src/main/resources/file.tmp
/Users/vladimirhristov/WebstormProjects/Corda/corda-settler/cordapp/src/main/resources/file.tmp
似乎已找到该文件,但又出现另一个异常:
java.lang.OutOfMemoryError - screenshot
似乎钱包解密操作非常耗时,可能会中断流程。有一个选项可以降低钱包生成的算法复杂度,这将反映出在下一步解密同一钱包所需的资源较少,但这也会降低安全性。
这是我的三个基本问题...
文件内容(包含加密的发件人的钱包):
file.tmp
{"version":3,"id":"ecb51768-8564-498a-bb11-3a5a5c8dc0bb","address":"2bafc482bd227dfd5ba250521a00be3a4cc88bbd","crypto":{"ciphertext":"e0511415792dfa7221ba1b8f32b8ec98e1410f45e612e2100df1aceddfdb22bd","cipherparams":{"iv":"7ffa2af08f502c63d57e62440ad77539"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"8051a5df1c02eb3eba81d2920fbb84b76b948a1248bbba62ffff684e733948cf","n":131072,"r":8,"p":1},"mac":"be23fe0e261ba38892581d80afd0c86563748377b5cc702b6ed3285a13cceff6"}}
我将不胜感激!在此先感谢:)
答案 0 :(得分:0)
非常奇怪,Corda在运行该流时给您一个内存不足的错误。
我实际上要说的是,我们需要能够看到流的代码,以便知道它可能会耗尽内存。
您是否在容器中运行它?只需确保您满足运行顶部带有应用程序的JVM的要求即可。
tl; dr使用8GB RAM计算机在最新版本的corda上运行您的Corda节点,希望可以解决此问题。
这是有关内存需求的文档页面; https://docs.corda.net/docs/corda-enterprise/4.5/node/performance-results.html#sizing