No se puede enviar ether a la cuenta

Estoy tratando de enviar ehter usando este código

  web3.eth.accounts.wallet.add(privateKey);
  web3.eth.sendTransaction({
          to:someAddress,
          from:onwer,
          value:amount*1,
          gasPrice:result,
          gas:21000,
          nonce:nonce
       }).
  then(function (r) {
           res.json({
                 response:r
                })
  }).catch(function(err){
         res.json({error:err.message+"unknown tx"});
    });

sigo recibiendo

error: unknown account

Pero agrego la billetera del remitente explícitamente en esta parte

 web3.eth.accounts.wallet.add(privateKeyHere);
 result is fetched from  web3.eth.getGasPrice() Promise
 nonce is fetched  web3.eth.getTransactionCount(sender_address_here) Promise

¿Qué está mal con el código?

¿Puedo enviar ether sin sendSignedTransaction u otros métodos?

¿Cuál es el mejor (y más simple) método para enviar ether cuando tienes una clave privada usando web3?

Gracias

EDIT 1 La cuenta fue creada usando

web3.eth.accounts.create();
¿Cómo creaste la cuenta de propietario? que comando has usado?

Respuestas (1)

Respondiendo a mi propia pregunta, encontré una solución usando este código.

var Web3 = require("web3");
const web3 = new Web3('http://localhost:8545');
var connection = require("../services/connection");
const axios = require('axios');
const EthereumTx = require('ethereumjs-tx');

 let response = axios.get('https://ethgasstation.info/json/ethgasAPI.json').
    then(function (response) {
       let prices = {
             low: response.data.safeLow / 10,
             medium: response.data.average / 10,
             high: response.data.fast / 10
            }
      let nonce = web3.eth.getTransactionCount(token.public).then(function (nonce) {
           let sendAmount = (prices.high * 1e9) + (prices.high * 1e8);
                let details = {
                          "to": user.public,
                          "value": sendAmount,
                          "gas": 21000,
                          "gasPrice": prices.low * 1e9,
                          "nonce": nonce,
                          "chainId": 4 //chainId - mainnet: 1, rinkeby: 4
                      }
    const transaction = new EthereumTx(details)
    transaction.sign(Buffer.from(your_pv_key_without0xprefix, 'hex'))
    const serializedTransaction = transaction.serialize()
    web3.eth.sendSignedTransaction('0x' + serializedTransaction.toString('hex')).
           then(function (transactionDetails) {
             //handle transaction details
         }).catch(function (err) {
              res.json({error: err.message});
         })
     }).catch(function (err) {
                 res.json({error: err.message});
     })
  }).catch(function (err) {
       res.json({error: err.message});
   })