Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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 ...
mKoeppelmann's user avatar
  • 7,636
91 votes
9 answers
26k views

Can contracts pay the gas instead of the message sender?

Is it possible for a contract to pay the gas costs (or part of it) that result from the contract being called? Or does the sender of a message always pay the resulting gas costs no matter what?
mKoeppelmann's user avatar
  • 7,636
21 votes
1 answer
2k views

What is the order and concurrency behavior of multiple calls to a contract in a single transaction?

Suppose a contract has three call APIs that have side effects. What's the behavior if I try to: Call all three APIs from one address (i.e. issue three transactions if from nodejs). Are all three ...
Paul S's user avatar
  • 4,291
16 votes
1 answer
8k views

How much does it cost to use a contract?

Still new to ethereum and would like to know the price for a contract.
Patoshi パトシ's user avatar
30 votes
4 answers
11k views

Does every node execute the contract code for each transaction?

This question was asked on Reddit a while ago: When a node sends a transaction to the network and has the receiver as a contract, does every node execute the contract bytecode with the inputs to ...
J-B's user avatar
  • 8,981
20 votes
2 answers
4k views

What happens when a smart contract gets several similar calls in the same block?

What happens when a smart contract gets several similar calls in the same block? Consider for instance this greeter: contract greeter { string name; function setName(string name_) { ...
Matias's user avatar
  • 1,109
28 votes
2 answers
22k views

How do I know how much gas to use when calling a contract?

When I am calling (sending a transaction to) a contract how do I determine how much gas to use? Is there a way to calculate this upfront & what happens if I send too much / too few gas?
J-B's user avatar
  • 8,981
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 ...
Bogdan's user avatar
  • 397
5 votes
2 answers
4k views

How can I get the hexadecimal equivalent for a method name in an Ethereum contract using Python?

The function to call is called xyz(). My code: web3.sha3("xyz()").substr(0,10) Error: AttributeError: module 'web3' has no attribute 'sha3' In newer versions of web3, the above error ...
aste123's user avatar
  • 243
8 votes
3 answers
4k views

Reading values from a contract: When do I need transactions?

Since reading on the Blockchain does not need performance of other nodes, I wonder how I can get values from a Smart Contract without any transactions. I have created a little example contract: ...
Ba5t14n's user avatar
  • 213
2 votes
2 answers
900 views

How do I deploy a contract, then send and retrieve a string from it?

I wish to store strings on-chain. From what I understand so far, I need to set up a contract, then I can send transactions (with a string) to that contract which will be stored. Is this the best way ...
joe's user avatar
  • 269
9 votes
3 answers
7k views

Who pays gas for smart contracts?

I'm currently writing my first smart contract and I'm trying to figure out how to inject gas into the contract, of course, if it's possible. I'm not sure If I got it correctly. With every transaction ...
Maarduk's user avatar
  • 375
7 votes
2 answers
564 views

How transaction fee is calculated in case of L2?

In case of L1, the transaction fee is typically calculated as the product of gas price and gas usage, i.e., txFee = gasPrice * gasUsage One such example can be seen in this transaction. In which the ...
SYED ASAD KAZMI's user avatar
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 ...
Fifth Dimension Dragon's user avatar
5 votes
1 answer
8k views

Get pending transactions to a given address/contract

Is there a way I can get all pending transactions to a given address/contract? I could get the confirmed transactions by exploring transactions in recent blocks. But how would I go about getting ...
LampShade's user avatar
  • 640
5 votes
2 answers
2k views

Who is msg.sender in a nested call chain?

I read about who is msg.sender when calling a contract from a contract, but who is msg.sender when calling a contract from a contract that calls another contract and so on and so forth?
Paul Razvan Berg's user avatar
1 vote
2 answers
8k views

Is it possible to insert some custom data in the DATA field of an Ethereum Transaction?

i am working on trying to get some data encoded/inserted into an ethereum transaction. Let me describe my environment first, i am using Web3py, Ganache and Remix IDE. I am able to successfully ...
Muhammad Yasir's user avatar
0 votes
2 answers
677 views

Why is transaction reverting with custom smart contract?

I have deployed a smart contract to the Polygon Mumbai Testnet (it shouldn't really matter where I deployed it). When sending a transaction to call a function on this contract, the transaction fails, ...
David Callanan's user avatar
7 votes
2 answers
3k views

How can I use "eth_sendTransaction" to invoke a contract and get logs?

I have deployed: contract test { function multiply(uint a) returns(uint d) { return a * 7; } } I can call the contract with "eth_call" : mpsp@ubuntu-slave2:~$ ...
Panda's user avatar
  • 153
5 votes
2 answers
905 views

return (bytes32,bytes32) , returns actual transaction address instead of the real data

I have attached my contract, which works fine on populus and compiles on geth. It is a simple source code: Test() function appends data into my linkedlist that is defined in my library. And get() ...
alper's user avatar
  • 8,404
5 votes
1 answer
4k views

How to know the hex code to use in data to call a specific contract function?

For instance, on the BAT ico site, you can see the crowdsale contract address, the ABI and also a string to use in the data part of your transaction if you don't want to call the contract function ...
Nicolas Massart's user avatar
4 votes
1 answer
2k views

"Estimated fee consuption: The contract won't allow this transaction to be executed." happening in my custom contract in my private network

Any ideas? My contract: pragma solidity ^0.4.0; contract shares { enum OrderType{BUY,SELL} struct Order{ address solicitant; uint price; uint quantity; } ...
Luiz Fonseca's user avatar
3 votes
1 answer
8k views

Get the balance of an ERC20 token at an Ethereum address [duplicate]

I'm trying to get the balance of a token on an Ethereum address. So let's say my Ethereum address has 1 SNT. I'd like to make a call to get that 1 SNT as a response. I've written many other calls ...
LampShade's user avatar
  • 640
2 votes
1 answer
6k views

ENS on Rinkeby - Network does not support ENS?

I was able to register the ENS domain on Rinkeby, as the network supports ENS. My TX: https://rinkeby.etherscan.io/tx/0xd42b64ab03387d7ca405e7ba7b85ce893444a141e7a7de174f0361e2c4231674 My subdomain: ...
Mars Robertson's user avatar
2 votes
2 answers
3k views

How can i sent ETH from a contract wallet to another account?

Use the mist wallet 0.3.9. The ETH from a pool is sent to a wallet address. How can I send the ETH from wallet to account? When I try to send from the wallet address to an exchange address, I saw ...
r-e's user avatar
  • 21
1 vote
0 answers
1k views

How to get all the transactions made by a token address [duplicate]

Given the address of a token, how I can get all the transactions related to that address using JSON RPC or an external api such a api.etherscan.io? The transactions that gives a Ethereum address are ...
Enzo's user avatar
  • 177
1 vote
1 answer
93 views

Is gas ultimately *only* sent to miners while the computation defined in a smart contract is performed by each node of the network? [duplicate]

To my understanding, the execution of the code inside a smart contract is done by all nodes in the network. However the miners are the only ones who receive the paid gas. Also, when setting up the ...
SGMoore's user avatar
  • 11
1 vote
0 answers
524 views

How to get transaction hash at time of invoking function?

I have a function as follows: function setEnergy(address dev, uint256 energy) public returns (bool) { require(dev != address(0)); amount[dev].energyValue = amount[dev].energyValue + energy; ...
Questioner's user avatar
  • 2,700
1 vote
1 answer
2k views

How to send data to smart contract?

I have the variable w1_temp, which i need to send to contract I have the following code: var W1Temp = require('w1temp') var Web3 = require('web3') var web3 = new Web3() web3.setProvider(new web3....
Nurbolat K's user avatar