Programmatic native restaking on Kiln validators

This guide walks you through the different integration steps required to propose direct restaking on top of Kiln Ethereum validators.

Overview

To restake an Ethereum validators on the EigenLayer platform, the withdrawal_credentials address of the validator MUST be set to an EigenPod Contract address.

EigenPod is a contract deployed per restaker address, one address = one pod maximum.

Integration

1. Get the EigenPod address of the restaker

EigenPod are deployed at deterministic addresses, so you don't need to deploy them to know their address (it will be deployed in the third step of this guide).

You can get the EigenPod address by calling the view function getPod(address podOwner)of the EingePodManager contract, where podOwner is the address that will perform the restaking / deposit of the validator(s).

This function returns the address of the EigenPod, which will be set as withdrawal_credentials of the validators to deposit.

NetworkEigenPodManager Address

Mainnet

0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338

Goerli (testnet)

0xa286b84C96aF280a49Fe1F40B9627C2A2827df41

2. Create Kiln ETH validators

You can get a Kiln API token by going on your organization dashboard under the Applications section.

To create ETH validators on Kiln infrastructure, you can call the POST /v1/eth/keys Kiln API route.

curl -X POST https://api.kiln.fi/v1/eth/keys \
  -H "Authorization: Bearer $API_TOKEN"      \
  -d '{"account_id": $ACCOUNT_ID, "withdrawal_address": $EIGENPOD_ADDRESS, "fee_recipient_address": $FEE_RECIPIENT_ADDRESS, "number": $NUMBER, "format": $FORMAT}'

where:

  • API_TOKEN is your kiln api token

  • ACCOUNT_ID is a Kiln account you can create under the "Accounts" section of your organization Kiln dashboard

  • EIGENPOD_ADDRESS is the address we fetched at the previous step (mandatory)

  • FEE_RECIPIENT_ADDRESS is the address that will receive the Execution Layer rewards of the validators

  • NUMBER is the number of keys you want to generate

  • FORMAT can be et to batch_deposit

3. Create your EigenPod

Call the createPod() function on the EigenPodManager contract. This deploys a unique pod per call address, you cannot own multiple pods with a single address.

4. Deposit Kiln ETH validators

Kiln provide a Smart Contract utility called BatchDeposit contract which enables you to deposit multiple validators in the same transaction.

To efficiently do this, modify the above flow by using the Kiln Batch Deposit contract

  1. if < 64 validators:

    call the batchDeposit(bytes publicKeys, bytes withdrawalCreds, bytes signatures, bytes32[] dataRoots)

  2. if > 64 validators

    call the bigBatchDeposit(bytes publicKeys, bytes withdrawalCreds, bytes signatures, bytes32[] dataRoots)

Other resources

Unstake

There are two ways to unstake your validators.

  1. Post an ETH Request Exit call using our API. This can be triggered from depositor of the validator’s stake OR from the withdrawal creds of the validator. In the case of an EigenLayer restaked validator, it will be the former.

  2. Retrieve a pre-signed exit message from Kiln and broadcast it, using the instructions described here. This is also a disaster recovery flow you can use in case Kiln is not available.

Compute the amount of Restaked Points a validator has accumulated

  1. Call the GET /v1/eth/stakes Kiln api route using ?validators=0xa...,0xb... query parameter with your validator addresses

  2. Using the information returned, compute points amount for each of them:

const eligibility_at_seconds = new Date(stake.activation_eligibility_at).getTime() / 1000;
const exit_at_seconds = (stake.exited_at ? new Date(stake.exited_at).getTime() : Date.now()) / 1000;
const stake_amount = 32;

const restaked_points = ((exit_at_seconds - eligibility_at_seconds) * stake_amount) / 3600;

Last updated