Exercises below are to demonstrate the functionality of the Corda Accounts package
Pre-Requisites
See https://docs.corda.net/getting-set-up.html.
Materials
All slide decks and Corda Design Language (CDL) diagrams can be found in the resources
folder
Usage
Running the nodes
See https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp.
Interacting with the nodes
Shell Commands for Transacting between Accounts
Accounts functionality is implemented at the Node level through an Accounts CorDapp.
####Creating accounts on a node We can create accounts by executing a flow. Goto PartyA's shell and create an account for 'Bob'
start CreateAccount name: "PartyA - Bob"
Create another account on PartyB's shell
start CreateAccount name: "PartyB - Alice"
Checking accounts on a node
We can see what accounts are on a node with the flow OurAccounts. Execute this on PartyA to see 'Bob' and on PartyB to see 'Alice'
start OurAccounts
Share an account on our node with another party
From PartyB
start ShareAccountToParty acctName: PartyB - Alice, shareTo: PartyA
Self Issue our AssetForAccountState
From PartyA
start AssetForAccountStateSelfIssueFlow acctName: PartyA - Bob, name: "diamond", value: 100
Transfer our Issued state from our Account to an Account on another Node
From PartyA
Do a vaultQuery to get the transaction hash and index of the AssetForAccountState
run vaultQuery contractStateType: AssetForAccountState
Then run the same query from PartyB - notice the vault is empty.
Go back to PartyA
Copy the transaction hash from your query and use as an argument for the transfer flow
start NodeAccountToNodeAccount senderName: PartyA - Bob, receiverName: PartyB - Alice, hash: <txhash>, index: 0
run the vaultQueries again and see that the asset has changed hands, the owner key now maps to PartyB - Alice account.
run vaultQuery contractStateType: AssetForAccountState