首页 > 解决方案 > 如何正确运行 corda kotlin 示例

问题描述

问题:

我正在尝试 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 的新手。有人可以帮我解决这个问题吗?非常感谢。

标签: corda

解决方案


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


推荐阅读