Невозможно отправить эфир на счет

Я пытаюсь отправить ehter, используя этот код

  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"});
    });

я продолжаю получать

error: unknown account

Но я явно добавляю кошелек отправителя в этой части

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

Что не так с кодом?

Могу ли я отправить эфир без sendSignedTransaction или других методов?

Какой лучший (и самый простой) способ отправки эфира, когда у вас есть закрытый ключ с использованием web3 ??

Спасибо

РЕДАКТИРОВАТЬ 1 Аккаунт был создан с использованием

web3.eth.accounts.create();
Как вы создали учетную запись владельца? какую команду вы использовали?

Ответы (1)

Отвечая на свой вопрос, я нашел решение, используя этот код

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});
   })