Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes

TypeError: EthereumTransaction is not a constructor

This is happening because ethereumjs-tx library has changed its syntax. This is the working version of your code: const EthereumTx = require('ethereumjs-tx').Transaction var Web3 = require('web3') ...
Rael Gugelmin Cunha's user avatar
7 votes

Expected private key to be an Uint8Array with length 32

I had this error because I hadn't removed 0x from the prefix of the private key.
David's user avatar
  • 171
5 votes
Accepted

Unable to Generate Same Account from MetaMask Mnemonic in EthereumJSWallet

This code will generate the same address from the mnemonic that MetaMask, MyEtherWallet, etc const bip39 = require('bip39'); const hdkey = require('ethereumjs-wallet/hdkey'); const mnemonic = 'party ...
Ismael's user avatar
  • 30.5k
4 votes

What is the networkid and chain id of truffle cli?

To answer the title directly, the chain_id of ganache is 0x539 (or 1337).
Peteris's user avatar
  • 1,005
4 votes
Accepted

ganache-cli doesn't have enough funds to send tx – number increases proportionally to however much I initialize a wallet with

You're calling getBalance, which returns the amount of ether (in wei) that the account holds. You're then passing that amount in the value field of the transaction, so the transaction is going to ...
user19510's user avatar
  • 28.1k
4 votes

RangeError: private key length is invalid (In New ETH Transaction pragmatically)

Answer to my question //Admin's eth Address ------------ const account1 = process.env.ADMIN_ETH_ADDR; //Admin's eth private key ----------------- const ac1_pvtkey = Buffer.from(process.env....
Vishal Dalve's user avatar
4 votes

Proper Transaction Signing

I don't know if that's a proper way of sending a raw transaction, but it works. Just tested it. const Web3 = require('web3'); const Tx = require('ethereumjs-tx'); const config = require('./config'); ...
manidos's user avatar
  • 4,298
3 votes
Accepted

Raw transaction structure

You may want to try using the "unsign()" function in the ethereumjs-tx-sign library to inspect all the data contained in each of your raw transaction values.. and compare the contents. You may find ...
Etherer's user avatar
  • 237
3 votes

How to get all the contracts deployed by a specific ethereum address?

You can just use Etherscan explorer. For example: You want to analyze the account 0x058251232C086247cA91998472245D8Ae213666c. 1.Search this address in Etherscan and you will get this: https://...
lixq's user avatar
  • 89
3 votes

Web3.js 1.0 sendSignedTransaction returns error: Invalid RLP

let send_add = send_public_address; let recv_add = rec_public_address; let transfer_amount = web3.toWei(data.amount, 'ether'); let nonce = web3.toHex(web3.eth.getTransactionCount(...
Puneet Kumar's user avatar
3 votes

Proper Transaction Signing

Well, I have finally found the answer to all of those problems, as was stated before the nonce was at fault here, except it is kind subtle. Every transaction you send with an account you are supposed ...
Alex Triquet's user avatar
3 votes
Accepted

Transactions stuck at pending on ropsten test net from one day

Your gas price is too low. You can check over here for an "estimate", currently 2 gwei as I write: https://ropsten-stats.parity.io/ I imagine you mean to say 8 gwei but it is off by several ...
Rob Hitchens's user avatar
  • 55.3k
3 votes
Accepted

Expected private key to be an Uint8Array with length 32

This part was wrong. tx.sign(privateKey1) Fix it like this: tx.sign(privateKey1Buffer)
smarteasy's user avatar
  • 306
3 votes
Accepted

Web3js Error: transaction type not supported - How to know supported transaction type?

This error comes from a bad formatting of your transaction. In fact, it must be encoded in rlp format (serialize() function) before being sent to the node. In addition, you should change gas to ...
clement's user avatar
  • 4,322
2 votes

Can't send data to non-contract address using web3 1.0.0 and ganache

Yes, it's a bug on Ganache. If you look at the source code you'll see your error message. There's a function _transactionIsContractCall() defined on line 849 which returns true if the transaction ...
bordalix's user avatar
  • 918
2 votes

Raw transaction structure

There is quite a lot going on here so bear with me. Your raw transactions include a signature and signatures are non-deterministic, meaning that they contain a random element. This is the reason for ...
Thorkil Værge's user avatar
2 votes

RangeError: private key length is invalid (In New ETH Transaction pragmatically)

Do not use with 'Ox' Remove those in privatekey
Rama Krishna-RK's user avatar
2 votes
Accepted

Problem with sending ERC20 token using [email protected]

The transaction is being sent to the address 0x19149798f777a3d738777334ccbf0063a04fca3b, which is not a contract. No ERC20 transfer occurs because no transaction was sent to an ERC20 token contract.
user19510's user avatar
  • 28.1k
2 votes
Accepted

Transaction being reverted by EVM during contract creation (Web3 / ethereumjs-tx)

The transaction does not have a "to" so the EVM will try to deploy a new contract using the data field as bytecode. You are sending in the data field the following: ...
Ismael's user avatar
  • 30.5k
2 votes
Accepted

Error: types/values length mismatchProblem when calling payable contract function with web3

contribute doesn't take any parameters, but you're trying to pass one. You probably instead wanted to call the function with no parameters but attach ether to the transaction: const txObject = { ...
user19510's user avatar
  • 28.1k
2 votes
Accepted

Trying to send signed transaction through web browser using ethereum-tx

I see two elements that could help solving your problem: You are calling new TX(txData) instead of the recommended way new EthereumTx(txParams). Now, this might be to simple different naming of ...
Thomas Vanderstraeten's user avatar
2 votes
Accepted

how to send erc20 token without using smart contract abi?

You have to encode tha call to transfer into the data field. 4 bytes function signature of transfer(address,uint256) 32 bytes address parameter right aligned filled with zero bytes on the left 32 ...
Ismael's user avatar
  • 30.5k
2 votes

Do we need to sign transaction for totalSupply also?

Function totalSupply is constant (either pure or view, in this case - view). As such, it doesn't change anything on the blockchain. Therefore, is no transaction involved here whatsoever. You just ...
goodvibration's user avatar
2 votes
Accepted

Error: "invalid sender" from web3.eth.sendSignedTransaction()

According to this issue, private blockchains are not supported by ethereumjs-tx. You have to use ethereumjs-common. So I think the problem was that, since my call to the Transaction constructor did ...
Zephyrus's user avatar
  • 350
2 votes
Accepted

How to use private blockchains in [email protected]?

You can do this way : const EthereumTx = require('ethereumjs-tx').Transaction; import Common from 'ethereumjs-common'; const customCommon = Common.forCustomChain( 'mainnet', ...
clement's user avatar
  • 4,322
2 votes

"Invalid Chain Id" on Kovan testnet

Hey you need to do this for testing on kovan const tx = new EthereumTx({ from: PK, chainId: 42, // kovan chain id to: "0x8631c939359FBb8cb336532b191ED80b20287CD1", value: ...
viraj's user avatar
  • 71
2 votes

Error while signing ethereum transaction with Private key and Infura URL

Updated code as follows: web3.eth.getTransactionCount(fromAddr).then(count => { var rawTransaction = { "from": fromAddr, "nonce": web3.utils.toHex(count+1), ...
nania's user avatar
  • 31
2 votes
Accepted

I'm getting 'error: exceeds block gas limit' despite my gas limit being very low

You are misunderstanding what gas is. It is not a value in Wei, it is a measurement unit of its own, related to the computational cost of the various instructions supported by the EVM. 1 gas is not ...
hroussille's user avatar
  • 7,721
2 votes
Accepted

prove transactionHash of block using ethereumjs-tx and merkle-patricia-tree

My error was using @ethereumjs/trie's SecureTrie class instead of Trie the above code works now
Andreas Dilaveris's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible