Skip to content

Instantly share code, notes, and snippets.

@mattlockyer
Last active January 21, 2021 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattlockyer/d092ef8764ed94b713d59954d98aecb1 to your computer and use it in GitHub Desktop.
Save mattlockyer/d092ef8764ed94b713d59954d98aecb1 to your computer and use it in GitHub Desktop.
Signing Messages with near-cli
// set the network (if you want mainnet)
export NEAR_ENV=mainnet
// choose 1 or 2
// 1. NEAR wallet login
near login
// 2. LEDGER replace ACCOUNT_ID
// change useLedgerKey value if you are using custom ledger path
near repl --accountId="ACCOUNT_ID" --useLedgerKey="44'/397'/0'/0'/1'"
// REPL
// you should now see > in front of your commands, you are in repl, use ctrl-c twice to exit
// SIGNING A MESSAGE
// replace MESSAGE
// copy and paste into repl, hit enter
console.log('\n\nSignature:\n\n' + Buffer.from((await this.account.signTransaction('MESSAGE', []))[1].signature.data).toString('base64') + '\n\n')
// copy signature
//ctrl-c twice to exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment