BuildContextsKeystore Context

Keystore Context

SDK source (GitHub): https://github.com/tangle-network/blueprint/tree/main/crates/contexts

The KeystoreContext trait lets your Blueprint create, store, and sign with cryptographic keys (ECDSA, SR25519, ED25519, BN254_BLS, BLS381).

Key operations

The KeystoreContext trait provides access to a Keystore that implements the Backend trait, offering:

  • Key Creation - Generate new keys of various types (ECDSA, SR25519, ED25519, BN254_BLS, BLS381)
  • Key Storage - Securely store and retrieve keys
  • Key Management - Read, modify, and delete stored keys
  • Signing - Sign messages using stored keys
  • Key Import/Export - Import existing keys and export key data

Using the Context

1. Define Your Context

First, define your context struct that implements the KeystoreContext trait:

2. Access Keystore Functionality

You can then use this context to access the keystore and perform key operations: