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

597
Views
Error: Warning: pack(): 1 arguments unused

Hi i want to send transaction with createTx function. When the value is higher than 4294967296 i got an error Error: Warning: pack(): 1 arguments unused, if number is lower the transaction completes ok.

When using a rather large number (4295) which translates in 4295000000 HASH fails when sending a transaction.

This is because of the pack method arguments that are used in case the value is >= 4294967296 pack would be called like pack('@', 4295000000) which gives the warning

The code which translates is here:

    function binToHex(value) {
        let i, l, o = '', n;
        value += '';
        for (i = 0, l = value.length; i < l; i++) {
            n = value.charCodeAt(i).toString(16);
            o += n.length < 2 ? '0' + n : n;
        }
        return o;
    }

function intToHexHandler(firstFormat, firstValue, secondFormat, SecondValue) { return binToHex(pack(firstFormat, firstValue)) + (secondFormat ? binToHex(pack(secondFormat, SecondValue)) : ''); } 

function intToHex(value) {
  if (value < 250) return intToHexHandler('C', value);
  else if (value < 65536) return intToHexHandler('C', 250, 'v', value);
  else if (value < 4294967296) return intToHexHandler('C', 251, 'V', value);
  else return intToHexHandler('C', 252, '@', value);
}
createTx({
  to,
  value,
  fee,
  nonce,
  data = ''
}) {
  const dataHex = binToHex(data);
  const message = to.substr(2) + intToHex(value) + intToHex(fee) + intToHex(nonce) + intToHex(data.length) + dataHex;

  const hash = sha256(encHex.parse(message));
  const sign = this._keyPair.sign(hash.toString(encHex)).toDER('hex');

  return {
    to: to,
    value: String(value),
    fee: String(fee),
    nonce: String(nonce),
    data: dataHex,
    pubkey: this.publicKey,
    sign: sign
  }
}

THe pack function is here: https://github.com/xboston/metahash-js/blob/1e0caad6b18c5580c5173a77529af70b9885b8bf/dist/metahash.js#L22866

And the wallet js is here: https://github.com/xboston/metahash-js/blob/1e0caad6b18c5580c5173a77529af70b9885b8bf/src/Wallet.js

Do you have any idea what arguments need to be given to the pack method in case of hash >= 4294967296?

about 4 years ago · Santiago Trujillo
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!