Skip to main content
Bumped by Community user
Bumped by Community user
added 88 characters in body
Source Link
Bill
  • 291
  • 2
  • 10

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just don't get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

Would something like this do the job?

var crypto = require('crypto'),
biguint = require('biguint-format')

function random(qty) {
const myUint64 return= biguint(crypto.randomBytes(qty)
}

console.log(biguint.format(random(64), 'hex', { prefix: '0x' })); 

// myUint64 = 0x748eba3cfdc84c0d9ecd86a4878c7291649abee4c93417226af3ed2f31ec6e81c4ebafc770f77eb9aefec1662fc7fbb70e4b855589ef976d1ff88b88652a2262

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just don't get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

Would something like this do the job?

var crypto = require('crypto'),
biguint = require('biguint-format')

function random(qty) {
  return crypto.randomBytes(qty)
}

console.log(biguint.format(random(64), 'hex', { prefix: '0x' }))

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just don't get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

Would something like this do the job?

var crypto = require('crypto'),
biguint = require('biguint-format')

const myUint64 = biguint(crypto.randomBytes(64), 'hex', { prefix: '0x' }); 

// myUint64 = 0x748eba3cfdc84c0d9ecd86a4878c7291649abee4c93417226af3ed2f31ec6e81c4ebafc770f77eb9aefec1662fc7fbb70e4b855589ef976d1ff88b88652a2262
added 275 characters in body
Source Link
Bill
  • 291
  • 2
  • 10

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just dontdon't get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

Would something like this do the job?

var crypto = require('crypto'),
biguint = require('biguint-format')

function random(qty) {
  return crypto.randomBytes(qty)
}

console.log(biguint.format(random(64), 'hex', { prefix: '0x' }))

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just dont get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs.

Do I need to use a library like big number https://www.npmjs.com/package/big-number or or int64 https://github.com/broofa/node-int64 Ive read the docs and i just don't get it?

Do I then need to convert the number to hex before I send it to the contract?

Is there some library that will just give me a random uint64 ready to fire of to an EOS contract?

Would something like this do the job?

var crypto = require('crypto'),
biguint = require('biguint-format')

function random(qty) {
  return crypto.randomBytes(qty)
}

console.log(biguint.format(random(64), 'hex', { prefix: '0x' }))
added 138 characters in body
Source Link
Bill
  • 291
  • 2
  • 10
Loading
Source Link
Bill
  • 291
  • 2
  • 10
Loading