LoginSignup
1
2

More than 3 years have passed since last update.

どーも、のぶこふです。
前回に引き続き、Cordaのチュートリアルを実施していきます。
セットアップ等は、お手数ですが前回を参照してください。

今回実施するチュートリアルは HelloWorld です。

チュートリアル通りに実施しても、うまくいかない所があったので、備忘録的に記事に残しておきます。
チュートリアル内で、諸々の説明がありますが、端折ります。

はじめに

前回と同じく、Macユーザを想定しています。
JavaとKotlinがありますが、今回はKotlinを使用していきます。

IDE(IntelliJ)は、特に使用しません。
一部ソースコードの修正があるので、その際に必要であれば、適宜使用してください。

CorDappテンプレート

▼適当にディレクトリを作成しておきます

Terminal=Directory-tsukutte-cd-suruyo
mkdir corda-sample-kotlin && cd corda-sample-kotlin

▼git cloneでテンプレートをダウンロードします

Terminal=git-clone-suruyo
git clone https://github.com/corda/cordapp-template-kotlin.git ; cd cordapp-template-kotlin

○使用(修正)するファイルは下記

Tsukau-File-Dayo
// 1. The state
contracts/src/main/kotlin/com/template/states/TemplateState.kt

// 2. The flow
workflows/src/main/kotlin/com/template/flows/Flows.kt

状態を書く

▼TemplateState.ktを修正します

TemplateState.kt
package com.template.states

import com.template.contracts.TemplateContract
import net.corda.core.contracts.BelongsToContract
import net.corda.core.contracts.ContractState
import net.corda.core.identity.AbstractParty

// 1:importを追加します:
import net.corda.core.identity.Party

// *********
// * State *
// *********
// 2:元の記述を削除(比較用に、ここではコメントアウト)します:
// @BelongsToContract(TemplateContract::class)
// data class TemplateState(val data: String, override val participants: List<AbstractParty> = listOf()) : ContractState

// 3:下記内容を追加します:
@BelongsToContract(TemplateContract::class)
data class IOUState(val value: Int,
               val lender: Party,
               val borrower: Party) : ContractState {
    override val participants get() = listOf(lender, borrower)
}

▼TemplateState.ktのファイル名をIOUState.ktに変更します

  • Flows.ktの記述内容に合わせるため
Terminal=File-mei-kaeruyo
mv contracts/src/main/kotlin/com/template/states/TemplateState.kt contracts/src/main/kotlin/com/template/states/IOUState.kt

フローを書く

▼Flows.ktを修正します

Flows.kt
package com.template.flows

import co.paralleluniverse.fibers.Suspendable
import net.corda.core.flows.*
import net.corda.core.utilities.ProgressTracker

// ★1:importを追加します:
import com.template.contracts.TemplateContract
import com.template.states.IOUState
// 1:importを追加します:
import net.corda.core.contracts.Command
import net.corda.core.identity.Party
import net.corda.core.transactions.TransactionBuilder

// *********
// * Flows *
// *********
// 2:元の記述を削除(比較用に、ここではコメントアウト)します:
// @InitiatingFlow
// @StartableByRPC
// class Initiator : FlowLogic<Unit>() {
//     override val progressTracker = ProgressTracker()
// 
//     @Suspendable
//     override fun call() {
//         // Initiator flow logic goes here.
//     }
// }

// 3:下記内容を追加します:
@InitiatingFlow
@StartableByRPC
class IOUFlow(val iouValue: Int,
              val otherParty: Party) : FlowLogic<Unit>() {

    /** The progress tracker provides checkpoints indicating the progress of the flow to observers. */
    override val progressTracker = ProgressTracker()

    /** The flow logic is encapsulated within the call() method. */
    @Suspendable
    override fun call() {
        // We retrieve the notary identity from the network map.
        val notary = serviceHub.networkMapCache.notaryIdentities[0]

        // We create the transaction components.
        val outputState = IOUState(iouValue, ourIdentity, otherParty)
        val command = Command(TemplateContract.Commands.Action(), ourIdentity.owningKey)

        // We create a transaction builder and add the components.
        val txBuilder = TransactionBuilder(notary = notary)
                .addOutputState(outputState, TemplateContract.ID)
                .addCommand(command)

        // We sign the transaction.
        val signedTx = serviceHub.signInitialTransaction(txBuilder)

        // Creating a session with the other party.
        val otherPartySession = initiateFlow(otherParty)

        // We finalise the transaction and then send it to the counterparty.
        subFlow(FinalityFlow(signedTx, otherPartySession))
    }
}

// 4:元の記述を削除(比較用に、ここではコメントアウト)します:
// @InitiatedBy(Initiator::class)
// class Responder(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
//    @Suspendable
//    override fun call() {
//        // Responder flow logic goes here.
//    }
// }

// 5:下記内容を追加します:
@InitiatedBy(IOUFlow::class)
class IOUFlowResponder(private val otherPartySession: FlowSession) : FlowLogic<Unit>() {
    @Suspendable
    override fun call() {
        subFlow(ReceiveFinalityFlow(otherPartySession))
    }
}
  • ★1のインポートは、チュートリアルには記載されていない

CorDappを実行する

▼デプロイする

Terminal=Deploy-sururyo
$ ./gradlew clean deployNodes

> Task :deployNodes
Running Cordform task
Deleting /corda-sample-kotlin/cordapp-template-kotlin/build/nodes
Bootstrapping local test network in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes
Generating node directory for PartyA
Generating node directory for Notary
Generating node directory for PartyB
Waiting for all nodes to generate their node-info files...
Distributing all node-info files to all nodes
Loading existing network parameters... none found
Gathering notary identities
Generating contract implementations whitelist
New NetworkParameters {
      minimumPlatformVersion=4
      notaries=[NotaryInfo(identity=O=Notary, L=London, C=GB, validating=false)]
      maxMessageSize=10485760
      maxTransactionSize=524288000
      whitelistedContractImplementations {

      }
      eventHorizon=PT720H
      packageOwnership {

      }
      modifiedTime=2019-05-13T02:46:20.268Z
      epoch=1
  }
Bootstrapping complete!

BUILD SUCCESSFUL in 32s
18 actionable tasks: 17 executed, 1 up-to-date
  • チュートリアルでは「Build.gradle」を修正させようとしていますが、修正は不要です

    • corda-finance-contractsの4系が無いとエラーが出る
    • PartyA Nodeのダブルクオーテーション漏れ(rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL]]]
  • デプロイ実行後、build/nodes下にノードが構築されます

build/nodes
.
|____corda.jar                     // The runnable node
|____corda-webserver.jar           // The node's webserver (The notary doesn't need a web server)
|____node.conf                     // The node's configuration file
|____cordapps
|____java/kotlin-source-0.1.jar  // Our IOU CorDapp

▼ノードを実行する

Terminal=Node-wo-kidou-suruyo
$ build/nodes/runnodes

Starting nodes in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes
Starting corda.jar in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/Notary on debug port 5005
Node will expose jolokia monitoring port on 7005
Running command: osascript -e tell app "Terminal"
    activate
    delay 0.5
    tell app "System Events" to tell process "Terminal" to keystroke "t" using command down
    delay 0.5
    do script "bash -c 'cd \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/Notary\" ; \"/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java\" \"-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter\" \"-Dname=Notary\" \"-jar\" \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/Notary/corda.jar\" && exit'" in selected tab of the front window
end tell
Starting corda.jar in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA on debug port 5006
Node will expose jolokia monitoring port on 7006
Running command: osascript -e tell app "Terminal"
    activate
    delay 0.5
    tell app "System Events" to tell process "Terminal" to keystroke "t" using command down
    delay 0.5
    do script "bash -c 'cd \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA\" ; \"/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java\" \"-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7006,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter\" \"-Dname=PartyA\" \"-jar\" \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA/corda.jar\" && exit'" in selected tab of the front window
end tell
No file corda.jar found in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/.cache
Starting corda.jar in /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB on debug port 5007
Node will expose jolokia monitoring port on 7007
Running command: osascript -e tell app "Terminal"
    activate
    delay 0.5
    tell app "System Events" to tell process "Terminal" to keystroke "t" using command down
    delay 0.5
    do script "bash -c 'cd \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB\" ; \"/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java\" \"-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7007,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter\" \"-Dname=PartyB\" \"-jar\" \"/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB/corda.jar\" && exit'" in selected tab of the front window
end tell
Started 3 processes
Finished starting nodes
  • Terminalで新規タブが3つ開くので、落ち着くまで待機する
    • Notary
    • PartyA
    • PartyB

○イメージ

Terminal(Notary)
Last login: Mon May 13 11:46:30 on ttys004
bash -c 'cd "/Users/gfamlab/mydev/corda-kotlin/cordapp-template-kotlin/build/nodes/Notary" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=Notary" "-jar" "/Users/gfamlab/mydev/corda-kotlin/cordapp-template-kotlin/build/nodes/Notary/corda.jar" && exit'
GfamnoMacBook-puro:cordapp-template-kotlin gfamlab$ bash -c 'cd "/Users/gfamlab/mydev/corda-kotlin/cordapp-template-kotlin/build/nodes/Notary" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=Notary" "-jar" "/Users/gfamlab/mydev/corda-kotlin/cordapp-template-kotlin/build/nodes/Notary/corda.jar" && exit'
Listening for transport dt_socket at address: 5005
Jolokia: Agent started with URL http://127.0.0.1:7005/jolokia/

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         Don't trust atoms.
/ /___  /_/ / /  / /_/ / /_/ /          They make up everything.
\____/     /_/   \__,_/\__,_/

--- Corda Open Source 4.0 (503a2ff) -------------------------------------------------------------


Logs can be found in                    : /Users/gfamlab/mydev/corda-kotlin/cordapp-template-kotlin/build/nodes/Notary/logs
⚠️   ATTENTION: This node is running in development mode! 👩‍💻   This is not safe for production deployment.
Advertised P2P messaging addresses      : localhost:10002
RPC connection address                  : localhost:10003
RPC admin connection address            : localhost:10043
Loaded 2 CorDapp(s)                     : Contract CorDapp: Template CorDapp version 1 by vendor Corda Open Source with licence Apache License, Version 2.0, Workflow CorDapp: Template Flows version 1 by vendor Corda Open Source with licence Apache License, Version 2.0
Node for "Notary" started up and registered in 24.38 sec


Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to shut down the node.

Mon May 13 14:25:08 JST 2019>>> 
Terminal(PartyA)
Last login: Mon May 13 14:24:40 on ttys002
bash -c 'cd "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7006,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=PartyA" "-jar" "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA/corda.jar" && exit'
GfamnoMacBook-puro:cordapp-template-kotlin gfamlab$ bash -c 'cd "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7006,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=PartyA" "-jar" "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA/corda.jar" && exit'
Listening for transport dt_socket at address: 5006
Jolokia: Agent started with URL http://127.0.0.1:7006/jolokia/

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         Old bankers never die, they
/ /___  /_/ / /  / /_/ / /_/ /          just... pass the buck
\____/     /_/   \__,_/\__,_/

--- Corda Open Source 4.0 (503a2ff) -------------------------------------------------------------


Logs can be found in                    : /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyA/logs
⚠️   ATTENTION: This node is running in development mode! 👩‍💻   This is not safe for production deployment.
Advertised P2P messaging addresses      : localhost:10005
RPC connection address                  : localhost:10006
RPC admin connection address            : localhost:10046
Loaded 2 CorDapp(s)                     : Contract CorDapp: Template CorDapp version 1 by vendor Corda Open Source with licence Apache License, Version 2.0, Workflow CorDapp: Template Flows version 1 by vendor Corda Open Source with licence Apache License, Version 2.0
Node for "PartyA" started up and registered in 25.05 sec


Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to shut down the node.

Mon May 13 14:25:10 JST 2019>>> 
Terminal(PartyB)
Last login: Mon May 13 14:24:41 on ttys003
bash -c 'cd "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7007,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=PartyB" "-jar" "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB/corda.jar" && exit'
GfamnoMacBook-puro:cordapp-template-kotlin gfamlab$ bash -c 'cd "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB" ; "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre/bin/java" "-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7007,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" "-Dname=PartyB" "-jar" "/corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB/corda.jar" && exit'
Listening for transport dt_socket at address: 5007
Jolokia: Agent started with URL http://127.0.0.1:7007/jolokia/

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         Always borrow money from a pessimist.
/ /___  /_/ / /  / /_/ / /_/ /          He won't expect it back.
\____/     /_/   \__,_/\__,_/

--- Corda Open Source 4.0 (503a2ff) -------------------------------------------------------------


Logs can be found in                    : /corda-sample-kotlin/cordapp-template-kotlin/build/nodes/PartyB/logs
⚠️   ATTENTION: This node is running in development mode! 👩‍💻   This is not safe for production deployment.
Advertised P2P messaging addresses      : localhost:10008
RPC connection address                  : localhost:10009
RPC admin connection address            : localhost:10049
Loaded 2 CorDapp(s)                     : Contract CorDapp: Template CorDapp version 1 by vendor Corda Open Source with licence Apache License, Version 2.0, Workflow CorDapp: Template Flows version 1 by vendor Corda Open Source with licence Apache License, Version 2.0
Node for "PartyB" started up and registered in 23.69 sec


Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to shut down the node.

Mon May 13 14:25:11 JST 2019>>> 
  • 「⚠️ ATTENTION: This node is running in development mode! 👩‍💻 This is not safe for production deployment.」というメッセージが出てるけど、気にしない。わかちこ。

▼ノードと対話する
PartyAのタブで実行

▼ノードの確認

Terminal(PartyA)
>>> run networkMapSnapshot 
- addresses:
  - "localhost:10005"
  legalIdentitiesAndCerts:
  - "O=PartyA, L=London, C=GB"
  platformVersion: 4
  serial: 1557715578156
- addresses:
  - "localhost:10002"
  legalIdentitiesAndCerts:
  - "O=Notary, L=London, C=GB"
  platformVersion: 4
  serial: 1557715576086
- addresses:
  - "localhost:10008"
  legalIdentitiesAndCerts:
  - "O=PartyB, L=New York, C=US"
  platformVersion: 4
  serial: 1557715577977


>>> 

▼IOU作成(PartyBへ、IOUを99送る)

Terminal(PartyA)
>>> start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"

 ✅   Starting
          Requesting signature by notary service
              Requesting signature by Notary service
              Validating response from Notary service
     ✅   Broadcasting transaction to participants
➡️   Done
Flow completed with result: kotlin.Unit

>>>

○PartyBで上記コマンドを実行するとエラーになります。

Terminal(PartyB)
>>> start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}

➡️   Starting
    Done
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}
[ERROR] 15:23:16+0900 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=1s5uan7, moreInformationAt=https://errors.corda.net/OS/4.0/1s5uan7] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=542f674f-47d7-4bcb-871b-d0f7e41708a1, invocation_id=d4b2c473-f303-4e9a-ad57-de1dd8bd55ca, invocation_timestamp=2019-05-13T06:23:16.256Z, origin=internalShell, session_id=baf70cb2-9ef5-4de4-ad69-cd214501997d, session_timestamp=2019-05-13T06:23:16.008Z, thread-id=152}

➡️   Starting
🚫   Done
 ☠   Do not provide flow sessions for the local node. FinalityFlow will record the notarised transaction locally.

>>> 

○PartyBからAへ送るには、下記の通り

Terminal(PartyB)
>>> start IOUFlow iouValue: 10, otherParty: "O=PartyA,L=London,C=GB" 

▼IOU確認

Terminal(PartyA)
>>> run vaultQuery contractStateType: com.template.states.IOUState
states:
- state:
    data: !<com.template.states.IOUState>
      value: 99
      lender: "O=PartyA, L=London, C=GB"
      borrower: "O=PartyB, L=New York, C=US"
    contract: "com.template.contracts.TemplateContract"
    notary: "O=Notary, L=London, C=GB"
    encumbrance: null
    constraint: !<net.corda.core.contracts.SignatureAttachmentConstraint>
      key: "aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTEw3G5d2maAq8vtLE4kZHgCs5jcB1N31cx1hpsLeqG2ngSysVHqcXhbNts6SkRWDaV7xNcr6MtcbufGUchxredBb6"
  ref:
    txhash: "6CE2C770D657479DAD4B1B89A98BC3C4938D1C5B24FA04DE63516D2D939EF6AA"
    index: 0
statesMetadata:
- ref:
    txhash: "6CE2C770D657479DAD4B1B89A98BC3C4938D1C5B24FA04DE63516D2D939EF6AA"
    index: 0
  contractStateClassName: "com.template.states.IOUState"
  recordedTime: "2019-05-13T06:08:11.834Z"
  consumedTime: null
  status: "UNCONSUMED"
  notary: "O=Notary, L=London, C=GB"
  lockId: null
  lockUpdateTime: null
  relevancyStatus: "RELEVANT"
  constraintInfo:
    constraint:
      key: "aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTEw3G5d2maAq8vtLE4kZHgCs5jcB1N31cx1hpsLeqG2ngSysVHqcXhbNts6SkRWDaV7xNcr6MtcbufGUchxredBb6"
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []


>>> 
  • PartyAーB間でのIOUStateをブロックチェーンに発行する取引です。
  • チュートリアルでは「run vaultQuery contractStateType: com.template.IOUState」となっていますが「run vaultQuery contractStateType: com.template.states.IOUState」とする必要があります。
    • パスがちょっと足りない
Terminal(Notary)
>>> run vaultQuery contractStateType: com.template.states.IOUState
states: []
statesMetadata: []
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []


>>> 
  • PartyA、Bどちらで実行しても、同じ内容が表示されますが、取引に関係していないノード(Notary)で実行すると、上記の様になります。
    • Notaryは、取引に関係なく、データの閲覧の必要もないので、このような結果になる

以上で、チュートリアル(Hello World)が終了となります。

おわりに

内容としては前回とあまり大差はありませんが、ソースコードをいじるだけで、なんとなく「やってやったぜ」感があります(私だけ?)。

こんな感じで、引き続きCordaチュートリアルを続けていこうと思います。

以上です。
ありがとうございました。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2