LogoLogo
  • Imua
    • About
  • Manifesto
    • The Problems
    • The Principles
  • Architecture
    • Imua Design Principles
    • Imua Network
    • Imua Modules
    • Client Chain Bridges
      • Trustless Verification of Client Chain State
      • Handling Race Conditions between Imua and Client Chains
    • Client Chain Contracts
  • Concepts
    • Ecosystem
      • Re/stakers
      • Operators
      • Services (AVS)
        • Service Integration with Imua
        • Service Committee
        • Service Integration Details
    • restaked Proof-of-Stake (rPOS)
    • Multi-Token Restaking
    • Multi-Chain Restaking with Trustless Bridging
    • Voting Power
    • Price Oracle
    • Flexible Integration with AVS
    • Tribe Staking
  • Governance
  • Risk Management
    • Risk Analysis
      • Risk Modeling
      • Risk Parameters
      • Crypto-Economic Risk
      • Unintended Slashing
      • Black Swan Events
    • Risk Mitigation
      • Smart Contract Simplicity
      • Audits
      • Slashing Prevention
      • Slashing Vetos
      • Insurance Pools
      • Circuit Breakers
  • Components
    • Testnet
    • Oracle Module
      • Reaching Consensus on Asset Prices
      • Penalty
      • Implementation Detail
    • Smart Contracts
    • Explorer
    • Registry
  • Validator Setup
    • Prerequisites
    • Node Install
    • Compiling Binary from Source
    • Oracle Price Feeder
    • Running the Node
    • Snapshot
    • Register Option 1 (Bootstrap)
    • Register Option 2 (Post Network Launch)
    • Deposit Tokens
    • Delegating Tokens
    • Confirm Election Status
    • Faucets
    • Managing The Validator
    • Security Best Practices
    • Risks & Mitigation
    • Participation in Governance
    • FAQs & Resources
  • Testnet Upgrade to v1.1.1
  • AVS Setup
    • AVS Overview
    • Prerequisites
    • Building the AVS in Imua
    • Hello-World-AVS Example
    • Becoming AVS Operator
    • AVS Register and Deploy
    • AVS Task Example
    • Enhanced and Automated Edition of hello-avs integration guide&example
  • Whitepaper (2023)
    • .pdf
  • FAQ
    • What problems is Imua solving?
    • What are the main design trade-offs that had to be made with an omnichain design?
    • Does the omnichain design imply added trust assumptions (relative to a single-chain design)?
    • What concurrency-related challenges would you face with a different design?
    • How does Imua integrate with new chains?
    • Do specific chains prove unique challenges w.r.t. integration?
    • How is the cross-chain communication is achieved?
    • What are the known attack / censorship vectors here, if any?
    • Are the restaked tokens being pooled in a centralized account?
    • Who will run the validators in the Imua network?
    • Is Imua an AVS?
    • How does Imua address the risks of overloading L1 social consensus?
    • Does the Imua queuing system raise concerns around latency?
    • What are the main benefits of an omnichain design?
Powered by GitBook
On this page
  1. Validator Setup

Delegating Tokens

The deposited tokens can now be delegated to your validator.

## Script constants, repeated here for ease of reference
EXO_ETH_ADDR=0x83E6850591425e3C1E263c054f4466838B9Bd9e4
WST_ETH_ADDR=0xB82381A3fBD3FaFA77B3a7bE693342618240067b
GATEWAY_ADDR=0x64B5B5A618072C1E4D137f91Af780e3B17A81f3f

## User choices, (some) repeated here
ETH_PRIVATE_KEY=0xabcde.....
ETH_ADDRESS=0x123....
# The token to delegate
TOKEN=$EXO_ETH_ADDR
# Quantity of token to deposit (without the 1e18 multiplier)
# Decimal values are supported
QUANTITY=25
# Endpoint for Ethereum RPC
ETHEREUM_RPC_URL=https://rpc.ankr.com/eth_sepolia

# Derived value, depending on $ACCOUNT_KEY_NAME and $HOMEDIR in prior steps
IM_ADDRESS=$(imuad --home $HOMEDIR keys show -a $ACCOUNT_KEY_NAME)

BOOTSTRAPPED=$(cast call --rpc-url $ETHEREUM_RPC_URL $GATEWAY_ADDR "bootstrapped() returns (bool)")
if [ "$BOOTSTRAPPED" = "true" ]; then
    # Generate the LZ messsage to calculate the fees
    DELEGATE_PREFIX="0x08"
    TOKEN_B32=$(cast 2b $TOKEN)
    ETH_ADDRESS_B32=$(cast 2b $ETH_ADDRESS)
    IM_ADDRESS_BYTES=$(cast fu $IM_ADDRESS)
    QUANTITY_B32=$(printf "%064s" $(cast 2h $(cast 2w $QUANTITY) | cut -c3-) | tr ' ' '0')
    LZ_MESSAGE=$(cast ch $DELEGATE_PREFIX $TOKEN_B32 $ETH_ADDRESS_B32 $IM_ADDRESS_BYTES $QUANTITY_B32)
    VALUE=$(cast call --rpc-url $ETHEREUM_RPC_URL $GATEWAY_ADDR "quote(bytes)" $LZ_MESSAGE)
else
    # No LZ fees, since we are in Bootstrap mode
    VALUE=0
fi

# Execute the transaction
cast send --rpc-url $ETHEREUM_RPC_URL \
    $GATEWAY_ADDR \
    "delegateTo(string,address,uint256)" \
    $IM_ADDRESS \
    $TOKEN \
    $(cast 2w $QUANTITY) \
    --private-key $ETH_PRIVATE_KEY \
    --value $(cast 2d $VALUE)
ETH_LZ_ID=40161 # Sepolia, where our $GATEWAY_ADDR lives
STAKER_ID=$(echo "${ETH_ADDRESS}" | tr '[:upper:]' '[:lower:]')_$(printf '0x%x\n' "${ETH_LZ_ID}")
IMUA_COS_GRPC_URL=https://api-cosmos-grpc.exocore-restaking.com:443
imuad query assets staker-assets \
    $STAKER_ID --node $IMUA_COS_GRPC_URL \
    --output json | jq
# looks like this
{
  "asset_infos": [
    {
      "asset_id": "0x83e6850591425e3c1e263c054f4466838b9bd9e4_0x9ce1",
      "info": {
        // Total deposited is still the same
        "total_deposit_amount": "5000000000000000000",
        // But the "free" deposit is reduced because it is delegated
        "withdrawable_amount": "0",
        // This is the amount being undelegated, same as before
        "pending_undelegation_amount": "0"
      }
    }
  ]
}

Marking a delegation as self-delegation (Post Bootstrap Phase)

This step only applies if the validator registration was done after the Bootstrap phase ended. Otherwise, it is assumed that the delegations made by the Ethereum address, which sent the validator creation transaction, are self-delegations for the validator. Most validators will need to undertake this step.

Send the transaction to associate the two addresses: each such association indicates that the delegations made by the Ethereum address are to be considered as self-delegations for the validator.

# User inputs, the first two of which were previously provided
ETH_PRIVATE_KEY=0xabcdefg...
ETH_ADDRESS=0xabcd...

# Constants
IMUA_ETH_RPC_URL=https://api-eth.exocore-restaking.com
IMUA_COS_GRPC_URL=https://api-cosmos-grpc.exocore-restaking.com:443
ETH_LZ_ID=40161 # Sepolia

# Address of gateway derived from the params of x/assets
IMUA_GATEWAY_ADDR=$(imuad --node $IMUA_COS_GRPC_URL query assets params --output json | jq -r '.params.gateways.[0]' | cast 2a)

# The validator gets only their IM_ADDRESS funded using the faucet, while the ETH_ADDRESS (if it is different) may not have funds to pay for gas.
ETH_ADDR_BALANCE_IN_HUA=$(cast balance $ETH_ADDRESS --rpc-url $IMUA_ETH_RPC_URL)
# The faucet gives out 1 IMUA, of which we will transfer 0.5 IMUA (and retain the rest) to the ETH equivalent address. Note that the ETH equivalent address may be the same as the im1 address if the same mnemonic is used; hence, the transfer would be pointless. To avoid spending gas on that transfer, we check the balance of the destination account first.
AMOUNT_TO_TRANSFER_IN_HUA=$(cast 2w 0.5 ether)
if [ "$ETH_ADDR_BALANCE_IN_HUA" -lt "$AMOUNT_TO_TRANSFER_IN_HUA" ]; then
    # execute the transfer via cast (using imuad is also possible)
    IMUA_PRIVATE_KEY=$(imuad --home $HOMEDIR keys unsafe-export-eth-key $ACCOUNT_KEY_NAME)
    cast send --rpc-url $IMUA_ETH_RPC_URL \
        $ETH_ADDRESS \
        --value $AMOUNT_TO_TRANSFER_IN_HUA \
        --private-key $IMUA_PRIVATE_KEY
fi

# Send the transaction for the association
cast send --rpc-url $IMUA_ETH_RPC_URL \
    $IMUA_GATEWAY_ADDR \
    "associateOperatorWithEVMStaker(uint32, string)" \
    $ETH_LZ_ID \
    $(imuad --home $HOMEDIR keys show -a $ACCOUNT_KEY_NAME) \
    --private-key $ETH_PRIVATE_KEY

If the transactions above failed, it may be possible that an association already exists. Use the command below to verify it.

To check whether the above transaction went through, the association can be queried.

ETH_LZ_ID=40161 # Sepolia, where our $GATEWAY_ADDR lives
STAKER_ID=$(echo "${ETH_ADDRESS}" | tr '[:upper:]' '[:lower:]')_$(printf '0x%x\n' "${ETH_LZ_ID}")
IMUA_COS_GRPC_URL=https://api-cosmos-grpc.exocore-restaking.com:443
imuad query delegation associated-operator-by-staker \
    $STAKER_ID --node $IMUA_COS_GRPC_URL \
    --output json | jq
# expected output
{
  "operator": "<your_im_addr>"
}
PreviousDeposit TokensNextConfirm Election Status

Last updated 1 month ago

If the above transaction was executed after the network bootstrap phase, again, may be used to query the status of the message. In addition, the withdrawable amount will change on Imua once the message is delivered.

To prevent slashing for downtime, it is recommended to send the transaction below only .

The validator should now be considered "eligible" to be part of the active validator set if the self-delegation exceeds 1,000 USD. The inclusion in the set happens in the beginning of the next epoch, which may be from now. Only the top 50 validators (by total stake = self-stake + delegated stake) are included in the validator set.

LayerZeroScan
after the node is synced
at most 1 hour