Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.38 KB

File metadata and controls

49 lines (39 loc) · 2.38 KB

TypeScript Ethereum staking with Fireblocks wallet

sequenceDiagram
    autonumber
    participant StakeClient as Sample stake<br> client application
    participant StakeAPI as Stake Intent API

    participant TSM1 as Fireblocks API

    StakeClient ->> StakeAPI: get StakeIntent unsigned tx data <br>(amount, withdrawal & recipient address)
    StakeClient ->> StakeClient: decode calldata with<br>deposit contract ABI
    StakeClient ->> TSM1: register web3.js provider
    StakeClient ->> TSM1: invoke web3 smart contract deposit<br> function<br>(amount, calldata, contract address)

    TSM1 ->> TSM1: sign & broadcast contract execution
Loading

Prerequisites

  • Node.js or launch in code-spaces
  • Create Fireblocks API and Secret key for use with the Fireblocks Web3 provider
  • Ensure you have a Fireblocks Transaction Policy that permits Contract Calls for your Ethereum vault Fireblocks TAP
  • Should you wish to allow-list the contracts, the Blockdaemon Ethereum Batch Deposit addresses are Mainnet:0x3F124C700fb5E741F128e28985267D44f56B242F and Holesky:0x0b6E07c5EAd5596C1f26ca2F6B97050ceC853671
  • Register a free Blockdaemon Staking API key and set in .env as BLOCKDAEMON_STAKE_API_KEY

Step 1. Set environment variables in .env

cd ethereum-staking/fireblocks/nodejs/
cp .env.example .env
  • update .env with API keys and Fireblocks Vault details

Step 2. Install package dependancies

npm install

Step 3. Launch ethereum-stake-fb.ts to determine the Fireblocks wallet address

npm run start ethereum-stake-fb.ts

Step 4. Re-launch ethereum-stake-fb.ts to generate the Stake Intent request, execute the contract with Fireblocks, and broadcast the transaction

npm run start ethereum-stake-fb.ts
  • observe the confirmed transaction through the generated blockexplorer link