From 43b11d62fff0776e2714fbd5887d5c3098e10c1a Mon Sep 17 00:00:00 2001 From: skyge <18844062006@163.com> Date: Thu, 27 Jun 2019 09:39:19 +0800 Subject: [PATCH] U Update the document of `sendSignedTransaction`. --- docs/web3-eth.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index d634b2f5c3d..6290a494081 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 = 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. + ------------------------------------------------------------------------------