examples/run-transactions-complete/index.js
function runTx (raw, cb) {
  // create a new transaction out of the json
  var tx = new Transaction(raw)

  // tx.from
  tx.sign(Buffer.from(keyPair.secretKey, 'hex'))

  console.log('----running tx-------')
  // run the tx \o/
  vm.runTx({
    tx: tx
  }, function (err, results) {
    createdAddress = results.createdAddress
    // log some results
    console.log('gas used: ' + results.gasUsed.toString())
    console.log('returned: ' + results.vm.return.toString('hex'))
    if (createdAddress) {
      console.log('address created: ' +
          createdAddress.toString('hex'))
    }

    cb(err)
  })
}
function runTx (raw, cb) {
  // create a new transaction out of the json
  var tx = new Transaction(raw)

  // tx.from
  tx.sign(Buffer.from(keyPair.secretKey, 'hex'))

  console.log('----running tx-------')
  // run the tx \o/
  vm.runTx({
    tx: tx
  }, function (err, results) {
    createdAddress = results.createdAddress
    // log some results
    console.log('gas used: ' + results.gasUsed.toString())
    console.log('returned: ' + results.vm.return.toString('hex'))
    if (createdAddress) {
      console.log('address created: ' +
          createdAddress.toString('hex'))
    }

    cb(err)
  })
}
runs a transaction through the vm