Occasionally, we look to take some of the feedback we get most often and see if we can provide tips to help developers with everyday issues. This week, we had a couple of questions from developers who wanted clarification on the Accounts SDK.
We get these kinds of questions all the time, so I’ll summarize some of the most common questions.
What exactly is an account?
An excellent place to start is to get a conceptual understanding of what accounts are so that you can make informed decisions about them.
At the literal level, an account is a collection of `PublicKey` objects assigned to the same “ID.” These `PublicKey`s can then participate in `ContractStates`, and other Corda mechanisms like a typical node would have previously.
These accounts can perform transactions within and on behalf of their host. When they perform transactions, there is a logical separation within the vault of the host Corda node.
The consequence of this innovation is that now multiple parties can be represented without requiring multiple Corda nodes. Accounts can be a huge opportunity to save on the cost of hosting nodes and enable intra-node transactions to be much faster.
To be clear, however, there are limitations to this, as we’ll explain below.
How is an account managed on a Corda node?
We tend to describe this in terms of departments submitting expenses at a company.
For example, if you run a Corda node for a large enterprise company and you have multiple departments, each of them could have their own separate Corda accounts.
If the finance department runs an account, they might have a process for running transactions between the different Corda accounts representing the other departments to process expense reports.
Can Corda nodes see the transactions of accounts on that node?
A Corda node operator can see the transactions performed by the accounts on that node.
The previous example shows that data from those expense reports between hosted accounts are available to the parent node operator.
How do I determine what each account should do?
This is an application-level question. An account is giving you the ability to create separate keys and provide them with a name. How you use that name is up to you.
You can create an account at any time. It’s as easy as this:
Once you’ve created your accounts, it’s up to your application to handle this. Then you can use it for signing transactions. A prime example of using an account would be the SubmitTurnFlow from TicTacThor.
Where can I read more about this?
Here are some resources on the accounts SDK that can hopefully help clear up these concepts:
- The readme and code from the open-source Corda repository (note that the bottom of this page has some good CorDapp examples as well).
- The Corda developer training section on accounts.
- Our developer samples on accounts in Java and Kotlin.
If you’d like to see more blog posts like these or have ideas on what we should add, feel free to send a note to firstname.lastname@example.org.
Want to learn more about building awesome blockchain applications on Corda? Be sure to visit corda.net, check out our community page to learn how to connect with other Corda developers, and sign up for one of our newsletters for the latest updates.
— David Awad is a Developer Evangelist at R3, an enterprise blockchain software firm working with a global ecosystem of more than 350 participants across multiple industries from both the private and public sectors to develop on Corda, its open-source blockchain platform, and Corda Enterprise, a commercial version of Corda for enterprise usage.
Follow David on Twitter here.