Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

598
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda