Questions tagged [remix]

Questions about Remix, an online browser compiler for Solidity, formerly called Browser Solidity.

Filter by
Sorted by
Tagged with
47
votes
8answers
26k 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?
12
votes
4answers
5k 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 ...
4
votes
2answers
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 ...
20
votes
5answers
22k 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 ...
54
votes
7answers
66k 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 ...
23
votes
2answers
20k views

How to pass arbitrary bytes to a function in Remix

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 ...
12
votes
5answers
16k 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 ...
39
votes
3answers
10k 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 { ...
9
votes
1answer
5k 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 ...
9
votes
1answer
965 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 ...
2
votes
1answer
147 views

Remix IDE File Explorers is missing

I have no idea what happened, but all of a sudden, the file explorers in remix ide is gone. I tried all I can to recover it, including restarting it, switching back and forth between new and old ...
0
votes
1answer
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, ...
0
votes
2answers
382 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 ...
31
votes
3answers
29k 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; ...
6
votes
2answers
16k 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 ...
27
votes
7answers
39k 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 ...
22
votes
3answers
26k 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 ...
18
votes
3answers
6k 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 ...
7
votes
1answer
2k 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 ...
6
votes
2answers
8k 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 ...
2
votes
2answers
3k 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 ...
6
votes
1answer
10k 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?
9
votes
2answers
4k 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(....
5
votes
1answer
3k 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(...
2
votes
2answers
4k views

Web3j: "Intrinsic gas too low" error when deploying contract in Ethereum from Java

I am a new to Ethereum and Blockchain, I have been trying execution of Contracts using Metamask and Remix using Chrome browser for sometime. I am trying to deploy the same contract from Java using ...
7
votes
1answer
9k 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 ...
5
votes
5answers
4k 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' ...
5
votes
3answers
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 ...
5
votes
1answer
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 ...
5
votes
1answer
2k views

Solidity Browser Compiler — Error: Assertion failed

Here's the code: contract C { function a(uint x){} } I try to call C.a(1000000000000000000); and get an error: Error encoding arguments: Error: Assertion failed while C.a(100000000); is ...
3
votes
1answer
1k views

can anyone explain why call, delegateCall, staticCall functions in solidity are called low level functions?

As i have read at many resources, that these functions are low level functions. I want to know, should i use these methods to interact with already deployed contracts or not ?
9
votes
2answers
12k 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.
8
votes
3answers
4k 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 ...
7
votes
2answers
8k 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 ...
6
votes
3answers
6k 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(){ ...
6
votes
1answer
605 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(...
5
votes
5answers
16k views

Gas estimation errored with the following message

I got the "Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error." in remix while using the ...
4
votes
2answers
4k views

why does new emit event syntax give compiler error

This example returns syntax errors when the emit keyword is used. emit AuctionEnded(highestBidder, highestBid); This is the doc where the example code is. http://solidity.readthedocs.io/en/develop/...
3
votes
1answer
979 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....
3
votes
1answer
6k views

Error encoding arguments: Error: invalid bytes32 value (arg="", coderType="bytes32", value="0x6c", version=4.0.37) >

pragma solidity ^0.4.20; contract TestBytes32ToString{ function bytes32ToString(bytes32 x) public pure returns(uint,uint,uint,string memory){ bytes memory bytesString = new bytes(32); ...
3
votes
1answer
1k views

How to get byte32 similar data and return same index as ethereum wallet in web3.js?

Solidity byte32 return different value in web3, remix browser compiler and ethereum wallet In the contract, I have just added byte32 values and return it but in the web3 api, remix browser compiler ...
3
votes
2answers
4k 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'...
2
votes
3answers
3k views

HOW TO AIRDROP TOKENS SUCCESSFULLY

Hi guys quick and simple question.... i have the script for airdropping tokens, all i need is to know what and how to input these value on the drop section of remix script:token,recipient,values. ...
2
votes
1answer
844 views

Contract final touches. Problem with CappedCrowdsale

I am finalizing this basic but clean Crowdsale code. However, there is ParserError with "contract Cappedcrowdsale". Why? It does refer to Crowdsale though. Please check if this is a legit Smart ...
2
votes
1answer
45 views

How to check if a mapping has not been written yet?

I have this mapping: mapping (uint256 => string ) private storedData; I am trying to do this: modifier dataNotStored(uint256 _index) { require( keccak256(abi.encodePacked(storedData[...
1
vote
1answer
2k views

SyntaxError: Source file requires different compiler version

I am trying to compile the following contract on Remix IDE (online): pragma solidity ^0.4.24; contract ProofofExistence{ event ProofCreated( uint256 indexed id, bytes32 documentHash);/...
1
vote
2answers
2k views

Fallback function uses too much gas?

I wrote this contract but Remix complains that it uses too much gas. What am I doing wrong? "Fallback function of contract browser/SplitBalance.sol:SplitBalance requires too much gas (40612). If the ...
6
votes
1answer
208 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 ...
5
votes
3answers
2k 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 ...
4
votes
2answers
1k views

How to recover an emptied file in Remix

I am using Remix IDE on Chrome browser for developing smart contracts. Today during working on a file when I changed program tab and returned to it again, I found that all of the file contents has ...