Skip to main content
syntax
Source Link
bguiz
  • 28.5k
  • 49
  • 165
  • 257

Create a script: convert.js

#!/usr/bin/env node import {PrivateKey} from "@hashgraph/sdk"; let hex = process.argv[2]; console.log(hex); let x = PrivateKey.fromStringED25519(hex); let der = x.toBytesDer(); let derhex = Buffer.from(der).toString('hex'); console.log(derhex); 

Run:

npm i 

Set "type": "module" in package.json Run

Run:

./convert.js 

Create a script: convert.js

#!/usr/bin/env node import {PrivateKey} from "@hashgraph/sdk"; let hex = process.argv[2]; console.log(hex); let x = PrivateKey.fromStringED25519(hex); let der = x.toBytesDer(); let derhex = Buffer.from(der).toString('hex'); console.log(derhex); 

Run:

npm i 

Set "type": "module" in package.json Run:

./convert.js 

Create a script: convert.js

#!/usr/bin/env node import {PrivateKey} from "@hashgraph/sdk"; let hex = process.argv[2]; console.log(hex); let x = PrivateKey.fromStringED25519(hex); let der = x.toBytesDer(); let derhex = Buffer.from(der).toString('hex'); console.log(derhex); 

Run:

npm i 

Set "type": "module" in package.json

Run:

./convert.js 
Source Link
Abi
  • 493
  • 6
  • 12

Create a script: convert.js

#!/usr/bin/env node import {PrivateKey} from "@hashgraph/sdk"; let hex = process.argv[2]; console.log(hex); let x = PrivateKey.fromStringED25519(hex); let der = x.toBytesDer(); let derhex = Buffer.from(der).toString('hex'); console.log(derhex); 

Run:

npm i 

Set "type": "module" in package.json Run:

./convert.js