Questions tagged [remix]
Questions about Remix, an online browser compiler for Solidity, formerly called Browser Solidity.
1,856
questions
43
votes
7answers
44k 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 ...
42
votes
8answers
22k 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?
32
votes
3answers
8k 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 {
...
32
votes
2answers
24k views
Remix warnings - state mutability and public visibility
I noticed the new Remix gave me two new warnings:
browser/Untitled.sol:6:5: Warning: No visibility specified. Defaulting to "public".
function setFee(uint _fee){
^
Spanning multiple lines.
...
30
votes
2answers
27k 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;
...
23
votes
2answers
16k 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 ...
22
votes
7answers
31k 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 ...
20
votes
3answers
18k 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 ...
17
votes
3answers
6k views
Should the constructor function be public?
In all the tutorials I'm watching nobody specifies public, but remix presents warnings that function visibility has not been specified, and public is assumed.
Since I don't like warnings if possible,...
16
votes
2answers
3k 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 ...
14
votes
4answers
17k views
Smart Contract Error: Returned values aren't valid, did it run Out of Gas?
Deployed a contract using Remix IDE to Rinkeby testnet.
Etherscan contract address and code is here.
contract SimpleCounter {
int counter;
constructor() public {
counter = 0;
}
...
14
votes
3answers
16k 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 ...
13
votes
4answers
7k views
Is it possible to include all the openzeppelin library files on Remix?
I am trying out Remix as an IDE. However, I'm using the excellent open-zeppelin library for development. Is there any way to include all the files from open-zeppelin in the build path for Remix ...
13
votes
4answers
13k views
Solidity/Remix Error : The constructor should be payable if you send value. How to solve this?
pragma solidity ^0.4.16;
contract MyToken {
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
// Initializes contract with initial supply tokens to ...
12
votes
3answers
5k views
Why do `throw` and `revert()` create different bytecodes?
throw and revert() are both compiling to the revert operation (opcode 0xfd). According to the docs:
The throw keyword can also be used as an alternative to revert().
Why is it then that the ...
12
votes
5answers
15k 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 ...
12
votes
4answers
4k 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 ...
12
votes
1answer
6k views
Is an Account in MetaMask the same as an Ethereum Account (EOA)?
First, my setup: I use the Azure Ethereum Consortium Template, which creates one transaction node and two mining nodes in my configuration. I use MetaMask Chrome plugin to accept transactions, which I ...
10
votes
3answers
8k views
Solidity error when encoding arguments to query public mapping
While developing a Smart Contract with Solidity on Remix , after creating the contract I'm trying to query a public mapping:
mapping (address => uint256) public balanceOf;
but when I call ...
10
votes
1answer
3k views
How to whitelist up to 50k addresses in a single contract?
What is the best practice in whitelisting a large amount of addresses in a contract. For example, if I wanted to include 50k addresses into a mapping that will reflect true for only the 50k addresses, ...
10
votes
1answer
900 views
What determines transaction costs (Remix)?
I've reviewed several related SE questions on this topic and I haven't seen an answer. In Remix, I've created two separate .sol files. The files are names file1.sol and file2.sol. The code for the two ...
10
votes
2answers
2k views
Solidity Browser - Issue with every example => Error: Type “address” not supported for state variable
I am very new to blockchain and Ethereum. I want to get started with a BaaS cloud service and develop / execute some smart contracts. I successfully set up the Azure Ethereum template (https://github....
9
votes
1answer
3k 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
704 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 ...
9
votes
2answers
4k views
this.balance VS address(this).balance
What is the difference between this.balance VS address(this).balance in solidity contracts?
9
votes
1answer
3k views
How to link libraries in browser-solidity? [duplicate]
How to link library in browser-solidity? While creating a contract using library, solidity compiler requires to link the contract with the library. But there is no options in the browser to provide it....
9
votes
5answers
6k views
This contract does not implement all functions and thus cannot be published
On Remix, when implementing the contract suggested here - https://www.youtube.com/watch?v=JHrQ3l2tT78 - I'm getting the error "This contract does not implement all functions and thus cannot be ...
9
votes
1answer
2k views
VM Exception: invalid JUMP when I call a second function
I'm experimenting with
Solidity Browser
Here is my contract code:
contract Test {
mapping (address => uint256) weismap;
function bet(uint vote) payable returns (uint256 weis) {
...
8
votes
3answers
4k views
Warning: Using contract member “balance” inherited from the address type is deprecated
browser/ballot.sol:61:13: Warning: Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member.
require(this.balance &...
8
votes
2answers
4k views
Convert bytes32 to bytes
Is there a simple way to convert bytes32 to bytes in Solidity?
I'm trying to get the length of the string passed in the bytes32 variable but everything gets returned 32 size which makes sense.
But ...
8
votes
3answers
6k 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....
8
votes
3answers
5k views
Where to find contract ABI in new version of online remix solidity compiler?
After the online remix solidity compiler recently changed design, I can't figure out where I can find the contract's ABI? Does anyone know where it can be found in the new version? Or any other way ...
8
votes
1answer
2k views
Any reason not to use Browser Solidity's “Enable Optimization”?
I found that when I had "Enable optimization" activated while writing a very simple contract with browser Solidity, it reduced a total of two SSTORE opcodes to one. That resulted in 5000 gas saved.
...
8
votes
2answers
7k 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
4answers
9k views
Error: Error: [ethjs-rpc] rpc error with payload {“id”:6223335088050,“jsonrpc”:“2.0”,“params”:
I have deployed a smart contract in Remix IDE using MetaMask and test rpc. I got the below error:
Error: Error: [ethjs-rpc] rpc error with payload {"id":6223335088050,"jsonrpc":"2.0","params":["...
8
votes
3answers
3k 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 ...
8
votes
1answer
1k views
Using the “Publish” button of Solidity Online Compiler
I've been using browser-solidity to test out my contract online. Usually I click "create" and then I can call all of my functions to test them.
However, I clicked the "publish" button, and I got a ...
8
votes
2answers
939 views
TestRPC and Metamask: hanging on pending transactions
I'm using Remix and connecting to Testrpc via Metamask.
I can successfully launch contracts to testrpc, but then it hangs on the subsequent calls that Remix makes to the public methods (Remix says "9 ...
7
votes
1answer
1k views
How to debug contract in browser-solidity
contract users{
struct User{
uint id;
string str;
}
User [] public adds;
function del(){
delete adds;
}
function delElem(uint i){
delete adds[i];
}
function add(uint id,string cc){
...
7
votes
2answers
2k views
Why does solidity compiled bytecode not match data for creating transaction?
I'm trying to independently verify the source code of solidity contracts, and stumbled across a case where the compiled bytecode for the source code of the contract does not match the data of the ...
6
votes
1answer
9k 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?
6
votes
2answers
2k views
This contract does not implement all functions and thus cannot be created
I followed the tutorial found here: https://steemit.com/ethereum/@maxnachamkin/how-to-create-your-own-ethereum-token-in-an-hour-erc20-verified
I tried to create this contract using Remix. I had to ...
6
votes
3answers
3k views
Error: gas required exceeds allowance or always failing transaction upon function execution
Problem
The transaction fails because the transaction ran out of gas instead of it failing because the require condition was not met. It works fine before the solidity update to version 0.4.24. It ...
6
votes
1answer
4k views
Remix Warning: This looks like an address but has an invalid checksum
I have the following contract:
pragma solidity ^0.4.13;
contract Test {
function test() public payable {
address(0xCF5609B003B2776699EEA1233F7C82D5695CC9AA).call(1);
}
}
The Remix ...
6
votes
1answer
4k views
What is the difference between Truffle and Remix?
Please list the differences between Truffle and Remix.
Where is the use of both applicable? Can somebody list this using an example?
6
votes
1answer
2k views
Sending value with transaction using Metamask and Browser-Solidity
Using browser-solidity in combination with metamask I am testing a new contract on testnet https://testnet.etherscan.io/address/0xc03db39c18b6056f8c3a3a5495a1e11f3ff8885a but when trying to call ...
6
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
1answer
138 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 ...
6
votes
2answers
2k views
Getting error message from require()
I know that the latest Solidity supports error messages in require/revert (require(stuff, "problem")).
Are there any clients that can get this message? Will I be able to see it if I execute the ...
6
votes
1answer
736 views
Why is this a potential violation of Checks-Effects-Interaction pattern?
That's what Remix is telling me. Now when I look at the documentation as to what this means it seems to be talking about, as I understand it, recursively entering a control flow (if):
Ether ...