title: Send Raw Transaction Ethereum infura nodejs npm
body: <p>I'm currently trying to implement an ethereum Node Connection to my Typescript/ Node Project.</p>
  
  <p>I'm connection to the "Infura" node server where i need to sign my transaction locally.
  Well, anyway. I'm signing my transaction using the npm package "ethereumjs-tx" and everything looks great.
  When i'm using "sendRawTransaction" from web3 my response is an tx-id which means my transaction should be allready in the Blockchain. Well... it isn't</p>
  
  <p>My sign Transaction Function is below.
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>private signTransactionLocally(amountInWei: number, to: string, privateKey: string = &lt;PRIVATE_KEY&gt;, wallet: string = &lt;MY_WALLET&gt;) {
          const pKeyBuffer = Buffer.from(privateKey, "hex");
  
          const txParams = {
              nonce: this.getNonce(true,wallet),
              //gas: this.getGasPrice(true),
              gasLimit: this.getGasLimit2(true),
              to: to,
              value: amountInWei,
              data: '0x000000000000000000000000000000000000000000000000000000000000000000000000',
              chainId: "0x1"
          };
  
          // console.log(JSON.stringify(txParams));
          const tx = new this.ethereumTx(txParams);
          tx.sign(pKeyBuffer);
          return tx.serialize().toString("hex");
  
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Used Functions in "signTransactionLocally" : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    private getGasLimit2(hex: boolean = false) {
          const latestGasLimit = this.web3.eth.getBlock("latest").gasLimit;
          return hex ? this.toHex(latestGasLimit) : latestGasLimit;
      }
      
          private getNonce(hex:boolean = false, wallet: string = "0x60a22659E0939a061a7C9288265357f5d26Cf98a") {
          return hex ? this.toHex(this.eth().getTransactionCount(wallet)) : this.eth().getTransactionCount(wallet);
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Running my code looks like following:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>this.dumpInformations();
  const signedTransaction = this.signTransactionLocally(this.toHex((this.getMaxAmountToSend(false, "0x60a22659E0939a061a7C9288265357f5d26Cf98a") / 3 )), "0x38bc48f1d19fdf7c8094a4e40334250ce1c1dc66" );
          console.log(signedTransaction);
          
  this.web3.eth.sendRawTransaction("0x" + signedTransaction, function(err: any, res: any) {
              if (err)
                  console.log(err);
              else
                  console.log("transaction Done=&gt;" + res);
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>since sendRawTransaction results in console log:
  [Node] transaction Done=>0xc1520ebfe0a225e6971e81953221c60ac1bfcd528e2cc17080b3f9b357003e34</p>
  
  <p>everything should be allright. </p>
  
  <p>Has anybody had the same problem? 
  i Hope that someone could help me. Have a nice day!</p>