web3 js envía ether sin transmitir en la red principal

Estoy usando el siguiente ejemplo de código para enviar ether entre 2 de mis propias cuentas, ambas tienen fondos suficientes:

"use strict";
var Web3 = require('web3');
var Tx = require('ethereumjs-tx');
// Show Web3 where it needs to look for a connection to Ethereum.
//web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'));
var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/N6IIa2HvDYOovtgmPbhD'));
var gasPrice = "20";//or get with web3.eth.gasPrice
var gasLimit = '42000';
var addr = "...";
var toAddress = "....";
var amountToSend = web3.utils.toWei('0.0005', 'ether'); //$1
var nonce = web3.eth.getTransactionCount(addr); //211;
var rawTransaction = {
"from": addr,
"nonce": web3.utils.toHex(nonce),
"gasPrice": web3.utils.toHex(web3.utils.toWei('9', 'gwei')),
"gasLimit": web3.utils.toHex(gasLimit),
"to": toAddress,
"value": web3.utils.toHex(amountToSend) ,
"chainId": 1 //remember to change this
};
var privateKey = "...";
var privKey = new Buffer(privateKey, 'hex');
//console.log("privKey  : ", privKey);
var tx = new Tx(rawTransaction);
tx.sign(privKey);
var serializedTx = tx.serialize();
console.log('serializedTx : '+serializedTx);
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
if (!err)
{
console.log('Txn Sent and hash is '+hash);
let userBalance = (web3.eth.getTransactionReceipt(hash));
console.log(userBalance);
userBalance.then(function(result) {
   console.log(result);
})

}
else
{
console.error(err);
}
});

sin embargo, lo que obtengo del registro de la consola es:

Txn Sent and hash is 0xab9a2265792203d787d0e08c7a808865b1d776d9a289d92ded2596c352b6e56c
Promise { <pending> }
null

esto no se actualiza en etherscan ni en ninguna parte de la red principal. Estoy bastante confundido ya que no hay ningún lugar que me diga dónde estoy equivocado. ¿Alguien sabe cómo solucionarlo?

Respuestas (1)

simplemente elimine la dirección "de" de su transacción sin procesar e intente nuevamente. Lea sobre el enlace dado. https://web3js.readthedocs.io/en/1.0/web3-eth.html#sendsignedtransaction