A guide to auto-staking

Tl;dr: you sign an offline transaction to stake with Bancor and stakingpool.space will send the transaction when pool space opens up

Introduction

With Ethereum it is possible to schedule transactions, but as far as I know it's not possible to schedule a transactions to broadcast whenever space opens up on Bancor in a desired pool. So I built the functionality to do this myself and offer it to you free of charge.

The idea is simple, you sign an offline transaction using your private key. Singing with your private key will be done with another tool than stakingpool.space, so stakingpool.space will never have access to your private key. You then give this signed transaction to stakingpool.space and your transaction will be broadcast whenever enough space opens up for your stake.

Keep in mind that other people might also be trying to stake similar or smaller amount. When space opens up, all signed transactions that are trying to stake amounts smaller than the space opened up, will all be sent at once. So make sure you use a high gas fee.

If someone else used a higher gas fee they will likely get their transaction in first and there might not be enough space left in the Bancor pool to stake your amount. In this case your transaction will be rejected, you will lose out on the gas that was spent for your transaction and you will have to try again.

You can see the amount of signed transactions waiting for each token pool, so you can decide if you want to add your transaction. And lastly, stakingpool.space has no access to the gas price you are using (this is encrypted into the signed transaction using your private key and will need your private key to decrypt, which stakingpool.space does not ask for), so no front running can happen.

I will try to work on a first in-first out queueing system in the future. This would allow the oldest transaction, smaller than the space that opened up, to be sent while the second-oldest transaction has to wait until the transaction is finished. This should bring down the gas price needed to stake, but is quite complex to build.

Requirements

  • A MetaMask account
  • A tool to sign offline transactions (I personally use MyCrypto)
  • Enough Ethereum to pay for gas
  • Preferably a hardware wallet (so you don't have to export your MetaMask secret key to connect your wallet with MyCrypto)

Steps

If any of the steps below are unclear or not working, contact me at admin@stakingpool.space

  1. Check the number of transactions waiting for your desired pool under the Auto-stake header and decide if you want to add your transaction
  2. If you decide to add your transaction, connect your MetaMask wallet using the 'Connect wallet' button
  3. Sign the security token with MetaMask
  4. The first address of your MetaMask account will be used to check if you have enough balance and to unlock the amount you want to stake
  5. Fill in the amount you want to stake in the pool and accept the terms & privacy policy
  6. If you want to stake something else than Ethereum, you will have to unlock that amount first by clicking the 'Unlock' button. If your allowance is lower than the amount you want to stake, MetaMask will present you with a transaction to unlock the amount you want to stake.
  7. Click the 'Create data' button
  8. To verify that the 'Data' field:
    • Search the 'To' address on Etherscan
    • Make sure there are recent transactions and not too many rejected transactions, otherwise the contract might be outdated
    • Go to the 'Contract' tab, scroll down to 'Contract ABI' and click the 'Copy ABI to clipboard'
    • Open abi.hashex.org, paste in the Contract ABI and click the 'Parse' button
    • Open the dropdown under 'Function type' and select 'addLiquidity'
    • Copy the 'Pool' address from stakingpool.space and put it in as 'poolAnchor' on abi.hashex.org
    • Copy the 'Token' address from stakingpool.space and put it in as 'reserveToken' on abi.hashex.org
    • Copy the 'Amount' from stakingpool.space, convert it into Wei using eth-converter.com (fill in your amount under 'Ether' and copy the 'Wei' amount) and put it in as 'amount' on abi.hashex.org
    • Make sure the 'Data' on stakingpool.space is exactly the same as on abi.hashex.org (minus the '0x' at the start)
  9. Sign your transaction offline
    • I personally open up MyCrypto, connect my wallet and disconnet my internet so I see 'Sign Transaction' instead of 'Send Transaction'
    • Copy over the 'To' address and 'Amount'
    • Deselect 'Automatically Calculate Gas Limit'
    • Fill in a Gas Price that is high enough to give you a chance to make your auto-stake succeed (as discussed in the Introduction)
    • The 'Gas limit' might seem high, but the Bancor contracts take a lot of gas and you will get back all the gas that was not used for your transaction. If your gas limit is too low, your transaction will be rejected, so I want to make sure it is enough.
    • Copy over the 'Data' and click 'Sign Transaction'
  10. Make sure the raw transaction shows a chain id of 1 or no chain id (defaults to 1 if no chain id is provided)
  11. Copy over your signed transaction (starts with '0x' and looks similar to the 'Data') to stakingpool.space and click on the 'Put transaction in pool' button

Limitations

As long as you have an open auto-stake on stakingpool.space, you can not send any other transactions from that address, otherwise you'll overwrite the nonce that is being used. The way nonces work is also the reason why you can only open one auto-stake postion per address on stakingpool.space.

Todos

  • A FIFO queueing system
  • Browser notification when your transaction is sent
  • Support more tokens

Q&A

Do I need to give stakingpool.space my private key?

No, you sign your transaction using your private key with another tool such as MyCrypto.

Why can I only auto-stake one transaction?

This is because of nonces . If you would have multiple transactions waiting, the code would also have to check the nonces of all your transactions when space opens up to see if it can send the transaction with the lowest nonce, which would make the code slower.

Can I still send transactions from the address I used for auto-staking?

Technically yes, however you will overwrite the nonce that is used for your signed transaction to auto-stake. If this happens and your auto-stake transactions is sent when space opens up in the pool, it will automatically be rejected and you lose the gas fee.

Terms

stakingpool.space is not responsible in any way or form for any loss of funds or incorrect usage of auto-staking. Auto-staking is an experimental feature to illustrate a new functionality and the responsibility of correct usage is entirely upon the user (meaning you).

Privacy policy

After connecting your wallet to stakingpool.space your wallet address will be stored in the database for 24 hours to store your security token. Your security token and wallet address are removed automatically after 24 hours. If you want to use the auto-stake functionality again after 24 hours, you will have to sign a new security token.

Your wallet address is also stored in the database as long as you have an auto-stake position open. As soon as the transaction is sent (when pool space opens up) the transaction containing your wallet addres is automatically removed from the database.