Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
Best way to save a secretKey

I'm learning Solana API on ReactJS. After generating a keypair you can recreate the same keypair with the secretKey. How can I save this keypair? I'm using react and I want to recreate always the same keypair unless I generate another.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The question of "best" is a matter of opinion, but in your case, since you're just learning and using this keypair for development, your best bet is to save it to your local disk.

If you're developing in a browser environment, you can just hardcode the bytes of your secret key in the code.

Later on, once you're deployed to mainnet and want to work safely, a hardware wallet is likely your best option.

You can find more information on wallets in the docs: https://docs.solana.com/wallet-guide

about 4 years ago · Juan Pablo Isaza Report

0

I write it to a file. Create generateKeypair.js in src directory and add this

const fs=require('fs')
const anchor=require("@project-serum/anchor")
const account=anchor.web3.Keypair.generate()
fs.writeFileSync('./keypair.json',JSON.stringify(account))

then execute this script once:

node src/generateKeypair.js
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!