I run ganache, truffle and metmask. If I run the code below I get an error on the this.web3.eth.sendSignedTransaction() function:
EDIT: changed my code to the following.. Error remained the same though.
const tx_builderencoded_tx = this.contract.methods.createCountry("NL", 100, 100, 100000000, this.account).encodeABI();
const encoded_txnonce = tx_builderawait this.encodeABIweb3.eth.getBlockTransactionCount(this.account);
const transactionObjectrawTx = {
gasnonce: 3000000this.utils.toHex(nonce),
datagasLimit: encoded_txthis.utils.toHex(3000000),
valuegasPrice: this.utils.toHex(this.utils.toWei('20', 'gwei')),
data: 0encoded_tx,
from: this.account,
to: this.contractAddress
};
let tx = new Tx(rawTx);
this.web3.eth.accountstx.signTransactionsign(transactionObject, this.pvtKey);
.then(signedTxlet =>serializedTx this.web3.eth= tx.sendSignedTransactionserialize(signedTx.rawTransaction));
this.thenweb3.eth.sendSignedTransaction(receipt'0x' =>+ consoleserializedTx.logtoString("Transaction receipt: ", receipt'hex'))
.catchon(err =>'receipt', console.error(err)log);
The error is the following:
index.js:2178 Error: Returned error: {"id":6,"jsonrpc":"2.0","error":{"code":-32603}}
at Object.ErrorResponse (errors.js:29)
I have absolutely no idea where to look anymore and feel like I've tried everything, might it have anything to do with the fact that I'm connected to metamask? When I try to send this transaction through metamask with eth.method.send() the transaction does not give an error and behaves as expected.