bitcoinjs-lib: Invalid transaction builder output section

I am using bitcoinjs-lib@4.0.1 with Vue,js in browser (Chrome, Firefox) and trying to build transaction.

The following sample code: create a 1-to-1 Transaction

Returns this transaction hex: 01000000019d344070eac3fe6e394a16d06d7704a7d5c0a10eb2a2c16bc98842b7cc20d561000000006d00483045022100c766a1ed287200afceaa6895e24c7e75369500be34ecf2a0c6f584e643a28e46022050a43b8fb6726397422521646df07197d4360ea09c6d66c9d6e389d51701cbfb010021029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01e02e0000000000001a0000001406afd46bcdfd22ef94ac122aa11f241244a37ecc000000000000

Which has invalid outputs format. And is not equal to sample transaction builder result.

Is this a bug in bitcoinjs-lib code, or something wrong with my environment?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

@smdmitry the runkit issue is unrelated to your issue, and is easily resolved by telling npm to install tiny-secp256k1

Please tell us how to use vue.js? How to use the code example you gave us?

Give us a link to a project and a list of steps on how to reproduce the error.

It appears that you broke something from version 3.3.2. 4.0.1 version does not run on runkit: https://npm.runkit.com/bitcoinjs-lib But 3.3.2 version runs ok and produces expected transaction.

@dcousens @junderw, thanks, problem solved. Bitcoin-ops package package uses a json file. Our webpack config used file-loader.

{ test: /\.(png|woff|woff2|eot|ttf|jpg|gif|svg|json)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }

and in this line var OPS = require('./index.json') file-loader returned path to file, not its contents. In the future, if we need to use json files, there will be problems again. Maybe all the same the OPS constans are to be moved to map.js, then people will not depend on their loaders?

you broke something

write a test that breaks and we’ll look into it.

we support node v6 v8 v9 v10 all the tests pass.