Skip to main content

Keys

Cryptographic keys control all transactions in a Sequence ledger. When creating a flavor or account, you can specify one or more keys that must sign transactions before submitting to the ledger. To issue tokens of a flavor, the transaction must be signed with the correct flavor key(s). To transfer or retire tokens from an account, the transaction must be signed with the correct account key(s).

The simplest configuration is to use a single key to create all accounts and flavors. This allows one system to control the entire ledger. However, if you have different systems responsible for different operations, you may want to create more than one key. For example, the system that issues tokens into accounts in response to external deposits may be different from the system that transfers tokens between accounts. In this case, you may want to create all the flavors from one key (controlled by the first system) and all the accounts from another key (controlled by the second system).

Data Structure

Field Descriptions

FieldTypeDescription
idstringUser-supplied or system-generated unique identifier of the key.

Example Object

{
id: "...",
}

Examples

Create a key

Key key = new Key.Builder()
.setId("myKey")
.create(ledger);

Query Keys

You can retrieve keys that are managed by the ledger using a query. Results are sorted in descending order of creation time.

Key.ItemIterable keys = new Key.ListBuilder().getIterable(ledger);
for (Key key : keys) {
System.out.println("key: " + key.id);
}