Is it possible to use Gnosis Safe's SDK to do multi signature collection to run a contract function? I would like to have several node independently verify something and then sign some proposal together, once it reaches n-of-k requirement it should mint tokens to an address or change a contract variable.
1 Answer
yes it should be possible by using Safe{Core} SDK Protocol Kit. There is a section in the documentation specifically about signing transactions.
Please let me know if it managed to help you do what you want.
Best, Louis
-
Thank you Louis, can you give us a code snippets using the EIP-712 signatures? I can't find a section where it can execute external smart contract's function. For example, we have a separate NFT contract and requires 2/3 owners' approve to execute mint function. Where can I submit transaction data such as destination contract address, values, etc using your SDK? Commented Apr 25 at 19:23
-
Transaction data would be in the
safeTransactionData
object, in the very first lines of the section I mentioned. Then you can follow this guide to sign EIP-712 typed data: docs.safe.global/sdk/protocol-kit/guides/signatures/… Hope it helps. Best, Louis Commented Apr 26 at 15:03 -
Thanks! so looking at the SDK, it stores all private keys in
.env
which I assume it's not safe to run 2/3 requirements. Is this the recommended way to run it? I think keeping each key in a separate server and execute transaction would be safer. Can we listen to the safe's event? what do you think about this approach? Commented May 5 at 17:11 -
Security will depend on how you manage secrets there. You can listen to (some) Safe events here: github.com/safe-global/safe-events-service Commented May 6 at 8:45