Geode Document Hub
  • Geode Document Hub
  • The Staking Library
    • 🔥The Issue
    • 🧯A Solution
  • Operator Marketplace
    • 🟢A Validator's Lifecycle
    • 🔵Maintenance Fee
    • 🟡Onboarding New Operators
    • 🔴Regulating the Marketplace
      • 🚨Prison
  • Key Concepts
    • 🪙Staking Derivatives
      • G-Derivatives
        • gETH vs gAVAX
    • 🌀Portal
      • 🔐Isolated Storage
      • 🤝Dual Governance
      • ⚠️Limited Upgradability
    • ⚙️Permissionless Configurable Staking Pools
      • 🎭Current Interfaces
      • ⛏️Maintainers
    • 🛡️Withdrawal Contracts
      • ⛑️Recovery Mode
      • 🕗Withdrawal Queue
    • 🌊Bound Liquidity Pools
    • 🔭Oracles
      • Telescope Ether
      • Telescope Avax
    • 👾Future of Geode
      • Better Maintainers (WIP)
      • Synthetic Liquidity (WIP)
      • Dynamic Withdrawals (WIP)
      • Further Decentralization
        • Supporting EIP-4788 (DRAFT)
        • Quadratic Weighted Senate (DRAFT)
        • Degen Operators (DRAFT)
        • Decentralized Telescope (DRAFT)
      • Chain Sync (AVAX) (draft)
  • Ethereum Guides
    • 📗Staking Pool HandBook
      • Initiating a Customizable Staking Pool
      • Managing Your Operator Set
      • Changing Your Pool's Owner
      • Manage Your Maintenance Fee
      • Private Pools and Whitelisting
      • Using a Bound Liquidity Pool
      • Using Maintainers for Your Pool
      • Securing Your Withdrawal Contract
      • Decentralizing Your Pool
    • 📕Operator Handbook
      • Get Onboarded
      • Initiating an Operator
      • Communicating with Portal
      • Creating Validators
      • Changing an Operator's Owner
      • Switching Your Fee
      • Switching Your Validator Period
      • Using Maintainers
      • Optimizing Your Revenue
      • Exiting Validators
    • 📘Liquidity Pool HandBook
  • Avalanche Guides
    • Staking Pool Handbook
    • Operator Handbook
  • Developers
    • Networks
    • Live Contracts
      • Avalanche v1
      • Ethereum v2
        • gETH.sol
        • Portal.sol
          • globals.sol
          • DataStoreUtilsLib.sol
          • GeodeUtilsLib.sol
          • DepositContractUtilsLib.sol
          • OracleUtilsLib.sol
          • StakeUtilsLib.sol
        • Swap.sol
          • AmplificationUtils.sol
          • MathUtils.sol
          • SwapUtils.sol
          • LPToken.sol
        • WithdrawalContract.sol
        • Interfaces
          • ERC20InterfaceUpgaradable.sol
          • ERC20InterfacePermitUpgradable.sol
    • Audits
    • Bug Bounties
Powered by GitBook
On this page
  • 0.1. Create a pool - optional
  • 0.2 Fund Your Wallet
  • Internal Wallet
  • 1. Pre-Proposal Checks
  • 2. Proposing New Validators
  • Get withdrawalCredential
  • Staking Deposit Cli
  • Create deposit data
  • Propose!
  • 3. Check if You Can Stake for Your Proposal:
  • 4. Batch Validator Activation!
  1. Ethereum Guides
  2. Operator Handbook

Creating Validators

PreviousCommunicating with PortalNextChanging an Operator's Owner

Last updated 2 years ago

0.1. Create a pool - optional

It might take some time for other pools to give you an allowance.

It is best to create some pools to start testing immediately.

We will provide some Goerli Ether upon onboarding.

Create a basic pool easily:

Give Yourself allowance:

0.2 Fund Your Wallet

Internal Wallet

Every ID has an Internal Wallet, which makes transferring Ether easier for both Geode's Portal, and it's users.

The Internal Wallet is the place where your fees will accrue over time.

You will be reimbursed after activating the validator. However, this amount limits how many proposals you can have at the same time.

If you have 100 Ether in your internal wallet, and if it takes 1 day for proposals to be approved:

  • You can propose 100 validators a day.

await Portal.increaseWalletBalance(id, {value: 100 eth});

Check Your Wallet Balance

const balance = Portal.readUintForId(operatorId, getBytes("wallet"))

1. Pre-Proposal Checks

It is probably a good idea to initiate a couple staking pools and distribute your Goerli Funds among them, Someone else giving you allowance can take some time otherwise.

Get the list of all Staking Pools:

const all_pool_ids_list = Portal.allIdsByType(5, index);

Alternatively you can listen for OperatorApproval(indexed poolId,indexed yourId, amount);

Check Allowances

const allowance = Portal.readUintForId(
    poolId,
    Portal.getKey(
        operatorId, 
        getBytes32("allowance")
    ));

const proposedValidators = Portal.readUintForId(
    poolId,
    Portal.getKey(
        operatorId, 
        getBytes32("proposedValidators")
    ));

const activeValidators = Portal.readUintForId(
    poolId,
    Portal.getKey(
        operatorId, 
        getBytes32("activeValidators")
    ));

You can create new validators if allowance is greater than proposedValidators + activeValidators.

Check Surplus

const surplus = Portal.readUintForId(poolId, getBytes("surplus"))

Every 32 ETH in surplus means 1 potential validator.

Join the Race

When enough funds are pooled for a new validator, you will need to be faster than the other Operators with enough allowance.

If you are the only Operator of the pool, you can take your time.

Otherwise, automate your tasks to be faster and capture the validator, or you will need to wait for another 32 Ether.

2. Proposing New Validators

Get withdrawalCredential

It is very important for you to use pool specific withdrawalCredentials in your validators. Otherwise, your proposal will not be approved!

await PORTAL.readAddressForId(
  id,
  getBytes32("withdrawalContract")
);

// or

await PORTAL.readBytesForId(
  id,
  getBytes32("withdrawalCredential")
);

Staking Deposit Cli

We have forked the Ethereum's to add --amount parameter.

Using this CLI instead of the original one will allow you to customize the amount parameter:

git clone https://github.com/Geodefi/staking-deposit-cli.git
cd staking-deposit-cli/
python3 -m pip3 install virtualenv
python3 -m virtualenv venv
source venv/bin/activate
python3 setup.py install
python3 -m pip3 install -r requirements.txt

Create deposit data

Call these

For signatures1:

  • create with a new-mnemonic OR use an existing mnemonic but be careful with validator index.

  • set --eth1_withdrawal_address to withdrawalContract

  • amount is 1

python3 ./staking_deposit/deposit.py new-mnemonic --num_validators=x --amount=1 --chain=prater --eth1_withdrawal_address 0xc82Ed5eC571673E6b18c4B092c9cbC4aE86C786e 

For signatures31:

  • use the same mnemonic while creating signatures1.

  • use the same validator index (0 if the same time).

  • specify the amount of validators with --num_validators

  • use the same --eth1_withdrawal_address

  • amount is 31

python ./staking_deposit/deposit.py existing-mnemonic --num_validators=x --amount=31 --mnemonic_language=english --chain=prater --eth1_withdrawal_address 0xc82Ed5eC571673E6b18c4B092c9cbC4aE86C786e
  • Pubkeys of the deposit data files should match.

Propose!

Portal.proposeStake(
    uint256 poolId,
    uint256 operatorId,
    bytes[] calldata pubkeys,
    bytes[] calldata signatures1,
    bytes[] calldata signatures31
    ) 
  • signatures1: signature that will be used while proposing validators, sending 1 Ether to Deposit Contract.

  • signatures31: signature that will be used while activating validators, sending 31 Ether to Deposit Contract.

3. Check if You Can Stake for Your Proposal:

await Portal.canStake(pubkey);

It takes less than 24 hours for the Beacon Chain and our Oracle to verify a proposal.

4. Batch Validator Activation!

If your proposal is approved, you can use the pooled funds. However, you can save gas by doing Batch Activations:

Portal.beaconStake(uint256 operatorId, bytes[] calldata pubkeys);

Save gas cost:

Pub-keys should be arranged by pool ids.

For example: pub-keys = [pk1, pk2, pk3, pk4, pk5, pk6, pk7]

  • pk1, pk2, pk3 from pool1

  • pk4, pk5 from pool2

  • pk6 from pool3

Etc.

Because of , you will need 1 Ether per validator proposal available in your internal wallet.

📕
Initiating a Customizable Staking Pool
Managing Your Operator Set
the bug explained here
🟢A Validator's Lifecycle
GitHub - Geodefi/staking-deposit-cli: Secure key generation for depositsGitHub
Logo