React native &引用;无效发送者“;通过infura向Ropsten发送rawTransaction时的消息
我正试图通过infura将交易发送到Ropsten网络。 这些是我在React原生项目中使用的库 我已经为此奋斗了几个星期。请告知。 有人建议我应该在事务消息中实现r,v,s。我不确定这是否能解决问题,我怎样才能得到r,v,sReact native &引用;无效发送者“;通过infura向Ropsten发送rawTransaction时的消息,react-native,web3js,React Native,Web3js,我正试图通过infura将交易发送到Ropsten网络。 这些是我在React原生项目中使用的库 我已经为此奋斗了几个星期。请告知。 有人建议我应该在事务消息中实现r,v,s。我不确定这是否能解决问题,我怎样才能得到r,v,s var count = web3.eth.getTransactionCount(fromAddress,'pending', (error, nounce) => { console.log('This is the nouce'+ web3.toHe
var count = web3.eth.getTransactionCount(fromAddress,'pending', (error, nounce) => {
console.log('This is the nouce'+ web3.toHex(nounce))
var data = _myContract.transfer.getData(toAddress, 10000);
var gasPrice = 1;
var gasLimit =3000000;
const chain_id =3;
const gas = 21000;
var rawTransaction = {
"from": fromAddress,
"nonce": web3.toHex(nounce),
"gasPrice": web3.toHex(gasPrice),
"gasLimit": web3.toHex(gasLimit),
"to": toAddress,
"value":'0x00',
"data": data,
"chainId": chain_id,
"gas":gas
};
var privKey = new Buffer('key', 'hex');
var tx = new Tx(rawTransaction);
tx.sign(privKey);
var serializedTx = tx.serialize();
console.log('RawTransaction :' + '0x' + serializedTx.toString('hex'))
web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
if (!err)
console.log(hash);
else
console.log(err);
});
})