Skip to main content

All Questions

Filter by
Sorted by
Tagged with
54 votes
8 answers
32k views

How to quickly test a Solidity function?

There are snippets and functions of Solidity code provided on this Ethereum Stack Exchange and other sites. What are ways to quickly test them, possibly debug a little, and play around?
eth's user avatar
  • 86.5k
45 votes
3 answers
15k views

What is the difference between transaction cost and execution cost in remix?

What is the difference between transaction cost and execution cost as seen after contract instantiation in remix? I don't think it matters, but here is my contract: contract DepositCounter { ...
Raine Revere's user avatar
  • 3,610
4 votes
2 answers
4k views

Remix Warning - No visibility specified, Violate Checks-Effects-Interaction pattern, Function state mutability can be restricted to pure - Can ignore?

Two months ago, I wrote a smart contract with Remix.ethereum.org. Line 1 of my code has: pragma solidity ^0.4.11; It compiled fine with no errors and nor warnings. I tested every function in ...
Curt's user avatar
  • 307
75 votes
7 answers
134k views

How do you get a json file (ABI) from a known contract address?

I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code. Can ...
Thomas Jay Rush's user avatar
14 votes
5 answers
6k views

How to Compile and Deploy a Smart Contract without running a full node?

I'm new to solidity and smart contract programming. I have already made and deploy smart contracts successfully, but always using Mist. Now I'm not able to do so, because I can't complete a node ...
Moisés Briseño Estrello's user avatar
28 votes
2 answers
29k views

How to pass arbitrary bytes to a function in Remix (2017)

According to this question I could write a simple contract like: contract SimpleStorage { bytes input; function setInput(bytes enterBytes){ input = enterBytes; } } Using "0x1234" as a ...
floyd's user avatar
  • 599
23 votes
5 answers
29k views

How to estimate gas at contract creation/deployment to private ethereum blockchain

What I have done a) When I use web3.eth.estimateGas to estimate the cost of a contract creation constructor with no parameters, the estimate is correct. b) If the contract is already deployed then ...
Imroz's user avatar
  • 871
12 votes
1 answer
8k views

Is there any profit from using pure and view functions modifiers?

I have a function that does not read or modify contract's state: contract C { function add(uint a, uint b) public returns (uint) { uint res = a + b; return res; } } Does it ...
30mb1's user avatar
  • 369
12 votes
5 answers
18k views

Invalid JSON RPC response: "" In Browser-Solidity

I'd like to connect private geth node from browser-solidity, however it returned the error Invalid JSON RPC response: "". Please check the following picture for details. Could you tell me how to ...
Toshi's user avatar
  • 2,357
9 votes
3 answers
7k views

Convert an eth key to a geth key

I need to convert my eth key to a geth key. eth put the key in %appdata%\roaming\Web3\keys, and I see it as a .json file. If I move that to the %appdata%\roaming\Ethereum\keystore directory, geth ...
feebel's user avatar
  • 93
4 votes
1 answer
2k views

Transfer only available for objects of type "address payable", not "address"

I am reading the book Mastering Blockchain Programming With Solidity by Jitendra Chittoda published by Packt Publishing. On page 129 it has a sample contract to deploy using the Remix IDE and MetaMask....
rsrobbins's user avatar
  • 143
14 votes
2 answers
9k views

Using ".value(...)" is deprecated. Use "{value: ...}" instead

This works fine in Remix but when trying to work in VSCode (for compiling purposes; DApp course, trying to build .json through compile.js ) it throws the error Using ".value(....
utsav pandey's user avatar
9 votes
1 answer
2k views

What is the cryptic part at the end of a solidity contract bytecode?

Given the following contract: pragma solidity ^0.4.11; contract Simple { bytes32 public v; function set(bytes32 _v) { v = _v; } } When disassembling, neither remix, solc or evm ...
lash's user avatar
  • 685
10 votes
2 answers
27k views

How can i transfer ERC20 tokens from a contract to an user account?

I have deployed an ERC20 token (contract A) and the tokens are being used for a service in my other contract (Contract B). I can easily transfer tokens from an user owned account(EOA) to Contract B ...
tushalien's user avatar
  • 123
8 votes
3 answers
15k views

Getting infinite gas estimates for simple functions

I am testing out solidity in remix ide using simple contracts. This is the contract that I wrote: contract mortal { address owner; function mortal() { owner = msg.sender; } function kill(){ ...
Ahsan Jamal's user avatar
8 votes
1 answer
20k views

How to load contract from address- remix?

Hi I just found that remix added "Load contract from address" option. So I tried to load contract from address "0x67601d7a7cbbD77368785122c508503f168B1dAa" . You can see this contract is in function ...
e.k's user avatar
  • 417
7 votes
1 answer
10k views

ETH sent to ETC address

I accidentally sent ALL my ETH on ETC address :( 6 months of mining gone :( I sent from one exchange to fresh address on another exchange, but on ETC ... Is there ANY way to track those coins? I'm ...
bojan pavkovic's user avatar
6 votes
2 answers
11k views

calling one contract to another contract method

I want to call the method getdata() and retrieve the returns value to use in another contract. But the call only returns bool on success or failure. How do I get the return value from ...
Gopal ojha's user avatar
  • 2,249
4 votes
1 answer
649 views

Can geth and eth share the same accounts and blockchain?

It appears when I have multiple ethereum clients installed, that they all have their own data, accounts and even their own copy of the blockchain. Is it possible to share accounts and the blockchain ...
q9f's user avatar
  • 33k
2 votes
1 answer
3k views

Airdropping ERC20 Tokens to multiple addresses in a single transaction

done , wrong question. better to use this contract ERC20 { function transfer(address _recipient, uint256 _value) public returns (bool success); } contract Airdrop { function drop(ERC20 token, ...
user avatar
2 votes
1 answer
3k views

Got scammed using bad code to create front running bot [duplicate]

I got scammed by bad code on a front running bot. I used the code in Remix, deployed it, and then sent money to it. (Put another way, I don't code, had no idea what I was doing, but decided to try it ...
Mighty Mike's user avatar
0 votes
2 answers
448 views

Why transfer funds breaks contract?

My deployed contract called successfully only by "function invocation" through web3 or Remix. But it always failed when I sending funds to the contract. I thought that only requirement that contract ...
Alex G.P.'s user avatar
  • 1,277
34 votes
3 answers
41k views

TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given

/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param ...
CryptoScroller's user avatar
33 votes
3 answers
31k views

How does Mapping in solidity work?

I went through the Crowdfunding example in solidity where i encountered the following: contract Crowdfunding { struct CampaignData { address recipient; uint contributed; uint goal; ...
Rahul Sharma's user avatar
  • 1,303
26 votes
4 answers
28k views

How to fill dynamic in-memory array

For some reason solidity doesn't allow to push values into memory array Member "push" is not available in bytes32[] memory outside of storage. Here is sample contract code: pragma solidity ^0.4....
Alex Zhukovskiy's user avatar
18 votes
3 answers
10k views

Etherscan: How can I verify a contract with multiple imports deployed with Truffle?

When I deploy a contract with Truffle that has an import statement, and try to verify it on etherscan, my understanding is that I need to paste in the contents of the imported file. I get an error on ...
Travis Jacobs's user avatar
17 votes
4 answers
26k views

What is the maximum value an int and uint can store

I need to understand a couple of things: What is the maximum value an int and uint can store? Are the maximum values stored in int and uint the same?
iappmaker's user avatar
  • 813
7 votes
1 answer
3k views

How can I deploy a contract with reference to a library contract without using a graphical user interface like Browser Solidity?

I am using Solidity Browser to deploy a contract due to from Library contract method failing #2831 issue. On this following answer https://ethereum.stackexchange.com/a/9181/4575 I have guided to use ...
alper's user avatar
  • 8,404
4 votes
1 answer
5k views

How can I import geth accounts into eth?

I had two accounts under ~/.ethereum/keystore when I used geth a while ago. I got a new PC, recompiled only the C++ version and I can't see my two accounts in eth. web3.admin.eth.allAccounts() ...
euri10's user avatar
  • 4,640
2 votes
3 answers
5k views

Issue with New version of Metamask: Remix cannot detect the Metamask address

I have just installed Metamask version: 6.3.1 Now in Remix, the address of my account in metamask is not detected. The account box in remix remains always blank now (see picture below). Note that I ...
user153465's user avatar
1 vote
1 answer
8k views

I sent My ETC to my ETH address

I've sent a mistake ETC from ETH address from poloniex. How do i do now. This is my transaction (this is a fresh address) http://gastracker.io/tx/...
Luan Nguyen's user avatar
1 vote
1 answer
1k views

Remix: Invalid parameters: must provide an Ethereum address

I have a contract ready for deployment on REMIX and also have 3 Rinkeby Metamask accounts. Only 1 of these accounts is able to deploy the contract for some reason. When i try the other 2 accounts i ...
kd12345's user avatar
  • 111
28 votes
7 answers
43k views

TypeError: Data location must be "memory" for parameter in function, but none was given

I have created the contract below using the online IDE Remix. the smart contract was fine until late last night when i got the following error for all functions(targeting the string data types ...
Lonwabo Zaula's user avatar
26 votes
6 answers
38k views

What is address(this) in solidity?

As per my understanding contract`s own address is the address which we assign to owner of contract using msg.sender. But I saw this question on SE where it was described that a contract can access its ...
Anam Nizami's user avatar
13 votes
3 answers
27k views

How to get the contract ABI in new Remix IDE?

Waked up today just to find out the remix browser interface changed to this what happened !!? I cannot find the contract details to get the json interface anymore.
Jose Victor's user avatar
13 votes
1 answer
5k views

Gas consumption of a view public function

In my contract I have a view public function that returns an array of bytes32 elements. In remix it produces a warning saying it might run out of block gas limit if I use this function. As I had read ...
kathi's user avatar
  • 199
9 votes
1 answer
15k views

Debugging Ethereum Contract by printing the values

Is there a way that I can print the intermediate result on a console or some log file in order to debug my contract?
anand011090's user avatar
8 votes
3 answers
5k views

Returning structs in new version in Solidity

I have been reading about Solidity release version 0.4.17. https://github.com/ethereum/solidity/releases One of the following statements was really interesting: We also worked further on the new ...
Sivich's user avatar
  • 83
7 votes
2 answers
14k views

TypeError: This type is only supported in the new experimental ABI encoder

I am practicing my Solidity skills and while I did expect to get an error, I did not expect this error TypeError: This type is only supported in the new experimental ABI encoder. Use "pragma ...
Daniel's user avatar
  • 501
6 votes
3 answers
3k views

A problem with filters and events (web3j/TestRPC). SOS! ;)

Help me, please, with this little simple task! I cannot solve this problem for several days. SOS! ;) I'm trying to write a program for filtering events via web3j. I copied to start (for the test) from ...
lfrickel's user avatar
6 votes
2 answers
4k views

Solidity function gas requirement is infinite

struct userData{ uint val; bool isvalue; string name; } mapping(uint => address) internal users; mapping(address => userData) internal bidirectionalUsers; function addMember(...
e.k's user avatar
  • 417
6 votes
2 answers
10k views

How to install eth on debian? (symbol lookup error)

I installed from the ubuntu ppa and got this error. ➜ ~ eth eth: symbol lookup error: eth: undefined symbol: _ZN3dev3eth14EthashGPUMiner14s_numInstancesE What can I do / check? I'm on debian ...
euri10's user avatar
  • 4,640
6 votes
1 answer
674 views

Compiler Issue or Improper State Variable declaration?

After seeing some unexpected compiler results, I've reduced the issue to this tiny example: The following compiles under 0.4.10 in Remix: contract StorageMapping { struct S { mapping(...
Rob Hitchens's user avatar
  • 55.6k
6 votes
1 answer
371 views

Public variable getter shows as transaction in Remix

As of Solidity 0.6.0+ compiler, my remix shows getter functions, built by public variables, as transactions and, therefore, do not return the value. I searched the solidity 0.6.0 breaking changes but ...
João Quintanilha's user avatar
6 votes
2 answers
8k views

No matching declaration found after argument-dependent lookup

Currently I'm trying to find a solution for this problem TypeError: Member "toTimestamp" is not available in contract DateTime outside of storage , and I decided to take another approach. I'...
Samuel Hawksby-Robinson's user avatar
5 votes
1 answer
13k views

The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender

EtherScan.io is showing error: The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender. Transactions are successful but users are ...
Dar Dev's user avatar
  • 51
5 votes
1 answer
4k views

How to deploy contract into local running node using solidity browser?

I am running a local ethereum node and I did unlock an account. Now I want to use the solidity browser to deploy that contract, but when I switch to the web3 provider deploy option and I press the ...
sfrj's user avatar
  • 782
5 votes
5 answers
5k views

How can I use testrpc as the environment in Remix?

I've installed ethereumjs-testrpc and I'm running it with testrpc in my terminal, which I'm pretty sure is working because it outputs Listening on localhost:8545 after listing all the test accounts' ...
feihcsim's user avatar
  • 157
5 votes
1 answer
4k views

Remix IDE: What is the purpose of Calldata and Transact Tab

I am trying to execute the following code on Remix IDE. pragma solidity ^0.5.4; contract GuessTheNumberChallenge { constructor() public payable { require(msg.value == 1 ether); } ...
zak100's user avatar
  • 1,416
5 votes
3 answers
4k views

How to execute Smart contracts on a private Blockchain network

I have created a private Blockchain network on my Windows system with one node. I have created accounts and was able to transfer ethers across them. Now I want to deploy smart contracts on this ...
Rahul Sharma's user avatar
  • 1,303

1
2 3 4 5 6