Sending transaction to Azure Blockchain on Quorom Protocol giving EVM error using web3

Copper Contributor

Hello guys, please I need help with the right code snippet to send transaction/state change to the blockchain. I can make calls but sending transaction is always giving me an error. Either "unknown account" if I do just web3.eth.sendTransaction or "Error: Transaction has been reverted by the EVM: " when I use web3.eth.sendSignTransaction. Also, how do I send transactions as owner to a contract I deployed since no password was provided for the account that deployed the contract to the blockchain. I was able to get the privateKey from the mnemonic phrase generated when I connected my VSCode to the Azure Blockchain service subscription.


I also checked pending transanctions and it is 80. Why is my transactions not being mined.





web3.eth.getTransactionCount(account).then(async (txCount) => {

  try {
      let newaccount = await web3.eth.personal.newAccount('XXXXX')
      web3.eth.defaultAccount = newaccount,
      console.log("newaccount >> ", newaccount)
      let unlockedAcct = await web3.eth.personal.unlockAccount(newaccount,'XXXXX',10000)
      console.log("unlockedAcct >> ", unlockedAcct)
      const txObject = {
        nonce: txCount,
        from:  web3.eth.defaultAccount,
        to: address,
        data: functionABI,
        gasPrice: web3.utils.toHex('0'),
        gasLimit: web3.utils.toHex('3000000'),
        chainid: 1425
      let signedTxn = await web3.eth.personal.signTransaction(txObject,"XXXXX")
      console.log("signedTxn >> ", signedTxn)
      let txnHash = await web3.eth.sendTransaction( web3.eth.defaultAccount,  signedTxn.raw)
      console.log("txnHash >> ", txnHash)

      web3.eth.sendTransaction(txObject,function( transactionHash) {

        const tx = new EthereumTx(txObject)
        const serializedTx = tx.serialize()
        const raw = '0x' + serializedTx.toString('hex')

          web3.eth.sendSignedTransaction(raw, (err, transactionHash)=>{
            console.log('txHash:', transactionHash)
            console.log('Error:', err);})
      } catch (error) {
          console.log('Error ',error)





0 Replies