corda - 如何正确运行 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 的新手。有人可以帮我解决这个问题吗?非常感谢。
解决方案
如果您没有在屏幕上看到任何内容,则流程没有完成。
检查节点的日志(内部build/nodes/PartyA/logs
)。
您还可以在调试模式下启动节点 ( https://docs.corda.net/node-commandline.html#enabling-remote-debugging ) 并在代码上放置断点以查看失败的位置。
推荐阅读
- c# - ASP .NET 在表单请求后错误地将十进制数转换为数百
- android - 为 android sdk 30 读取存储卡上的自定义文件
- firebase - 如何使用生产存储桶数据启动 Firebase 存储模拟器?
- python-3.x - 通过 python3 计算 uniswap 3.0 池(对)地址
- java - Kotlin - 如何根据条件返回对象
- kotlin - 什么时候是块,什么时候是 lambda?
- json - 从 json 列表中选择具有最高内部版本号的“名称”
- python - networkx.graw_planar() 永远不会完成
- c++ - 使用点 (x,y) 值功能对向量进行排序,错误:没有匹配函数调用类型为“__gnu_cxx::__ops::_Iter_less_iter”的对象
- reactjs - 未处理的拒绝(TypeError):无法在字符串“消息”上创建属性“类名”