Created
February 3, 2017 05:58
-
-
Save esell/66b7c22fefb92c19851c968b749da47a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var Web3 = require('web3'); | |
var web3 = new Web3(); | |
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); | |
var fromAddress = "0x9e9e6b41a1959325371fd9a8c47ad5b5d761dbe7"; | |
// md5 hash of a file | |
var code = "27c7650985ca463499b9e3e21bee20e7"; | |
var hexCode = web3.toHex(code); | |
// just trying to put the md5 from above onto the blockchain | |
web3.eth.sendTransaction({from: fromAddress, data: hexCode, gas: 3141592}, function(err, address) { | |
if (!err) { | |
console.log(address); | |
} else { | |
console.log(err); | |
} | |
}); | |
/* | |
with gas: 3141592 the following error comes back | |
Error: VM Exception while processing transaction: stack underflow | |
at Object.InvalidResponse (/Users/esell/node_modules/web3/lib/web3/errors.js:35:16) | |
at /Users/esell/node_modules/web3/lib/web3/requestmanager.js:86:36 | |
at XMLHttpRequest.request.onreadystatechange (/Users/esell/node_modules/web3/lib/web3/httpprovider.js:118:13) | |
at XMLHttpRequestEventTarget.dispatchEvent (/Users/esell/node_modules/xhr2/lib/xhr2.js:64:18) | |
at XMLHttpRequest._setReadyState (/Users/esell/node_modules/xhr2/lib/xhr2.js:354:12) | |
at XMLHttpRequest._onHttpResponseEnd (/Users/esell/node_modules/xhr2/lib/xhr2.js:509:12) | |
at IncomingMessage.<anonymous> (/Users/esell/node_modules/xhr2/lib/xhr2.js:469:24) | |
at emitNone (events.js:91:20) | |
at IncomingMessage.emit (events.js:185:7) | |
at endReadableNT (_stream_readable.js:974:12) | |
without the gas set this error comes back: | |
Error: Error: base fee exceeds gas limit | |
at runCall (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/runTx.js:111:17) | |
at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:3686:9 | |
at replenish (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:882:17) | |
at iterateeCallback (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:867:17) | |
at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:840:16 | |
at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:3691:13 | |
at apply (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:21:25) | |
at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:56:12 | |
at Object.async.eachSeries (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async-eventemitter/node_modules/async/lib/async.js:130:20) | |
at VM.AsyncEventEmitter.emit (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:9) | |
at Object.InvalidResponse (/Users/esell/node_modules/web3/lib/web3/errors.js:35:16) | |
at /Users/esell/node_modules/web3/lib/web3/requestmanager.js:86:36 | |
at XMLHttpRequest.request.onreadystatechange (/Users/esell/node_modules/web3/lib/web3/httpprovider.js:118:13) | |
at XMLHttpRequestEventTarget.dispatchEvent (/Users/esell/node_modules/xhr2/lib/xhr2.js:64:18) | |
at XMLHttpRequest._setReadyState (/Users/esell/node_modules/xhr2/lib/xhr2.js:354:12) | |
at XMLHttpRequest._onHttpResponseEnd (/Users/esell/node_modules/xhr2/lib/xhr2.js:509:12) | |
at IncomingMessage.<anonymous> (/Users/esell/node_modules/xhr2/lib/xhr2.js:469:24) | |
at emitNone (events.js:91:20) | |
at IncomingMessage.emit (events.js:185:7) | |
at endReadableNT (_stream_readable.js:974:12) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment