Instructions to set viewing key when keplr not working

People are struggling to set viewing keys right now through keplr. This is a way to get around it.

  1. Get the contract address you want to set the viewing key.
    a. Go to Button Swap | Secret network |
    b. Click on the ‘View’ button next to balance and copy contract address from ‘Add Token’ pop up.


  1. Click ‘Submit’
  2. Copy the provided key then click ‘Reject’.
  3. Goto the Smart contract interface | Secret network |
  4. Fill the Smart contract interface page as such:
    a. Change from Query to Handle
    b. Paste token contract address from before
    c. Input ‘set_viewing_key’ into ‘Function name’ field
    d. Click on ‘+ PARAM’
    e. In the ‘Key’ input, enter type ‘key’
    f. In ‘Value’, paste the key you copied before.
  5. Click ‘Submit’ and confirm both pop ups. The first one is to estimate the gas required and the second is to submit the actual transaction.
  6. Once successful, go back to button swap page and click on the view button again.
  7. This time click on checkbox ‘(Advanced) Import my own viewing key’.
  8. Input the viewing key and press Submit again.

Extra info: Keplr stores your viewing key for each token. Things are most likely broken right now because keplr is submitting the transaction to set the viewing key, but then not receiving confirmation and storing the viewing key.


Think is great, thanks @stevenchang5000!
Also worth mentioning that if you already have an old viewing key for the token set in Keplr you first must remove the token from Keplr in order for “import my own viewing key” to work, as it’s not overriding existing keys.

1 Like