Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
205 views

Can you activate Contract Functions just by receiving Ether alone?

Noob Question here. I have a Dapp that has no actual need of a web interface. What is the best way to activate functions if someone did something as simple as send Ether to an address it controls from ...
2 votes
0 answers
124 views

How to know the reason of transaction's reversion in parity?

I am testing ERC20 USDT contract locally with parity. I imported contract to my private testnet and manually generated raw transaction that calls "transfer" method of contract. I send it to the node ...
1 vote
1 answer
78 views

How keccak hashing and for loop happening in pure function?

I put a keccak hashing inside pure function, it works and return me the result.It also works in a for loop. I studied that hashing the data and loop consumes consider amount of gas. Do we need to ...
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 ...
1 vote
2 answers
397 views

How to read data returned by a function? [duplicate]

Counter.sol: pragma solidity >=0.5.0 <0.7.0; contract Counter { uint public _counter = 0; function GenNextID() public returns (uint) { return _counter++; } } I use ...
0 votes
0 answers
132 views

How can execute function that send ether in geth console?

I want to execute the send function that sends ether from the sender to the receiver, the code is as shown below. contract Sender { function send(address _receiver , uint amount) public ...
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?
0 votes
1 answer
111 views

How to get the call graph of a mainchain transaction?

Simple question, but I couldn't find the answer. There are transactions like this one which involve many chained contracts. But as storage modify the functions being called and calldata doesn t ...
12 votes
2 answers
7k views

Does view functions cost gas? And how to send transaction in a proper way?

I have a method defined as: getNames() view public , if i call on it contractInstance.getNames.estimatedGas() it returns me a non-zero value, why? I mean, view methods should not consume any gas! On ...
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?
0 votes
2 answers
557 views

msg.sender.balance inside contract

what does/should msg.sender.balance return when used inside contract? Assume we have contract A, calling B, which is calling C. msg.sender is propagated with the calls down to B and C The user is ...
1 vote
1 answer
51 views

How does contract of dapp figure out who buyer is?

How does contract of dapp(eg. market place) figure out who buyer is? If buyer wants to purchase servive(or product) at certain dapp, he should transfer tokens to contract address of the dapp. At ...
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?
0 votes
0 answers
192 views

How do I send a transaction to a smart contract?

I need to build this transaction and send it to the blockchain how do I do it ? I always used ethsendrawTransaction just to send eth but never I never built this type of transaction: { "data": [ ...
1 vote
1 answer
113 views

Where is the position of each paramter in a smart contract function when encoded as inputdata in a transaction

When I reviewed the BEC attack, I found the position of each parameters value in real transaction was not corresponding in to definition of function in smart contract. The exploit transaction is at: ...
2 votes
1 answer
348 views

tx.origin for factory

I want to use a factory so that people can create a standardized contract. People should be able to transfer money directly by this creation which led me to the problem of the msg.sender during the ...
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 ...
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; } ...
1 vote
0 answers
259 views

How to access data from web3.eth.Contracts.send() function?

If I run this chunk of code from my async function I will get a transaction receipt as an output: const response = await contract.methods.recoverAddr(hex_msg, v_decimal,r, s).send({from: accounts[0]}...
1 vote
0 answers
74 views

Possibly hacked but not sure Help!

I recently had most ERC20 tokens moved from a MEW wallet through the individual ERC20 contracts. Does anyone know how this may have happened? I am sending pertinent info from one on etherscan.io 1)...
2 votes
1 answer
6k views

How to Deploy and call a contract? Address needed beforehand?

I want to store a string from a script in node.js to blockchain. This is the contract. pragma solidity ^0.4.0; contract SimpleStorage { string storedData; function set(string x) { ...
0 votes
2 answers
212 views

how to loop call token transfer function in a single transaction

I find a transaction here which contains multiple inner transfers. It seems that it saves a lot gas. May I do this with web3j?
0 votes
1 answer
570 views

from token transaction detail, how can I know if token is actually transferred?

I am implementing support of multiple tokens in my application. I want to listen new token received transactions. I got that I need to decode the input data in any transaction to get the toAddress ...
0 votes
1 answer
438 views

Identify whether the recepient of transaction is an external account or a smart contract [duplicate]

I know that an Ethereum transaction addressed to '0x000..000' is creating a new contract. Now, given a transaction address to non-zero address, I want to identify whether it is a transaction to an ...
0 votes
0 answers
43 views

How do i get to return value form one smart contract function into another smart contract on private ethereum network?

Here it is my called function. pragma solidity ^0.4.19; contract Called{ string public name; function set(string _var) { name = _var; } function get() view returns (...
1 vote
1 answer
105 views

What happens when transaction is sent from smart contract?

If during smart contract execution it decides to send a transaction, then transaction would be created, validated and broadcasted to the network from all the nodes executing this smart contract. ...
0 votes
1 answer
64 views

Is it safe to assume that a smart contract can hold Ether for years if the withdrawal is not triggered?

Given that ethereum continues to run for few years, is it safe to assume that the smart contract will hold the ether that was deposited into it for years until its triggered to transfer/withdraw the ...
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; ...
4 votes
1 answer
3k views

How to send ether to an account instead of creating a smart contract using ethers.js

I would like to send some ether to an account in ropsten testnet. I'm using the following code and the library https://docs.ethers.io/ethers.js/html/. However, instead of sending the ether to the to ...
3 votes
2 answers
2k views

Is "transfer" a transaction or a call/message?

I wondered if "transfer()" function is a call or a transaction. We know contracts only send messages, not transactions. If a DAO-like contract has a variable and a threshold when the variable ...
0 votes
1 answer
148 views

Need Solidity software for smart contract, for Multiple Token dispatch [duplicate]

Please I need to distribute tokens to at least 1,500 wallets and can't go through the stress of sending them one by one. What I need is a smart contract to enable multiple dispatches to several ...
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 ...
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 ...
0 votes
1 answer
3k views

Contract transaction ran out of gas, but the gas limit is much higher than the required amount

We have a smart contract which sends ETH to some address', but everytime we call that function, the function fails.. https://etherscan.io/tx/...
7 votes
1 answer
1k views

I created a wallet contract, sent ether to it and now cannot send to another account

While experimenting. I creating a wallet contract. Here is the address: https://etherscan.io/address/0xC23501aB1E8E5C5EDB0fFA83C5A4DcFb9c31a355 I sent some ether to it. Now I want to send the ether ...
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 ...
1 vote
1 answer
742 views

Do externally owned accounts send messages/transactions do each other? Why doesn't a contract sign its message?

Question 1: Can one account holder send Ether to another one without using a smart contract? Question 2: Is there any need that two accounts send messages/transaction directly to each other? a ...
1 vote
1 answer
336 views

Approval + Deposit each time, vs a one time Approval then only Deposits after

I've noticed that some token contracts are requiring me to do an approval before I make a deposit and some do not. For example. SNT and CVC do not require me to do an approval before I deposit. ...
3 votes
1 answer
275 views

How can I set the gas price of a transaction initiated by a contract?

I am writing a contract that will interact with another contract: contract A will call a function defined by contract B. Is it possible to set the gas price that contract A is willing to pay when ...
1 vote
2 answers
322 views

What stops an unwanted smart contract from being executed by the receiver

I have searched online about this, but I can't seem to find a real answer. Say someone sends a smart contract to some address. What if the receiver does not want to accept that contract? How do they "...
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 ...
1 vote
1 answer
278 views

Bad Jump Destination, how can i tell programmatically?

Let's say i'm programmatically making a transaction to a contract. How can I tell (programmatically) that the confirmed transaction has a Bad Jump Destination? Right now, the only way I know of is ...
3 votes
2 answers
156 views

Simplest way to find percentage of transactions that invoke EVM?

Firstly I want to make sure my understanding of the Ethereum is correct: A "normal" transaction of Ether from one account to another does not usually invoke the Ethereum Virtual Machine? Secondly: ...
3 votes
1 answer
3k views

How Ethereum contracts transfer Ether without a blockchain confirmation

I would like to understand how Ethereum "messages" (originated from a smart contract) can transfer Ether to another account without a blockchain confirmation. I have spent several hours ...
1 vote
1 answer
527 views

how to retrieve function call address from deployed contract for usage with MetaMask send + transaction data?

I've deployed a contract into my testrpc network. $ truffle deploy Using network 'development'. Running migration: 1_initial_migration.js Deploying Migrations... Migrations: ...
1 vote
1 answer
126 views

How to be notified with bad transactions when sending to a JSON-RPC server?

With Ubuntu, I've tried Wallet/Mist and MetaMask on Ropsten testnet: they both notify me with bad transactions before inputting my password. I've tried to do the same thing with a JSON-RPC server, in ...
3 votes
1 answer
566 views

What will happen when an ethereum node loss internet connection?

Will it reconnect to the ethereum network upon establishing internet connection again automatically and sync Data ? Can we perform transaction and calls on the offline(no internet connection) ...
0 votes
1 answer
224 views

Sending parameters via the transaction Object

This works just fine: myContractObject.doSomething(i, function(err, result) { if (err) { console.log(err) } else { doSomethingElse(result) } }) However, this doesn't: ...
0 votes
1 answer
171 views

How to form the transactionObject in a metamask enforced async call?

Normally, for a contract call (i.e. something that does not update ethereum), I would simply do: var something = myContractObject.getSomething(). I've just started using metamask, and unfortunately, ...
1 vote
1 answer
179 views

Which scope of variables changes the state of the contract?

I had been reading about the state of a smart contract. Here It also gives a small example of a contract. contract SimpleStorage { uint storedData; function set(uint x) { storedData ...