diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index d634b2f5c3d..9e7cec8035e 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -1096,8 +1096,8 @@ Example .. code-block:: javascript - var Tx = require('ethereumjs-tx'); - var privateKey = new Buffer('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex') + var Tx = require('ethereumjs-tx').Transaction; + var privateKey = new Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex') var rawTx = { nonce: '0x00', @@ -1108,7 +1108,7 @@ Example data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057' } - var tx = new Tx(rawTx); + var tx = new Tx(rawTx, {'chain':'ropsten'}); tx.sign(privateKey); var serializedTx = tx.serialize(); @@ -1121,6 +1121,8 @@ Example > // see eth.getTransactionReceipt() for details +.. note:: When use the package `ethereumjs-tx` at the version of `2.0.0`, if we don't specify the parameter `chain`, it will use `mainnet`, so if you wan to use at the other network, you should add this parameter `chain` to specify. + ------------------------------------------------------------------------------