bitcoinjs/bitcoinjs-lib — pull request #303 by dcousens (2014-10-19 01:33:55+00:00)
Title: scripts: add dataOutput convenience function

As the title says.

The script is very simple to build, so I'm not 100% whether this is necessary.

Example 1:
``` javascript
var tx = new bitcoin.TransactionBuilder()

var data = new Buffer('cafedeadbeef', 'hex')
var dataScript = bitcoin.scripts.dataOutput(data)

tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0)
tx.addOutput(dataScript, 1000)
// ...
```

Example 2:
``` javascript
var tx = new bitcoin.TransactionBuilder()

var data = new Buffer('cafedeadbeef', 'hex')
var dataScript = bitcoin.Script.fromChunks([bitcoin.opcodes.OP_RETURN, data])

tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0)
tx.addOutput(dataScript, 1000)
// ...
```

Personally, the second is as clear, but, I feel like the complexity surrounding this functionality is already high enough that perhaps this is OK.
Thoughts?