45 votes
Accepted

error: replacement transaction underpriced

I have been running into this issue as well. The network thinks you are trying to replace an existing unmined transaction. There are two ways to avoid this: Adding a gas price %10 higher than the ...
user avatar
  • 590
36 votes
Accepted

What is the ethereum transaction data structure?

An Ethereum transaction - as in, what you pass to sendRawTransaction() - consists of the following fields, in order and RLP-encoded (note that the field names are not part of the encoded data): nonce ...
user avatar
  • 1,166
28 votes
Accepted

Create and sign OFFLINE raw transactions?

ethereumjs-tx is a library with this example: npm install ethereumjs-tx const Tx = require('ethereumjs-tx').Transaction var privateKey = new Buffer('...
user avatar
  • 78.8k
21 votes

error: replacement transaction underpriced

Define the Goal Do you want to: Send a new transaction, after all your previous transactions have completed, or... Replace a pending (unmined) transaction, with the new raw transaction. Send a New ...
user avatar
  • 6,141
18 votes
Accepted

How to properly create a raw transaction and sign it using web3 in browser

Below is working code that calls "increment" on https://programtheblockchain.com/dapps/counter. (More info about that sample here: https://programtheblockchain.com/posts/2017/12/13/building-...
user avatar
  • 26.7k
18 votes

How to properly create a raw transaction and sign it using web3 in browser

Using Web3.js 1.0.0 encoded = contractInstance.methods.myMethod(params).encodeABI() var tx = { to : myContractAddress, data : encoded } web3.eth.accounts.signTransaction(tx, privateKey)....
user avatar
  • 869
16 votes
Accepted

How to get raw ethereum transaction hash

Ok, so asked it a couple of minutes too soon. As the name implies it's a hash, hash of what? Hash of your raw hex in example: ...
user avatar
  • 359
15 votes
Accepted

Difference between transactions and raw transactions in web3.js

All transactions need to be signed. Otherwise they are considered invalid transactions and will not be included in the blockchain. A raw transaction is a transaction in raw bytes. If one has the ...
user avatar
  • 78.8k
14 votes
Accepted

Is there any safe way to send money from a cold wallet, using an untrusted computer?

We at MyEtherWallet.com implemented an offline transaction tool to do exactly this. While most people who are cold-storage fanatics know command line and the inner-workings of gas price and nonce, ...
user avatar
  • 15.3k
14 votes
Accepted

How to get the transaction confirmations using the JSON RPC

When you send a transaction, you will receive back a transaction hash. Use the command getTransactionByHash({transaction hash}) to retrieve the transaction details. Your blockNumber should be non-...
user avatar
13 votes

Create and sign OFFLINE raw transactions?

In Go creating a signed transaction would look something like this: transaction := types.NewTransaction(nonce, recipient, value, gasLimit, gasPrice, input) signature, _ := crypto.Sign(transaction....
user avatar
13 votes
Accepted

What is the networkid and chain id of truffle cli?

You can get both using the web3 instance of web3.js: const networkId = await web3.eth.net.getId(); const chainId = await web3.eth.getChainId();
user avatar
12 votes

Is there any safe way to send money from a cold wallet, using an untrusted computer?

I've set something like this up myself. I've bought a silly simple laptop which runs a node which for obvious reasons it isn't connects to the network and has never been online. I use this device to ...
user avatar
  • 1,899
12 votes
Accepted

What is a "raw transaction" and what is it used for?

A transaction as defined in the Yellow Paper section 4.3 it consist of several fields (like gasPrice, value, etc). To store them in the blockchain they are encoded using the Recursive Length Prefix ...
user avatar
  • 29.6k
11 votes

Using web3 to sign a transaction without connecting to geth

Not in web3.js. EDIT: As answered by @Andromelus, web3js 1.0 can do it with the following function: web3.eth.accounts.signTransaction(tx, privateKey [, callback]); There are other libraries such as, ...
user avatar
  • 78.8k
11 votes

Create and sign OFFLINE raw transactions?

You can use Web3. var Accounts = require('web3-eth-accounts'); // Passing in the eth or web3 package is necessary to allow retrieving chainId, gasPrice and nonce automatically // for accounts....
user avatar
10 votes
Accepted

sendRawTransaction results in queued TXs

If the transaction is queued but not executable, that means that there's a nonce gap between your latest executed transaction and the next in line that's waiting to run. If you pull in a develop ...
user avatar
10 votes
Accepted

How do I set the nonce for raw transactions?

A raw transaction is the RLP encoded value of a signed transaction, i.e. everything included as defined by the yellow paper page 4, section 4.2 Nonces must already be included in the raw transaction, ...
user avatar
10 votes
Accepted

Get raw transaction from hash

There is eth.getRawTransaction(<txhash>) now. Edit: Please check that you're using an up-to-date version of geth. It's part of the current release (v.1.8.6) and was introduced some time ago. ...
user avatar
  • 304
10 votes
Accepted

Sign a raw transaction with Metamask or Mist

In Ethereum, a "raw transaction" is one that has been signed, so you don't sign raw transactions, you sign transactions, and you submit them to the blockchain. Both Mist and MetaMask inject the web3....
user avatar
  • 2,602
10 votes
Accepted

web3.eth.sendRawTransaction: cannot unmarshal hex string without 0x prefix

As mentioned in the comments, add a 0x to your serializedTx.toString('hex').
user avatar
  • 1,583
9 votes

When are “pending” transactions dropped from the blockchain?

All transactions are kept in the Mempool a term borrowed from Bitcoin. You can see all the current pending transactions here: Pending Transactions There's a limit to the size of the Mempool and once ...
user avatar
  • 605
8 votes

Create and sign OFFLINE raw transactions?

I found a way using the pyethereum lib. BTW, this lib has little maintenance and doesn't build in most OS's. Here's the sample code for that: from libs.pyethereum.ethereum import transactions from ...
user avatar
  • 807
8 votes
Accepted

Can not send eth on Ropsten using Infura node

This looks mostly correct, but there are a couple optional tx parameters that might make the difference: // EIP 155 chainId - mainnet: 1, ropsten: 3 chainId: 3, gasPrice: "0x9184e72a000", // ...
user avatar
  • 2,602
7 votes
Accepted

Can't Broadcast ethereum transaction, what's wrong with this transaction?

The problem I found was that Parity had skipped a nonce, so that the next nonce was actually "0xa", but Parity decided to put "0xb" into the transaction. To resolve this I created another transaction ...
user avatar
7 votes
Accepted

Can I deploy a contract to an arbitrary address that I choose?

Contracts can't be deployed to an arbitrary user specified address. New contracts are created by the CREATE opcode in the EVM which implements the rules and doesn't have a parameter for the address ...
user avatar
  • 78.8k
7 votes

Get the balance of an ERC20 token at an Ethereum address

You are nearly there with your payload, only the function ID for balanceOf is wrong. Calculating the Function Selector From the Solidity docs: The first four bytes of the call data for a function ...
user avatar
  • 6,141
7 votes

Given only a raw transaction, how can I determine the from address that signed it?

Here's some working code using ethereumjs-tx: const EthereumTx = require('ethereumjs-tx').Transaction; const raw = '...
user avatar
  • 26.7k
7 votes
Accepted

How to create a RawTransaction for contract interaction Web3j

Let's take for example the following simple storage contract: pragma solidity ^0.5.6; contract SimpleStorage { uint storedData; function set(uint x) public { storedData = x; } ...
user avatar
6 votes

Error: Known Transaction

if your problem is the Known Transaction Error originating from the same use of nonce from getTransactionCount, you can use the transaction count with the pending transaction count for your nonce. ...
user avatar

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