1

I'm struggling to deploy a contract. You can see the errors, out of gas, from the following link.

https://ropsten.etherscan.io/address/0xbddf0bf3ac858d7fb8a2bdda55884d61779ba5a9

My current problem is that after I changed gas price and gas limit, then deploying tx does not showed in mempool on etherscan and eth.getBlock('pending') in my own node. If I deploy the same one, I got "Error: known transaction: 6704c99361ed51168d983c9e53f479c51456d769d27cdb4be05cac6af3b53db0"

What status is this? my tx is valid but refused for some reason..?

deploying js

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://xxx:xxx"));

var Tx = require('ethereumjs-tx');
var privateKey = new Buffer('xxx', 'hex')
var gasPrice = web3.toHex(21000000000);
var gasLimit = web3.toHex(315000);

var rawTx = {
  nonce: '0x08',
  gasPrice: gasPrice,
  gasLimit: gasLimit,
  data: '606060405260008055341561001357600080fd5b5b60d6806100226000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14604757806387db03b714606d575b600080fd5b3415605157600080fd5b6057608d565b6040518082815260200191505060405180910390f35b3415607757600080fd5b608b60048080359060200190919050506097565b005b6000805490505b90565b8060008082825401925050819055505b505600a165627a7a723058207e968ad53b91047ab71334a49530112b3725aaa27d9c6d3860da0bcf09c5c16d0029'
}

var tx = new Tx(rawTx);
tx.sign(privateKey);

var serializedTx = tx.serialize();

console.log('0x' + serializedTx.toString('hex'));

web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
  if (!err) {
    console.log(hash); // 0x6704c99361ed51168d983c9e53f479c51456d769d27cdb4be05cac6af3b53db0
  } else {
    console.log(err);
  }
});

Update 1

Not only contract transactions but normal eth send transactions are also not confirmed and not showed even txsPending and eth.getBlock('pending') Before, I succeed some deployings.. why suddenly failed. I restarted geth but still it doesn't work.


Update 2

I did broadcast a signed transaction from https://ropsten.etherscan.io/pushTx instead of my own eth server. However, it is not showed https://etherscan.io/txsPending

Output Singed Transaction

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://xxx:xxx"));

var Tx = require('ethereumjs-tx');
var privateKey = new Buffer('xxx', 'hex')
var gasPrice = web3.toHex(21000);
var gasLimit = web3.toHex(21000);
var value = web3.toHex(web3.toWei('0.01', 'ether'));
var nonce = '0x' + new Date().getTime();

var rawTx = {
  nonce: nonce,
  gasPrice: gasPrice,
  gasLimit: gasLimit,
  to: '0x8005ceb675d2ff8c989cc95354438b9fab568681',
  value: value
}

console.log(rawTx); // { nonce: '0x1500343943896', gasPrice: '0x5208', gasLimit: '0x5208', to: '0x8005ceb675d2ff8c989cc95354438b9fab568681', value: '0x2386f26fc10000' }

var tx = new Tx(rawTx);
tx.sign(privateKey);

var serializedTx = tx.serialize();

console.log('0x' + serializedTx.toString('hex')); // 0xf86f8701500343943896825208825208948005ceb675d2ff8c989cc95354438b9fab568681872386f26fc10000801ba08f068d20de9dc0789533fb7a220258ae4c3080620a6e57ac766568ee490ce4e6a02b2b5cc7d79c4a5ba60488b255bcd4d12ce1dc05a4ab9d5d1ce74e181a7c66d5

Update 3

I can see submitted transaction log in the geth log file

Jul 18 02:29:53 hostname geth[29706]: INFO [07-18|02:29:53] Submitted transaction                    fullhash=0x03d47a58f96c7440b28683f0c1005cc6704ed68f450bf5b60d14384f9ae6b429 recipient=0x8005ceb675d2ff8c989cc95354438b9fab568681

Update 4

I created a signed transaction on MyEtherWallet.com then broadcast it from my own node. It works.

var a = '0xf86b018504e3b29200825208948005ceb675d2ff8c989cc95354438b9fab568681872386f26fc10000802aa0c70e5c84161bfe30af393908cefcf36dd2a39dfc377580099ae75ee195d7b151a0090e361841b65c6bcbc115dd76860f3b2674f9a156cfdf13ae05016d486c2268';
web3.eth.sendRawTransaction(a, function(err, hash) {
  if (!err) {
    console.log(hash);
  } else {
    console.log(err);
  }
});

Raw Transaction

{"nonce":"0x01","gasPrice":"0x04e3b29200","gasLimit":"0x5208","to":"0x8005cEb675D2FF8c989CC95354438B9Fab568681","value":"0x2386f26fc10000","data":"","chainId":3}

https://ropsten.etherscan.io/tx/0xd623ab936190ade831160282fc408b08324524485cef7d6e17e6aa809c2d1ead


Update 5

Problem solved. I'm still not clear about the reason. Might be gasPrice issue..

I changed:

(1)change source address

(2)add data:''

(3)add chainId: 3

(4)change gasPrice, gasLimit and value (these are same value as I created a tx on MyEtherWallet.com)

var Tx = require('ethereumjs-tx');
var privateKey = new Buffer('xxx', 'hex')

var rawTx = {
  nonce: '0x02',
  gasPrice: '0x04e3b29200',
  gasLimit: '0x5208',
  to: '0x8005ceb675d2ff8c989cc95354438b9fab568681',
  value: '0x2386f26fc10000',
  data: '',
  chainId: 3
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.