57
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 ...
24
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 ...
19
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-...
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)....
16
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 ...
eth♦
- 86.3k
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:
...
13
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 ...
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....
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. ...
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....
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').
10
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;
}
...
9
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 ...
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 ...
9
votes
Accepted
How to construct a raw Ethereum transaction from transaction data
A raw transaction is just all the transaction parameters encoded in the RLP format. A raw transaction consists of (in this order):
Nonce;
Gas price;
Gas limit;
To address;
Value;
Data.
You don't ...
8
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 ...
eth♦
- 86.3k
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", // ...
8
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 = '...
8
votes
Building a raw contract transaction with ethers.js
You can use the populateTransaction mechanism documented here: https://docs.ethers.io/v5/api/contract/contract/
So specifically, that'd be:
const data = await myContract.populateTransaction.myFunction(...
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 ...
7
votes
How to decode a raw transaction in Python?
Previous answer is great and works but if you want a shorter code using only 3rd libraries, you can do this:
import rlp
from eth_typing import HexStr
from eth_utils import to_bytes
from ethereum....
6
votes
Get raw transaction from hash
There is an "undocumented" method eth_getRawTransactionByHash from JSON-RPC
curl -H "Content-Type: application/json" -X POST --data \
'{"jsonrpc":"2.0","method":"eth_getRawTransactionByHash","params":...
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.
...
6
votes
Accepted
Signing a raw transaction in Go
You can use two methods to obtain the raw transation RLP
Get the String() of the signed transaction. You can invoke it directly, or let the fmt library do it for you:
my_string_var = signed_tx....
6
votes
How to decode input data from tx using python3?
If you know the contract ABI, call data could be decoded using pyethereum:
from ethereum.abi import (
decode_abi,
normalize_name as normalize_abi_method_name,
method_id as ...
6
votes
Accepted
What is chainID? Raw transaction from myEther wallet
The chainid was added about 1 year ago in order to prevent replay attacks across channels. This was due to the ETH / ETC fork, but also applies to testnet and alternate chains (like Expanse). Here you ...
6
votes
Accepted
send raw transaction without knowing nonce
The nonce is part of the transaction data, so it contributes to the transaction hash, which is what you sign with the private key.
So you need to know the nonce you want to use before signing the ...
6
votes
Accepted
How to decode a raw transaction in Python?
Code:
from dataclasses import asdict, dataclass
from pprint import pprint
from typing import Optional
import rlp
from eth_typing import HexStr
from eth_utils import keccak, to_bytes
from rlp.sedes ...
5
votes
Create and sign OFFLINE raw transactions?
I wrote an complete Python code. Feel free to use:
def signTransaction(to, value, privkey, nonce=0, gasPrice=20000000000, gas=21000, data=""):
from ethereum import transactions
import rlp
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
raw-transaction × 267transactions × 96
web3js × 55
go-ethereum × 36
signature × 28
sendrawtransaction × 17
json-rpc × 14
nonce × 13
solidity × 12
ethereumjs-tx × 12
contract-invocation × 11
javascript × 11
gas × 10
web3.py × 9
ethereumjs × 9
ethers.js × 9
rlp × 9
tokens × 8
ether × 8
metamask × 8
python × 8
abi × 8
pending-transactions × 8
infura × 7
hash × 7