@proto-kit/sequencer • Docs
Documentation / @proto-kit/sequencer / InMemoryMinaSigner
Class: InMemoryMinaSigner
In-memory implementation of the MinaSigner interface. Stores private keys in memory and provides cryptographic signing operations for the Mina blockchain protocol. This implementation is suitable for server-side sequencer operations where keys can be securely stored in memory.
Extends
Implements
Constructors
new InMemoryMinaSigner()
new InMemoryMinaSigner():
InMemoryMinaSigner
Returns
Overrides
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:132
Properties
currentConfig
protectedcurrentConfig:undefined|InMemorySignerConfig
Store the config separately, so that we can apply additional checks when retrieving it via the getter
Inherited from
Defined in
packages/common/dist/config/ConfigurableModule.d.ts:17
presets
staticpresets:Presets<unknown> ={}
Inherited from
Defined in
packages/sequencer/src/sequencer/builder/SequencerModule.ts:20
Accessors
config
Get Signature
get config():
Config
Returns
Config
Set Signature
set config(
config):void
Parameters
• config: Config
Returns
void
Inherited from
Defined in
packages/common/dist/config/ConfigurableModule.d.ts:18
Methods
create()
create(
childContainerProvider):void
Parameters
• childContainerProvider: ChildContainerProvider
Returns
void
Inherited from
Defined in
packages/common/dist/config/ConfigurableModule.d.ts:20
getContractAddresses()
getContractAddresses():
PublicKey[]
Retrieves public keys for all managed smart contracts.
Expected key order:
- Index 0: Settlement contract public key
- Index 1: Dispatch contract public key
- Index 2: Mina bridge contract public key
The order corresponds to the order of private keys in the configuration.
Returns
PublicKey[]
Returns Array
of PublicKeys derived from configured contract private keys.
Implementation of
MinaSigner.getContractAddresses
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:192
getFeepayerKey()
getFeepayerKey():
PublicKey
Retrieves the public key of the feepayer account. The feepayer is responsible for paying transaction fees on the Mina blockchain.
Returns
PublicKey
The public key derived from the configured feepayer private key.
Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:163
getTokenAddresses()
getTokenAddresses():
PublicKey[]
Retrieves all configured token bridge public keys.
PublicKey[] Array of public keys for all configured token bridge contracts. Returns empty array if no token bridge keys are configured.
Returns
PublicKey[]
Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:173
registerKey()
registerKey(
privateKey):PublicKey
Registers a new private key in the signer’s key management system. If the key already exists, returns the existing public key without modification. This method is idempotent - calling it multiple times with the same key is safe.
Parameters
• privateKey: PrivateKey
The PrivateKey to register for future signing operations.
Returns
PublicKey
The public key corresponding to the registered private key.
Example
const newKey = PrivateKey.random();
const publicKey = signer.registerKey(newKey);
// Now this key can be used for signing operations.Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:256
sign()
sign(
signatureData):Signature
Signs arbitrary data using the feepayer’s private key. This is useful for creating signatures or signing custom protocol messages.
Parameters
• signatureData: Field[]
Array of Field elements to be signed. Field is the base type for Mina’s cryptographic operations.
Returns
Signature
Cryptographic Signature created using the feepayer’s private key.
Example
const message = [Field(123), Field(456)];
const signature = signer.sign(message);Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:212
signTx()
signTx(
tx,options):Transaction<false,true>
Signs a Mina transaction with multiple private keys. Always signs with the feepayer key, optionally with additional keys specified in the options. This is required for transactions that need authorization from multiple parties (e.g., contract deployments in our case)
Parameters
• tx: Transaction<false, false>
The unsigned Transaction< false, false> object to be signed. Must be of type Transaction<false, false> (unsigned).
• options: SignTxOptions = {}
Optional SignTxOptions configuration containing: - pubKeys: Array of public keys whose private keys should sign the transaction. Each public key must be registered in the keyMap.
Returns
Transaction<false, true>
The signed Transaction<false, true> ready for network submission.
Throws
An Error If any required private key is not found in the key registry.
Example
const unsignedTx = await Mina.transaction(sender, () => {
// transaction logic
});
// Sign with feepayer only
const signedTx1 = signer.signTx(unsignedTx);
// Sign with feepayer and additional keys
const contractKeys = signer.getContractAddresses();
const signedTx2 = signer.signTx(unsignedTx, {
pubKeys: [contractKeys[0], contractKeys[1]]
});Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:301
signWithKey()
signWithKey(
publicKey,signatureData):Signature
Signs arbitrary data using a specific registered private key. Enables signing with contract or bridge keys rather than the feepayer key.
Parameters
• publicKey: PublicKey
The PublicKey identifying which private key to use for signing. This public key must have been previously registered in the keyMap.
• signatureData: Field[]
Array of Field elements representing the data to be signed.
Returns
Signature
Cryptographic Signature created with the specified private key.
Throws
An Error if no private key is found for the provided public key.
Example
const contractPubKey = signer.getContractAddresses()[0];
const message = [Field(789)];
const signature = signer.signWithKey(contractPubKey, message);Implementation of
Defined in
packages/sequencer/src/settlement/MinaSigner.ts:233
start()
start():
Promise<void>
Lifecycle method called when the signer module starts. Initializes the internal key mapping from the configured private keys. This method is part of the SequencerModule lifecycle and is automatically called by the framework during sequencer startup.
Returns
Promise<void>