【问题标题】:How to run corda kotlin example correctly如何正确运行 corda kotlin 示例
【发布时间】:2020-01-22 21:39:24
【问题描述】:

问题:

我正在尝试 Corda 官方文档 hello word 应用程序。部署 CorDapp 后,我发布了

start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"

这个命令在甲方上。之后我尝试通过在甲方和乙方上发出这个命令来检查账本状态。

run vaultQuery contractStateType: com.template.states.IOUState

但它给出的输出与这样的公证人相同。

states: []
statesMetadata: []
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []

但输出应该是这样的。

states:
- state:
    data:
      value: 99
      lender: "C=GB,L=London,O=PartyA"
      borrower: "C=US,L=New York,O=PartyB"
      participants:
      - "C=GB,L=London,O=PartyA"
      - "C=US,L=New York,O=PartyB"
    contract: "com.template.contract.IOUContract"
    notary: "C=GB,L=London,O=Notary"
    encumbrance: null
    constraint:
      attachmentId: "F578320232CAB87BB1E919F3E5DB9D81B7346F9D7EA6D9155DC0F7BA8E472552"
  ref:
    txhash: "5CED068E790A347B0DD1C6BB5B2B463406807F95E080037208627565E6A2103B"
    index: 0
statesMetadata:
- ref:
    txhash: "5CED068E790A347B0DD1C6BB5B2B463406807F95E080037208627565E6A2103B"
    index: 0
  contractStateClassName: "com.template.state.IOUState"
  recordedTime: 1506415268.875000000
  consumedTime: null
  status: "UNCONSUMED"
  notary: "C=GB,L=London,O=Notary"
  lockId: null
  lockUpdateTime: 1506415269.548000000
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []

这是我的 build.gradle 任务 deployNodes。

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    nodeDefaults {
        projectCordapp {
            deploy = true
        }
        cordapp project(':contracts')
        cordapp project(':workflows')
    }
    directory "./build/nodes"
    node {
        name "O=Notary,L=London,C=GB"
        notary = [validating : true]
        p2pPort 10002
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10043")
        }
    }
    node {
        name "O=PartyA,L=London,C=GB"
        p2pPort 10005
        rpcSettings {
            address("localhost:10006")
            adminAddress("localhost:10046")
        }
        rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
    }
    node {
        name "O=PartyB,L=New York,C=US"
        p2pPort 10008
        rpcSettings {
            address("localhost:10009")
            adminAddress("localhost:10049")
        }
        rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
    }

}

我在互联网上尝试了很多方法来解决这个问题,但我无法做到,因为我是 Corda 的新手。有人可以帮我解决这个问题吗?非常感谢。

【问题讨论】:

  • 运行流程时,它是否成功完成?你在屏幕上看到返回的交易哈希了吗? 3 个节点(PartyA、PartyB 和 Notary)都启动了吗?
  • @AdelRustum 启动流程后屏幕上什么也没有。是的,所有三个服务器终端都在运行。
  • 如果您没有在屏幕上看到任何内容,则流程没有完成。检查节点的日志(在build/nodes/PartyA/logs 内)。您还可以在调试模式下启动节点 (docs.corda.net/node-commandline.html#enabling-remote-debugging) 并在代码上放置断点以查看失败的位置。
  • @AdelRustum 非常感谢。检查后我在日志上收到错误。解决了这个问题后,我的问题就解决了。
  • 好的,我将添加我的评论作为答案;请接受它以将问题标记为已回答。

标签: corda


【解决方案1】:

如果您没有在屏幕上看到任何内容,则说明流程没有完成。
检查节点的日志(在build/nodes/PartyA/logs 内)。
您还可以在调试模式 (https://docs.corda.net/node-commandline.html#enabling-remote-debugging) 下启动节点并在代码上放置断点以查看失败的位置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-13
    相关资源
    最近更新 更多