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
Buffer to String Node.js

I am using Avalanchejs a Javascript SDk to generate an address. After installing all dependencies and running the code. I get a new address, but the address shows up in a format. I tried to use the Buffer.from('xxx') method and then toString(). But it did not work. How can I convert the into a string ?

JS code:

const avalanche = require("avalanche")
const { Avalanche, BinTools, Buffer, BN } = require("avalanche")

const bintools = BinTools.getInstance()

const myNetworkID = 12345 //default is 1, we want to override that for our local network
const avalancheX = new Avalanche("localhost", 9650, "http", myNetworkID)
const xchain = avalancheX.XChain() //returns a reference to the X-Chain used by AvalancheJS

const myKeychain = xchain.keyChain()
const newAddress1 = myKeychain.makeKey() 
console.log(newAddress1.pubk)
var buf = newAddress1.pubk;
console.log(buf.toString());

Terminal Output:

<Buffer 03 cd ab 4d e6 7d ee c5 9f c6 0d 27 e8 3b d2 da ee 84 ce f3 77 20 70 c9 8d 66 47 c7 36 91 ec 1f 07>
'�;������w pɍfG�6��
about 4 years ago · Juan Pablo Isaza
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!