All Questions
Tagged with transactions web3js
63 questions
195
votes
2
answers
60k
views
What is the difference between a transaction and a call?
What is the difference between a transaction and a call? In some interfaces, I can interact with contracts via calls or via transactions. What is the difference between the two, and can contracts also ...
82
votes
13
answers
64k
views
How to get contract internal transactions
I'd like to get the contract internal transactions like:
https://etherscan.io/address/0xd654bdd32fc99471455e86c2e7f7d7b6437e9179#internaltx
I'm using web3 API. Is there any way to do it? Where do ...
43
votes
3
answers
21k
views
What are the limitations to estimateGas and when would its estimate be considerably wrong?
web3.eth.estimateGas and JSON-RPC estimateGas can be used to see how much gas should be specified for a transaction, before crafting the transaction.
Since it is an estimate, are there any ...
7
votes
3
answers
13k
views
Invalid JSON RPC response error for sendTransaction on Infura + Ropsten node + Truffle console
Calls work but transactions throw the error -
Error: Invalid JSON RPC response: ""
I am using web3 v0.19.0 & Truffle v3.4.9. Deploying contract using truffle,
truffle migrate --network ...
60
votes
6
answers
126k
views
error: replacement transaction underpriced
Im trying to send a raw transaction using web3 to ropsten testnet and Im getting this error:
replacement transaction underpriced
where sometimes my tx works and sometimes I get this error.
my tx ...
9
votes
1
answer
2k
views
Does Solidity's constant keyword do anything?
It seems that the purpose of function foo() constant {} is to indicate that a function does not change the contract's state. And yet, as it states here, the compiler doesn't actually enforce this. So ...
28
votes
2
answers
3k
views
Is it a good practice to log an event every time I throw in Solidity?
In Solidity (0.3.2) I am aware that there is no way to throw specific exceptions. (Everything is an invalid JUMP error.) It seems beneficial to have a way to log specific errors. Does it make sense to ...
23
votes
4
answers
35k
views
Unlocking accounts and making transactions in web3.js
This question is related to this one and this one. It also has a partial answer here and here.
In the third link the account is being unlocked for a period of time using web3.js:
web3.personal....
37
votes
9
answers
97k
views
How to get transactions by account using web3 js?
I'm sure this question was asked before, but I did not find any result that helped my problem.
How can I get the transactions (in and out) for a given account? I use nodejs and web3?
With this line ...
19
votes
2
answers
23k
views
ValueError: {'code': -32000, 'message': 'only replay-protected (EIP-155) transactions allowed over RPC'}
Good afternoon,
after having been developing a blockchain web app for some months, it's the first time I get this error when making a transaction.
ValueError: {'code': -32000, 'message': 'only replay-...
17
votes
1
answer
6k
views
Difference between transactions and raw transactions in web3.js
Reading the documentation of web3.js I have come across sending transactions and raw transactions.In the documentation it's specified that send raw transaction sends an already signed transaction.
...
17
votes
4
answers
50k
views
How to calculate transaction fee?
For calculating the transaction fee using web3js I am using it's gas price:
eth.getTransaction("txhash").gasPrice
multiplied by how much gas was actually used:
eth.getTransactionReceipt("txhash")....
17
votes
3
answers
16k
views
What's the proper way to wait for a transaction to be mined and get the results? [duplicate]
I'm using react to write the frontend for my dApp, and doing this to (attempt to) update react's state via an asynchronous sendTransaction call:
var thisJS = this
web3.eth.sendTransaction({from: ...
37
votes
8
answers
78k
views
Insufficient funds for gas * price + value
Sending Address has over 1 Eth in current Balance.
Using the Geth console, I can send many transactions of any amount less than .033
eth.sendTransaction({to:'...
9
votes
4
answers
6k
views
Optimal way of waiting for transactions to be mined in geth
I'm currently checking if a transaction has been mined using the following function (using web3.js):
function waitForTx(tx_hash) {
var result = null;
// This is not really efficient ...
7
votes
1
answer
3k
views
Passing ether with call to Solidity function
I have deployed a contract to testnet which appears to function.
I have a function named contribute which gets the ether from the msg.value. The function is below and doesn't take any arguments.
I ...
9
votes
1
answer
12k
views
What is the 0x I see around Ethereum? For example I see addresses that start with 0x
I see a number of things in Ethereum start with 0x, for example addresses. Other examples are in the Geth console, JSON-RPC, web3.js. What is the 0x and what is its purpose?
9
votes
4
answers
26k
views
How to use web3 to send money from wallet A to wallet B?
var myContract = web3.eth.contract(abi);
var address = contract address;
var contract_data = myContract.at(address);
var sender = '0xd3aaa525c087978133abb517593ea334f16abd1f';
var receiver = '...
5
votes
2
answers
11k
views
Get Transaction Hash And Mined Receipt
I am trying to figure out how to send a transaction to a contract method, retrieve the transaction hash automatically, and then get a receipt callback after the transaction is mined.
I am able to do ...
2
votes
1
answer
379
views
sendTransaction from iPhone app
How do I call sendTransaction from within an iPhone app?
I was thinking of running a web to Geth proxy where the iPhone app would call the Api exposed by the proxy which in turn calls my self hosted ...
2
votes
2
answers
3k
views
Can anybody Point out the Difference between Web3.eth.sendTransaction and web3.eth.signTransaction?
Do we need to sign the transaction by web3.eth.signTransaction after initiating transaction via web3.eth.sendTransaction.
for example:
when I do:
web3.eth.sendTransaction({
from: accs[0],
...
21
votes
4
answers
13k
views
Does Web3.js have the functionality to create new accounts and unlock an account for a period of time for a series of transactions?
I want to create new accounts through my Dapp web interface and unlock a specific account so that transactions can be processed. I didn't see it in the web3.js documentation so wonder if that's on the ...
8
votes
1
answer
3k
views
Private chain: Extracting the "data" from an account?
I have initiated and mined a transaction between two accounts. I also included a data field in this transaction. This is just random hex data. Here is the command:
eth.sendTransaction({from:...
8
votes
3
answers
839
views
Method overloading conflicting with transaction object
In my contract there is a buy method with 1 argument being overloaded by a 2nd one with 2 arguments:
function buy( uint id )
function buy( uint id, uint quantity )
Now I want to call the 1st method ...
7
votes
3
answers
6k
views
How do I determine whether the transaction is used for the contract creation?
I want to monitor Ethereum and memorise every contract published on the blockchain (basically the same thing that Etherscan does). How it is possible to do this using NodeJS & web3? How can I ...
7
votes
5
answers
27k
views
How to wait until transaction is confirmed web3.js?
I am new to web3. I am trying to connect UI with web3. Metamask version is 6.0.1 and web3 version injected by (don't know who), but it is 0.20.3.
Following is my code to send ethers to a function of ...
6
votes
1
answer
15k
views
Execute transaction Approve directly against contract address (without ABI)
Solved
For now, you will always need the ABI to execute a call against the ethereum network with web3. A simple way is to reconstruct the function you wish to execute is to, either create a separate ...
5
votes
3
answers
12k
views
How to get transaction failed reason with transaction hash with web3?
I'm trying to get transaction failed reason with transaction hash with web3?
I have checked getTransactionReceipt() method
{ blockHash: '...
3
votes
4
answers
2k
views
How to send transaction/call function from server-side?
After an event emits from my smart contract and I hear it server-side, I want to call a certain function in the smart contract and pass it some information to use.
I'm wondering how you place a ...
2
votes
1
answer
374
views
Sending a transaction - can I assume that when the 'data' field is missing, the 'gas' field should always be 21000?
I have implemented a function for transferring ETH from my account to another account:
async function transfer(to, value) {
let options = {
from : PUBLIC_ADDRESS,
to : to,
...
1
vote
1
answer
1k
views
Transaction receipt contains all log entries, but only the last two are decoded by web3
I have a flow which yields 4 events.
When I obtain the transaction hash via web3.js, I can see that all 4 events are included in the receipt logs, but only the last 2 events are in the decoded logs (...
1
vote
1
answer
1k
views
How to force push a failing transaction using Web3.js?
I am trying to use Web3.js to push a transaction that is failing. From what I understand, Web3.js seems to perform a pre-flight of the transaction and throw an exception. Therefore the transaction ...
1
vote
1
answer
1k
views
How to scan ether transfer from smart contract to my addresses programmatically?
Correct me if I am wrong, the transaction receipt contains only the log of contract events. So we can only use it to examine the internal transaction that produces a event.
How about ether transfer ...
1
vote
2
answers
1k
views
How to call my contract's function using sendRawTransaction?
I am trying to call my contract's method using sendRawTransaction. I have a function in my contract
updateReading(address consumerAddress,
uint32 consumerMeterId,
uint64 ...
0
votes
1
answer
3k
views
Check for error in transaction with web3js
If you look at this transaction in etherscan.io you can see that it notes that the transaction has an error Warning! Error encountered during contract execution [Bad instruction]. Same status can be ...
16
votes
5
answers
9k
views
Using web3 to sign a transaction without connecting to geth
Is it possible to use the web3.js library in a client's browser to let them generate an address and sign a transaction without them connecting to an ethereum node?
12
votes
2
answers
14k
views
Solidity - Return value of Smart Contract Transaction
Why do Solidity transact functions not return any value?
Here is an easy example. I tested it in remix and web3.
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public storedData;
...
8
votes
2
answers
4k
views
How to manipulate data in a Solidity smart contract?
I have a smart contract with some members which should get modified on certain events. For simplicity, let's imagine we have a greeter contract.
If I call greeter.greet() in the JavaScript console, ...
7
votes
1
answer
8k
views
Provided address is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted
Here is my transaction from ethereum.
transaction is shown as followed
{
blockNumber:12,
contractAddress:null,
cumulativeGasUsed:22977,
gasUsed:22977,
status:1,
...
6
votes
2
answers
13k
views
Send transaction using MetaMask injected web 3
Metamasks injected web3 gives an error when using web3.eth.sendTransaction()
web3.eth.sendTransaction({from:web3.eth.accounts[0], to:'', data: // hash to interact with contraact, gas:85000});
What ...
6
votes
3
answers
7k
views
How to test if a TransactionHash is valid using web3?
Is there any way I can tell whether a transaction hash is valid or not?
For eg,
0x2592cf699903e83bfd664aa4e339388fd044fe31643a85037be803a5d162729f is valid transaction Hash whereas ...
5
votes
2
answers
8k
views
Getting "replacement transaction underpriced" though not trying to replace a transaction
I'm running an airdrop script which essentially loops a database of recipients and invokes a batchTransfer function each time with 80 different recipients and amounts.
After about 10 successful ...
5
votes
1
answer
2k
views
Signing transaction with Metamask (not sending)
I use the following code to sign and send a transaction in my backend:
var txData = {
nonce: nonceHex,
gasPrice: gasPriceHex,
gas: gasHex,
data: contractData,
from: ctx....
4
votes
2
answers
532
views
Web3 Javascript API -- Transaction Object Not Matching Documentation
Noob question about the Web3 Javascript API.
When I use web3.eth.getTransaction(), the object that comes back has some properties that I cannot seem to find in the documentation. For example, here is ...
3
votes
1
answer
5k
views
Get history of transactions to specific account [duplicate]
I am using web3.js and geth to do my coding. I have an Ether Account (Not a Wallet Contract) that will be receiving funds from clients. The clients will be writing a number in the DATA field (that you ...
3
votes
1
answer
2k
views
Send signed transaction from nodejs to private SmartContract using webjs in Quorum network not working
Context
I have a quorum network mounted following the example of 7nodes. In node 1 I have deployed a smart contract privately, putting the public key of this ("BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+...
3
votes
0
answers
2k
views
Web3 - how to send transaction with some data and include Ether at the same time?
Using web3 0.20.3
I want to call function and send some Etherium at the same time.
JavaScript
Contract = web3.eth.contract(ABI);
Instance = Contract.at('0x162b74ea16da6ae9d7f7b349eaeab2fcadf4e835')...
2
votes
3
answers
3k
views
Read Transaction History with ethers v6.1.0
I am trying to create a new wallet similar to Metamask. I have implemented few simple features and now I am looking to display transaction history for a particular wallet address. I have tried ...
2
votes
3
answers
508
views
Why is my transaction not performing?
I wrote the following script to send Ether. I can't figure out why the balance is still the same after I send out the Ether. I re run this script multiple times but nothing changes with the balance. ...
2
votes
1
answer
2k
views
Transaction to smart contract shows 'invalid address' error message
I'm simply trying to transfer ETHER to a smart contract deployed on testrpc:
web3.eth.sendTransaction({to: "0xdbf5c15f21ae03f0e33c9058d3823d4e74a35be3", value: web3.toWei(100, "ether")});
Quering ...