ETH staking - BYOK (Bring Your Own Keys)
Users can provide their own ethereum validator keys and operationalize them within the Northstake ecosystem
## Overview
This chapter explains how to submit an Ethereum (ETH) staking order using a pre-generated validator key. Users who have already generated an Ethereum validator key and wish to use it for staking can follow this process to create a new staking order through the Northstake API.
## Prerequisites
Before proceeding, ensure that you have:
- A pre-generated Ethereum validator key.
- The Northstake API client set up in your project.
<br />
## Steps to Submit a Staking Order with a Validator Key
### 1\. Import the API Client
First, import the Northstake API client and configure it with your API and private keys:
```typescript
import { NorthstakeApi, Order } from '@northstake/northstakeapi';
const api = new NorthstakeApi('apiKey', 'privateKey');
2. Read the Validator Key
Read your pre-generated validator key from a JSON file:
const validatorKey = JSON.parse(readFileSync('path/to/validator/key.json', 'utf8'));
3. Create a Staking Order with the Validator Key
Construct the staking order using the validator key:
const stakingOrder: Order = {
orderType: 'stake',
asset: 'ETH',
validatorKey: validatorKey,
};
4. Submit the Staking Order
Submit the staking order to the Northstake API:
const { body: result } = await api.orders.createNewOrder(stakingOrder);
More users? No problemsStaking partners may of course also submit BYOK eth staking orders on behalf of their managed users.
## Validator Key StructureThe structure of the
validatorKey.json
should match the standard Ethereum validator key format:{ "validatorKey": { "keystore": { "crypto": { "kdf": { "function": "string", "params": { "dklen": 0, "n": 0, "r": 0, "p": 0, "salt": "string" }, "message": "string" }, "checksum": { "function": "string", "params": {}, "message": "string" }, "cipher": { "function": "string", "params": { "iv": "string" }, "message": "string" } }, "description": "string", "pubkey": "string", "path": "string", "uuid": "string", "version": 0 }, "password": "string", "enable": true } }
Additional Resources
- Ethereum Launchpad: Official resource for generating Ethereum validator keys and understanding the staking process.
- Ethereum Staking Guide: Comprehensive guide on how Ethereum staking works.
- Understanding Ethereum Validator Keys: Detailed information on the role and management of validator keys in Ethereum.
- This recipe show a step-by-step example of how to use the Northstake SDK to submit a BYOK eth staking order:
🗝️
Staking ETH with own/pregenerated validator key
Open Recipe
Conclusion
Using a pre-generated validator key allows users to directly stake ETH through the Northstake API. Ensure your validator key meets all required security and operational standards before submission.
Updated about 1 month ago