Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

0
votes
1answer
5 views

Error encountered, bailing. Network state unknown. Review successful transactions manually. exceeds block gas limit

I am trying to deploy my crowdsale contract using "truffle migrate --network ropsten". I encounter this problem "Error encountered, bailing. Network state unknown. Review successful transactions ...
1
vote
2answers
12 views

Type address is not implicitly convertible to expected type contract ERC20

I am trying to compile my crowdsale contract and get this error: " TypeError: Type address is not implicitly convertible to expected type contract ERC20. token = ...
1
vote
1answer
17 views

Why are getters of public state variables not recognised by interfaces?

In code like the below, address public balance has an automatic getter function (as can be seen in the corresponding ABI). However we need to redefine it to avoid the compiler complaining that Test ...
2
votes
0answers
7 views

Drizzle cacheCall is not updating data correctly

I have a react component which is interacting with a solidity contract via drizzle. I store a cacheCall index in the constructor: this.opcTokenCacheCallIndex = context.drizzle.contracts.OPCToken....
2
votes
1answer
19 views

json contract erc20 is safe?

I created my first contract erc20, implement a mint function, the case is, if I copy the code json, I paste it in another wallet I can use the interface of the contract equally, although this is not ...
-1
votes
0answers
11 views

Can anyone take me through the deployment of smart contract(written in solidity) and its accessibility using django framework?

I'm a begginer and I've written a smart contract in solidity,started a node that starts mining.I want to access the functions of smart contract from a UI(web app created using django).What do we need ...
2
votes
2answers
18 views

Max range of uint in solidity?

I am writing a smart contract in solidity and I have a question in relation to the range of uint type. My understanding is that uint is the same as uint256 and the range of this is 0 to 2^256. I ...
1
vote
0answers
19 views

Code scope in evm

Short question, how is code scope defined/determined by the compiler when looking at EVM opcodes (or rather bitcode)? Is it simply by looking out for jump calls or return statements? Or does it define ...
0
votes
2answers
21 views

Solidity Checks-Effects-Interactions Pattern

From the solidity docs: Use the Checks-Effects-Interactions Pattern Most functions will first perform some checks (who called the function, are the arguments in range, did they send enough Ether, ...
2
votes
1answer
11 views

Any way to do compile-time computation using rational_const and a constant value?

Of the following three declarations ufixed constant TEST1 = 256; uint constant TEST2 = 256; uint[] testTable1 = [uint(0.001 * TEST1), uint(0.01 * TEST1), uint(1.1 * TEST1)]; uint[] testTable2 = [uint(...
1
vote
2answers
22 views

Remix always throws the error: exceeds block gas limit

Dear Ethereum developers. I started to learn Solidity this week and am trying to deploy a contract via Remix, but this doesn't really work. Running environment is set as Web3 Provider. (Because the ...
2
votes
1answer
13 views

how to create a smart contract that receives funds, displays addresses that sent the funds?

function safeWithdrawal() public afterDeadline { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount > 0) { ...
2
votes
2answers
16 views

EVM Contract Testing with JS issue - ReferenceError: artifact is not defined

There is a problem i have with a new DAPP tutorial i'm looking at from this YouTube video: I have an issue from for testing of my contract. when i run the "truffle test": it returns the following ...
2
votes
1answer
13 views

Function to return tuples throws error on frontend

I have similar functions like this and they work fine: function getBarsOfParticipant() external view returns (uint256[], uint16[], bool[]) { uint256[] barIds = participantToBarIds[msg.sender];...
2
votes
1answer
16 views

web3.py constructor(address type)

I tried to deploy the contract on my testrpc, but I get error when my constructor using "address" type. Here is my python code: import json import web3 from solc import compile_source from web3....
-1
votes
0answers
15 views

Loop in store to mapping

I am working on a contract analyzer to later integrate into an IDE, contracts of mine where I access a dynamically typed variable in storage run a loop in bytecode where some value is checked to be ...
0
votes
2answers
14 views

How transaction with gas used ok 28k succeed for payable?

I'm trying to understand what I can do in fallback payable (I have read the docs and I know what I can't do for sure). Here is my contract: pragma solidity ^0.4.22; contract SmartMsgData { // ...
2
votes
2answers
24 views

Adding an array in mapping

The main purpose of this code is to add an array of users in mapping. there are certain users who play a video game and are on a certain level now level will be considered as a mapping index and on ...
3
votes
1answer
24 views

2_deploy_contracts question, about test records

With the below i'm deploying and then setting some test records. However when I test it doesn't seem to see these records. TESTING OUTPUT ignore # variation as i hadn't updated it in the test, it ...
2
votes
2answers
9 views

How to push value of function into dynamically sized array

I am trying to capture the address of the use who has been given the "right to vote" in the giveRightToVote function. If I use msg.sender that only captures the user invoking the function. Any ideas?...
3
votes
4answers
75 views

Can anyone explain what is the main purpose of events in solidity and when to use it?

pragma solidity ^0.4.24; contract assignment2{ event ageread(address,int); function getage(address peridentifier) public returns(uint){ human = mystruct("adam",10); //using struct mystruct ...
0
votes
0answers
20 views

solidity - event raised only in Remix IDE; not in private network

This is the function in my Solidity contract. // To be fired when inputs are not valid event Status ( string msg ); // Create a new org of lenders with assigned leader. // This function can be ...
2
votes
1answer
29 views

Apart from array and mapping Is there anyway to store large number of user information in Ethereum blockcain?

I have a smart contract to store user information in Ethereum blockchain. For every new transaction entry gets added into map or array. This looks too costly in terms of storage. If I use map or array ...
1
vote
1answer
32 views

Is there a need to remove entries from mapping?

I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week. If the mapping grow larger, is it going to consume more gasses? Is there a need for me ...
1
vote
0answers
14 views

The problem with rawTransaction

I have a problem with raw Transaction. Using this code to send tokens to another contract, something does not work. The transaction is signed correctly, everything is sent to the network but it does ...
1
vote
2answers
21 views

solidity - Invalid address error when invoking a function with array as an argument

My Solidity contract has a function like so function newOrg(bytes32 orgId, bytes32[] members, bytes32 head) public payable. In my javascript file, I have this: var Web3 = require('web3'); var fs = ...
0
votes
0answers
15 views

Started getting EventStructWrongData warning in my ERC20 Token Code

I suddenly started getting EventStructWrongData (very low-severity) warning in my Ethereum code in Etherscan. It was not there before, so how come it started showing up all of a sudden? This is the ...
1
vote
1answer
22 views

I am unable to verify my contract on etherscan

Unable to verify my contract on etherscan. This is the link - https://ropsten.etherscan.io/address/0xc68c67a1864060631817be1eebdb91e8661fae7a . Please help. Its urgent. Here is my code: pragma ...
2
votes
1answer
39 views

A Solidity Linearization Puzzle

I was playing in remix just to concretize my understanding of Solidity linearization, and got a result I didn't expect and can't rationalize. Why does AC_BA.go() return 3? (Please scroll to the ...
1
vote
1answer
10 views

assertEventEmitted from new contract construction call

At present there is no way I can see or is documented to be able to easily use something like this with the truffle framework: So using chai and writing a test to deploy a contract with something ...
1
vote
2answers
45 views

Gas Estimation Failed in Remix

Found my own problem. Can't really use the transfer function as it is written. It assumes the owner uses it. So made a new function for the "minting" function for the faucet to use. Not sure why the ...
1
vote
0answers
17 views

Gas Estimation Failed for Airdrop for sending Tokens to Multiple Addresses using Remix

I have deployed a Crowdsale contract and now I need to send my Tokens to a list of addresses using remix and injected web3. I am using below code for Airdrop but when I send tokens to multiple ...
0
votes
0answers
16 views

Myetherwallet.com ABI read-functionality bug?

Why is myetherwallet not loading view functions which are declared as onlyOwner or specifically declared as only accessible by a particular address? How can I confirm that I'm the correct address ...
1
vote
1answer
12 views

Getting storage array data from contract

I have a solidity contract which stores an array of Proposal information: contract Submissions { Proposal[] public proposals; struct Proposal { // .... } } In a test (using ...
-3
votes
0answers
33 views

Is it possible to pretend to be another Address?

Can someone else pretend to be another Address to read data that is connected to the address in the UI?
0
votes
1answer
16 views

Solidity: msg.data vs bytes

This is a simple contract that has a function input_data(bytes data) and a simple fallback function that passes msg.data to function input_data. contract test_input_data{ address owner; event ...
2
votes
0answers
11 views

Retrieve CHAIN_ID of the executing chain from a Solidity contract

Is there a way to directly be able to retrieve CHAIN_ID information about the executing chain from a smart contract? I know that for any chain that has EIP-155 implemented, CHAIN_IDs are retrievable ...
4
votes
2answers
35 views

Right way to keep track of mapping values

I'm having trouble finding the most cost efficient way to keep trace of what is stored into a mapping. I'm working on a web service that requires, to display, to get the data stored in a mapping This ...
1
vote
0answers
19 views

web3js get all properties of contract in one promise

I'm implementing an app with a Factory design pattern. My Factory is creating instances of myContract, that I load thanks to myContract.at(address) like below: this.myContract = TruffleContract(...
1
vote
1answer
18 views

Solidity: using low level call function on an EOA

Say I have a contract with a method that does a low level call on an address _addr assuming the target address is a contract with a certain method isValid(): contract Dummy { function doCall(...
1
vote
0answers
16 views

Getting error invalid command: “networkid=15”

geth --rpcapi eth,web3,personal --rpc networkid=15 2>&1 | tee -a blockchain.log while running the above command i get following error invalid command: "networkid=15" And the same ...
2
votes
2answers
26 views

Proper way to implement “buyable” ERC721 tokens

I have a contract that implements the ERC721 interface, and I want to allow token owners to set their tokens as "buyable", so that any other address can buy their token without any action on the part ...
0
votes
1answer
15 views

What log message an event generates to blockchain?

The following is a portion of a Ballot.sol. There is a event votingCompleted() defined and triggered in function vote. What is the detail message this votingCompleted is going to emit to blockchain? ...
0
votes
1answer
11 views

How to allow owner to select facilitators

I am very new to solidity and quite honestly I'm scratching my head a lot. I am trying to create a contract where a company can facilitate donations. Anyone can apply for a donation, supplying their ...
1
vote
1answer
18 views

Payable contract with multiple “options”?

I'm trying to create a contract that behaves differently based on the user's selection. I, however, have no idea how to let the user "select" the option. Currently I have a basic fallback function ...
4
votes
1answer
25 views

How does ecrecover actually work?

I have a basic understanding of elliptic curves, so I'm more interested to find out how does ecrecover specifically verify signatures. It has rather weird requirements, like this prefix thing (excerpt ...
1
vote
0answers
18 views

calling method from another contract throws Revert

I have a smart Contract "RecommendContract" contains this method: function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) external { Vacancy vacancy = vacancies[...
1
vote
1answer
22 views

If it's possible to change solidity code once deployed in ethereum blockchain [duplicate]

I deployed solidity code in ethereum blockchain. Now my client ask to add some function in the deployed solidity code and need update that code in same contract address but i do no if it's possible or ...
1
vote
1answer
30 views

Not sent by ETN via transfer

I'm trying to make a lottery. pragma solidity ^0.4.23; contract Lottery { struct Ticket { uint id; address name; uint winCount; } uint public winFirstPercent = 60; uint public ...
1
vote
1answer
16 views

Returning Structs and Lists in Solidity

Is there a particular reason why Solidity prevents you from returning structs, lists and other data structures? I understand that it needs to be secure and allowing array/list access may mess with the ...