Signer non-efemeral keys using GSN

When using GSN, an external application need to sign the transaction that will going to be send to the relay.
What solution do you recommend to sign transactions with a persistent (non-efemeral) key?
Metamask does not support sign transactions without broadcast them (
We need to sign transaction originated by companies (actually people representing companies, but the private key belongs to a company). So, solutions like MEW Connect or Parity Signer, that are based on QRCode/celular are not an option to us. We also look at frame ( but it seems that they are still in very early stage.
The best option in the moment seems to be UniversalLogins. Do you recommend other options?
In OZ FAQ you wrote: “For persistent keypairs (d)apps can store this keypair in local storage, or leverage traditional web2 technologies to present users with a typical web2 login experience.”. Of course, we can develop a solution to that, but do you have anything ready to recommend?


Hi @Suzana_Maranhao,

We can use MetaMask to sign calls to be sent to relayers. We are signing a message, rather than signing a transaction (as in the case of MetaMask/metamask-extension#3475)

It depends what abstraction you need for your users on whether MetaMask is suitable or you want to implement a persistent key.

Hi @abcoathup,

Thank you for your message. As far as I understood I need to sign a transaction (and not only a message). Do you have any code showing how to use Metamask to sign messages that is, in fact, a transaction? Has anyone tried that in GSN?

Thank you

1 Like

Hi @Suzana_Maranhao,

With the Gas Station Network it is the relayer who creates the transaction (as they are paying the gas), whilst the user signs a message (the relayed call).

I used the GSN Starter Kit as a start and then changed to use MetaMask.

You could also use Building a GSN powered (d)app from scratch

I can put together some instructions tomorrow.

Hi @Suzana_Maranhao,

You can use the GSN Starter Kit to start.

Then deploy the Counter contract to Rinkeby using the following instructions:

Then in App.js change the web3 context to useWeb3Injected with GSN true (commenting out any other context). (as per: Sign GSN relayed call with MetaMask)

 const context = useWeb3Injected({gsn: true});

Change MetaMask to use Rinkeby network.
You can then press Increase Counter/Decrease Counter and the user will get a Signature Request from MetaMask to sign, and once signed the GSN will relay the call.

Feel free to ask all the questions that you need.

Hi @Suzana_Maranhao,

I wanted to check that you were able to use MetaMask with GSN?