(Ex-Gnosis) Safe Wallet Manual Transaction Execution (2024)

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (3)

Gnosis Safe is one of the most popular choices when it comes to multi-signature wallets.
Though it provides great security over your assets/permissions and a smooth overall experience, you still might get in a situation where you must execute a transaction without the help of their UI.

In this article, we will explain how to do so, step by step :)

In order to execute a transaction through your Gnosis Safe you must first gather and prepare the mandatory data for the action you want to take.

In this tutorial, we will work through an example of a simple ERC20 token transfer with the Safe owned by two wallets, where the authorization threshold is two.
This implies that each transaction made by the Safe needs to be authorized by both of the Safe owners.

In our example two of the following wallets will represent the Safe owners:

#1: 0xc91153c7121732b61dEC1a261CdF46B53D0Fdbb6
#2: 0xfC1a463181aFd4Bc7cC431CC32Fa5a85321FA691

Values to Retrieve

  • `to` — address of the contract which we want to interact with
    in our case this is an ERC20 token address
  • `value` — message value of the transaction
    zero, as transfers usually do not require additional base coin spendings
  • `data ` — call data to be sent to the contract
    describing transfer call with the recipient address and the amount of tokens
  • `operation` — type of the call we are willing to perform
    zero, as zero represents ‘call’ while one represents ‘delegatecall’
  • `signatures ` — owner signatures
    structures structure which consists of concatenated signatures sorted in ascending order by the value of the owner address
  • `_nonce` — Safe transaction nonce
    retrievable via the ‘nonce()’ getter and necessary in order to generate the hash

Other parameters — baseGas, safeTxGas, gasPrice, gasToken, refundRecipient can be set to zero or zero address for the sake of simplicity of this example as they’re optional.

Generating the Call Data

In order to execute the call we need to provide precise data to the contract describing the action that we’d like to make.

This can be easily accomplished in a multitude of ways, of which the easiest option is finding a calldata encoder online (ex. abi.hashex.org).

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (4)

Or just by using the following Solidity code snippet 👇

function getCallData() external pure returns (bytes memory) {
return abi.encodeWithSignature(
"transfer(address,uint256)", // Function signature (name + arg types)
0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552, // Receiver address
1000000000000000000000 // One thousand tokens in wei
);
}

Return value of the function call with example data — hex string:

0xa9059cbb000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee70955200000000000000000000000000000000000000000000003635c9adc5dea00000

Using the described schema you can create call data for any call you like.
Never forget to properly validate the encoded data in whichever way you prefer, otherwise, you might end up making an unwanted action such as burning tokens.

Retrieving the Data Hash

Data hash is retrieved by filling in the collected data to the ‘view’ function ‘getTransactionHash()’ through a blockchain explorer or other preferred way.

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (5)

This data is the same data that we will use for the ‘execTransaction()’ call and the interfaces of these two functions are almost the same, except that execution requires the owner signatures and does not take the nonce as an argument.

Remember that ‘_nonce’ is being retrieved via the contract call of the ‘nonce()’ getter.

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (6)

Return value of the function call — 32 byte hash:

0xd27ede4f2ed9c85105ef5d15a5906268a6c056378d578d40c873e610d0c381b3

Generated hash should then get approved by the owner(s).

Once the hash has been retrieved, it should be approved by all of the owners except for the one who is making the call as the owner in the role of ‘msg.sender’ implicitly approves the action.

If the caller is not one of the owners then each one of the owners needs to approve the hash.

In order to approve the hash, the owner should call ‘approveHash’ function, with computed hash as argument:

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (7)

After calling for approval, make sure each time that transaction is properly executed through the blockchain explorer.

Alternative Solution

Retrieve signatures via wallet extension by provoking a pop-up modal through the browser console.
This can be done in order to avoid hash approvals.

The way to safely generate signatures through the wallet extension which does not have native support for that will be explained in one of the next articles.

Once you have the signatures, they should be concatenated in the ascending order and filled in the ‘signatures’ field of ‘execTransaction()’ the same way that you would do this with ‘contract signatures’.

Once hashes are approved we just need to compute a signature structure which explains that we are using ‘contract signatures’ to validate the execution data.

Signatures can be represented either as literal signatures that consist of ‘r’, ’s’, and ‘v’ (but then you do not need to approve the hashes) or ‘contract signatures’ which are structured like this for interaction with the Safe wallet:

#1: 0x000000000000000000000000c91153c7121732b61dec1a261cdf46b53d0fdbb6000000000000000000000000000000000000000000000000000000000000000001
#2: 0x000000000000000000000000fc1a463181afd4bc7cc431cc32fa5a85321fa691000000000000000000000000000000000000000000000000000000000000000001

In the place of ‘r’ there is the address of an owner who either approved the hash or is the ‘execTransaction()’ function caller. At the end, there is the value of ‘01’ as the last byte in the place of ‘v’ which represents the type of verification (‘contract signature’ type). Bytes of parameter ‘s’ are empty.

So we can manually make the signature we need using the following schema:

‘0x’ + 24 zeroes + owner address (without 0x in front) + 64 zeroes + ‘01’

Once signatures are created they should be concatenated in the ascending order by the values of owner addresses.

‘Signatures’ structure (hex string):

0x000000000000000000000000c91153c7121732b61dec1a261cdf46b53d0fdbb6000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000fc1a463181afd4bc7cc431cc32fa5a85321fa691000000000000000000000000000000000000000000000000000000000000000001

Depending on the importance of the action you’re willing to perform and the complexity of the flow, you might want to simulate the call first — to ensure the wanted outcome of your call.

There are multiple parties online offering this as a service (Blocksec Phalcon / Tenderly), and you can also do it yourself manually using an EVM toolkit of your choice (Hardhat / Foundry).

Now, since we’ve gathered all of the data and approvals/signatures, we can finally execute the transaction by calling the ‘execTransaction()’ function on our gnosis safe through the explorer with all the data that we’ve gathered.

Here’s an example of how final input to the ‘execTransaction()’ function would look with our example data 👇

to (address) - 0xdAC17F958D2ee523a2206206994597C13D831ec7
value (uint256) - 0
data (bytes) - 0xa9059cbb000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee70955200000000000000000000000000000000000000000000003635c9adc5dea00000
operation (uint8) - 0
safeTxGas (uint256) - 0
baseGas (uint256) - 0
gasPrice (uint256) - 0
gasToken (address) - 0x0000000000000000000000000000000000000000
refundReceiver (address) - 0x0000000000000000000000000000000000000000
signatures (bytes) - 0x000000000000000000000000c91153c7121732b61dec1a261cdf46b53d0fdbb6000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000fc1a463181afd4bc7cc431cc32fa5a85321fa691000000000000000000000000000000000000000000000000000000000000000001
(Ex-Gnosis) Safe Wallet Manual Transaction Execution (8)

Now you’re ready to make an action of your own! Good luck :)

Dcentralab Diligence provides a multitude of services that can help you ensure the safety of your project — security audits, consultations, deployment assists, on-chain forensics, and much more!

Need help? Reach out now!

(Ex-Gnosis) Safe Wallet Manual Transaction Execution (2024)

FAQs

How to send a transaction to Gnosis Safe? ›

To submit a transaction with a Gnosis Safe, you would first need to create the transaction on the Ethereum network. This can typically be done using a wallet or other Ethereum-enabled application. Once the transaction has been created, it must be signed by the required number of keys associated with the safe.

How do I set up my Gnosis safe wallet? ›

Now, follow along to set up your own Safe Wallet!
  1. Step 1: Connect Wallet. Navigate to https://app.safe.global/welcome. ...
  2. Step 2: Create a Safe Account. ...
  3. Step 3: Configure Your Safe Account. ...
  4. Step 4: Confirm Your Transaction. ...
  5. Step 5: Receive Funds with Safe. ...
  6. Step 6: Send Tokens.

What is a gnosis wallet? ›

Wallets are foundational to the web3 user experience. They store private keys, keeping your crypto safe and accessible. They allow one to send and receive assets, interact with smart contracts and dApps. Below are a list of compatible, third-party software and hardware wallets for Gnosis Chain.

How do I connect my gnosis safe to Metamask? ›

Metamask does not support Gnosis Chain out of the box. This is how you configure Gnosis Chain on Metamask. Hit "save" and select Gnosis Chain in the network dropdown. You should now be able to connect to the Safe with your Metamask.

What is the best wallet for gnosis? ›

Why MyEtherWallet is the best Gnosis wallet in 2024?
  • Hodl you crypto in a wallet trusted by millions.
  • Open sourced and community verified.
  • All of Ethereum and so much more natively integrated.
  • Manage your NFTs quickly and easily.
  • Connect your Ledger or Trezor to add an extra layer of security.

What chains does Gnosis Safe support? ›

Supported Networks
NetworkHost
Gnosis Chainhttps://safe-transaction-gnosis-chain.safe.global
Lineahttps://safe-transaction-linea.safe.global
Optimismhttps://safe-transaction-optimism.safe.global
Polygonhttps://safe-transaction-polygon.safe.global
13 more rows
Sep 2, 2024

Does Gnosis safe have a private key? ›

Creating a Gnosis Safe account can be done using either the private key of the safe owner or through a more secure method using only public addresses via connected web3 wallets.

How to connect a safe wallet? ›

How to connect a Dapp to Safe on mobile.
  1. On the “dApps” tab in the bottom right corner select the WalletConnect button. The QR code scanner will appear.
  2. Select "WalletConnect" as a connection method inside the dApp.
  3. Scan the QR code with your mobile device from step 1.

How do I withdraw from Gnosis? ›

Gnosis withdrawal
  1. Navigate to your Wallet and click the Withdraw button.
  2. Select Gnosis wallet in the “Withdraw from” field.
  3. Select the withdrawal address or add a new withdrawal address. ...
  4. Enter the amount of Gnosis you wish to withdraw.
  5. Click Review withdraw button.
  6. You will be presented with the confirmation screen.

Is Gnosis safe legit? ›

Safe Wallet, formerly known as Gnosis Safe, is the most popular multi-signature smart contract wallet on the market. With over $100B managed in Safes and notable users like Vitalik Buterin, you can bet that Safe has plenty going for it.

Can Gnosis safe be executed? ›

In order to execute a transaction through your Gnosis Safe you must first gather and prepare the mandatory data for the action you want to take. In this tutorial, we will work through an example of a simple ERC20 token transfer with the Safe owned by two wallets, where the authorization threshold is two.

How does gnosis safe work? ›

Safe (formerly Gnosis Safe) is a multi-sign wallet running on multiple networks, which requires a minimum number of users to approve a transaction before execution. Businesses and individuals can use multi-sig wallets to manage assets safely, perform sensitive transactions, and achieve redundancy.

How to get on gnosis network? ›

For an automatic process, go to Chainlist, search for Gnosis, and connect your wallet. For a manual process: Follow the steps found here to add a custom network. You can also head here and click 'Add to MetaMask' in the top-right corner to quickly add it.

Does MetaMask support gnosis? ›

You can use MetaMask Mobile with WalletConnect if you have set up the Gnosis custom RPC. If you choose to use WalletConnect, select the WalletConnect option in the connect wallet menu.

How to fund a safe wallet? ›

Add funds to get started

Add funds directly from your bank account or copy your address to send tokens from a different account.

How do I run a safe online transaction? ›

How To Keep Your Online Transactions Safe & Secure: 11 Tips To Ensure You Don't Lose Money
  1. Never use public Wi-Fi or a public computer for online transaction or money transfer. ...
  2. Firewalls and Antivirus. ...
  3. Never reply to fraud emails and texts. ...
  4. Check for digital certificates. ...
  5. Prefer virtual keyboard. ...
  6. Enable two-step verification.
Aug 22, 2023

Does gnosis have a token? ›

The GNO token allows users to participate in the prediction market platform and create a valuable ecosystem. GNO tokens serve as the fuel for the Gnosis platform. Users must possess GNO tokens to access prediction markets and place bets on future events.

Top Articles
Should You Give Children Money as a Gift? | Truist
crypto-js - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 5715

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.