Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Trustless Developer Guide - Authentication Example
// This example shows how to generate the signature from a raw private key
// Signing using hardware wallets such as Ledger or Trezor can be done using their documentation
const ethUtils = require('ethereumjs-utils')
const privKey = /* Your Private Key */
const nonce = ((Date.now() / 1000) + 350) + ''
const hash = ethUtils.hashPersonalMessage(ethUtils.toBuffer(nonce.toString(16)))
const signature = ethUtils.ecsign(hash, privKey)
const response = await efx.contract.unlock(token, amount, nonce, signature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment