1

I am trying to perform a cryptocurrency swap, but I am facing challenges due to the nested Gnosis Safe wallet setup. Here's the situation:

Wallet Setup:

Main Wallet:

A Gnosis Safe smart contract wallet containing the cryptocurrencies to be swapped.

Owners:

  • api wallet (another Gnosis Safe).
  • admin wallet (an EOA). Requires both owners (api and admin) to sign transactions.
API Wallet:

A Gnosis Safe wallet programmatically used for signing transactions.

Owners: Two EOAs with known public/private keys (EOA1 and EOA2). Requires both EOA1 and EOA2 to sign transactions. Nested Gnosis Safe wallets structure

Problem:

I want to execute a crypto swap (e.g., using Sushiswap or similar) from the Main Wallet, but the nested nature of the wallets creates complications:

The Main Wallet requires a valid signature from the API Wallet, which in turn requires valid signatures from both EOA1 and EOA2. The backend has access to the private keys of EOA1 and EOA2 but no funds to cover transaction fees for signing operations directly.

Existing Work / Research:

My understanding of the problem so far is:

  • I need to create a transaction that is signed by both EOA1 and EOA2.
  • This signed transaction must be packaged as an argument for another transaction submitted by the API Wallet.
  • Finally, this nested transaction should be included within the swap transaction submitted by the Main Wallet to the network.

I am exploring how to implement this flow programmatically in Go while minimizing gas fees and ensuring the security of the wallet hierarchy.

Questions:

  • How can I structure the signing process to handle this nested wallet hierarchy efficiently?
  • Can the API Wallet sign and relay the transaction without involving gas fees for the individual EOAs?
  • Are there any tools, libraries, or best practices for working with such nested Gnosis Safe setups in a backend system (e.g., in Go)?

Environment:

  • Backend: Go
  • Swapping service: 1inch, Sushiswap or other decentralized exchange
  • Wallet setup: Gnosis Safe with multiple owners

Any guidance on how to resolve this would be greatly appreciated!

1 Answer 1

0

Short answer: the entire flow is described here. Unfortunately the SDK only covers TypeScript/JavaScript (and not Go). You can take a look at the setup for this flow (the Safes are nested on two levels), before implementing yours in Go.

Long answer:

  • Question 1: you will have to organize signature sequentially, as explained in the link above. The transaction will be created by the main wallet (not the API wallet), and will have to include signatures from API wallet and admin.

  • Question 2: strictly speaking, signing transactions will not cost anything as it does not change the state of the blockchain. The only transaction which will be executed will be from the main wallet, and only this one will require gas.

  • Question 3: tools currently include the TypeScript SDK, maybe the CLI (so you can sign transactions from your system). Best practices are stated in the documentation above. You can also take a look at the code of the Safe{Core} SDK protocol-kit to see how the methods used in the guide are implemented. The amount of work required to port it to Go will probably not be trivial though.

Please let me know if you have any other questions.

Thank you in advance 🙏 Best, Louis

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.