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

Questions tagged [solidity]

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.

5
votes
0answers
181 views

Truffle debug on function call show null variables

With a truffle version of 4.1.0, using truffle debug on a call of my contract function below: function Deposit (uint256 timeout, bytes32 hash, address recipient) public payable returns (...
4
votes
0answers
224 views

How to use Ethereum precompile bn256Pairing to check equality on symmetric groups?

The address 0x8 contains bn256Pairing pre-compiled contract on Byzantium release. I have the following questions : If I have G_1 = G_2, i.e., a symmetric pairing, is it possible to check e(a_1, b_1) ?...
4
votes
0answers
104 views

Autorefill isn't working on Improved Coin code

I've been trying to write a token contract with the autorefill function, but perhaps the code for the token example on the ethereum website is somewhat outdated, because it isn't working. Did anybody ...
4
votes
0answers
120 views

I am using Embark , i wrote a command 'make geth' it throws the error

make: *** No rule to make target 'geth'. Stop. I don't know what does it mean .
4
votes
0answers
254 views

Why gas usage differ on mapping(int32 => Struct) vs Struct[]?

My goal is to iterate around 100 items or even more inside a mapped data stuct per a function call by using minimum gas. In order to achieve it I have used two different approaches. In my case only ...
4
votes
0answers
249 views

Gas cost for bigInt library

I am working on a big integer library in the online compiler. Currently having gas/computational time issues with the modulus function. I first implemented it using repeated subtraction: function ...
3
votes
0answers
66 views

solc: [libevmasm/CMakeFiles/evmasm.dir/Assembly.cpp.o] Error 1

I am trying to install solc v0.4.25 through brew on a Mac. Please note that I was able to install its latest version solc v.0.5.0 using brew install solidity; but I am unable to install its previous ...
3
votes
0answers
46 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 ...
3
votes
0answers
77 views

Why does this work with Solidity 0.4.21 but not 0.4.22?

I have this simple set of contracts. pragma solidity ^0.4.21; contract FirstContract { bool public isTrue = true; function sayHello() public pure returns(bool) { return true; } } ...
3
votes
0answers
70 views

How to parse through the logsBloom of a block or transaction using solidity

Currently trying to figure out how to parse through the logsBloom portion of block and transaction headers using solidity. I've researched the topic so far and have come to the understanding that RLP ...
3
votes
0answers
91 views

Solidity : About function calls between deployed contracts

I want to make a function call between a token (MyToken.sol) that inherits MintableToken.sol of OpenZeppelin and manipulate that token (Buy. Sol). (MyToken.sol) pragma solidity ^0.4.21; import "...
3
votes
0answers
214 views

Testing solidity default function with Truffle and async/await

I am developing a crowd sale contract in solidity. The fallback function is payable so that investors can send ether to the contract. If incoming transaction is accepted then information about the ...
3
votes
0answers
52 views

Methods and constants order in the contract ABI

Is it possible to annotate methods and constants order in the contract ABI before compilation?
3
votes
0answers
154 views

Benefits of library versus a plain contract (upgradeability)

I'm trying to find what the benefit is of a library. I found the following statements. (Please correct me if i'm wrong) Cost less gas to deploy Uses the storage of the calling contract the library ...
3
votes
0answers
429 views

Why the transaction reverted?

Try to run my contract in remix JavaScriptVM and faced with error. Contract code: ... /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract ...
3
votes
0answers
409 views

Truffle migrate Error Invalid number of arguments to Solidity function

Truffle 4.0.1 I've got a contract declared "is Pausable" (OpenZeppelin framework) and I want to pause it as part of the deployment logic. I'm getting an error, however, when invoking pause() Error: ...
3
votes
0answers
472 views

Brew linkapps deprecated, unable to install on Mac

brew linkapps solidity Warning: brew linkapps has been deprecated and will eventually be removed! Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using either aliases or symlinks ...
3
votes
0answers
149 views

Can I `eth_call` a non constant function from javascript?

I know that I can't get the return value from a transaction (How to get values returned by non constant transaction functions?), and non-constant functions have return value because they can be called ...
3
votes
0answers
514 views

How to update the Ethereum Wallet Solidity Compiler

I'm using the latest Ethereum Wallet version which is 0.9.0 and I want to update my latest Solidity compiler since it seems that the wallet is using this version 0.4.13+commit.0fb4cb1a.Emscripten....
3
votes
0answers
432 views

Why is the transaction hash (tx.hash) not available in Solidity?

Why not solidity provide tx.TxHash (only tx.gasprice , tx.origin)? reference https://solidity.readthedocs.io/en/develop/units-and-global-variables.html, tx.TxHash,Transaction(ID) Hash, it should be ...
3
votes
0answers
186 views

Contract creation from another contract succeeds, then fails?

I have a first contract with some very basic functionality : contract ContractA { uint public supplyA; function ContractA (uint _supply) { supplyA = _supply; } function ...
3
votes
0answers
165 views

What is the runtime performance of Ethereum Libraries compared to Contracts?

I'm looking for the cheapest way (in terms of gas price) to design upgradeable contracts. I don't expect many upgrades. Being inspired by Writing upgradable contracts in Solidity, I'm investigating ...
3
votes
0answers
111 views

Assuming EIP140, is remaining gas refunded when a called contract throws?

Under EIP140 (REVERT) and assuming Solidity ≥0.4.10. If I call from my contract to a function on an external contract, and this external function does an invalid jump, does my contract still call ...
3
votes
0answers
804 views

flag provided but not defined: -rpc

I'm using Geth to set up a private ethereum network and this is the command: $ geth --identity "MyTestNode" --datadir "SomeDir" init genesis.json --rpc --rpcaddr "localhost" --rpcport "8000" --...
3
votes
0answers
105 views

What is the fastest way to call a function for incoming ICO

We have Alarm Contract: http://docs.ethereum-alarm-clock.com/en/latest/ We have parity client-side scheduling: Parity - How to schedule a transaction? We can write custom contracts similar to this ...
3
votes
0answers
257 views

debug.traceTransaction(<transactionID>) returns a empty structLogs: []. What might be the reason?

On the comments here: https://ethereum.stackexchange.com/a/6011/4575 For a transaction to a contract, the contract vm instructions will execute and the steps are shown in the status.structLogs, ...
3
votes
0answers
118 views

Is there any reference on writing contracts directly with the bytecode language?

It would be great to have a complete reference of all the opcodes available, their exact effects and costs, and an example "Hello World" in ethereum assembly. Edit: this question isn't a duplicate of ...
3
votes
0answers
157 views

Unable to deploy smart contract through ether.camp on Ethereum Consortorium Blockchain

I have created a private ethereum block chain on azure using Ethereum consortorium block chain template. After the deployment is suceeded I got the following attributes of block chain ETHEREUM-RPC-...
3
votes
0answers
85 views

returning bulk data

So I was wondering If it's possible to return bulk data. What I mean with that is returning everything (or part) from an array. I know the following is not possible (correct me if I'm wrong) Array of ...
3
votes
0answers
82 views

Solidty Browser doesn't load properly

Solidity Browser doesn't load anymore. Here is a screenshot with the Chrome Developer open. on Chrome Version 52.0.2743.116 m It's stuck on loading and I see in developer some error messages. It ...
3
votes
0answers
94 views

Contribute function of crowdsale is not working

I am having a crowdsale contract. I am trying to run contribute function using command: contractInstance.contribute.sendTransaction(101,{from:eth.accounts[0],value:200, gas:4000000}). It is creating a ...
3
votes
0answers
128 views

How are strings coerced into uint?

I executed a call checkConstant("ein schnitzel") on the following contract, and it worked. Obviously, type coercion but the documentation doesn't tell. How does this happen in detail? contract X{ ...
3
votes
0answers
179 views

Secure unit conversion in Solidity

Let's say you want mint a token TOK that is pegged to the USD. Then following must hold: (1) TOKUSD = USDTOK = 1 (2) USDETH = 1/ETHUSD (3) TOKETH = 1/ETHTOK The formula of the exchange rate is TOKETH =...
3
votes
0answers
497 views

Compile Smart Contract with Solidity on Windows 10

I wanted to use solidity within geth in Windows 10. I tried the compiled version that comes with Ethereum 1.0 but it has an issue mentioned in this thread. I'd like to get a new binary of a newer ...
3
votes
0answers
128 views

How to use an accessor for imbricated data types?

I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping. How can i access the array in that code for: struct AnotherStruct {....} ...
2
votes
0answers
27 views

How does the Solidity compiler translate the `using .. for` statement?

I'm trying to figure out how using [Library] for [type] is compiled by the solc compiler. I noticed that address placeholders are not in the bytecode as with other library references. So what ...
2
votes
0answers
23 views

Can I send transaction to a view|pure function?

This is the contract: uint public result; address public owner; constructor() public { owner = msg.sender; } function add(uint a, uint b) public returns(uint) { result = a + b; return ...
2
votes
0answers
29 views

How to add function buy to buy button that need array index

I am new to this smart contract and blockchain. I'm trying to do simple selling goods dapps. But i'm stuck at the buy button. I have array for the products. constructor() public { goods[0].owner =...
2
votes
0answers
35 views

Using OpenZeppelin's increaseTime.js

I'm writing a test for a time-dependent solidity function. I'd like to use the increaseTime.js helper from v1.12.0 of OpenZeppelin's library. When I try to call this helper inside my test, I get an ...
2
votes
0answers
30 views

web3 - get all contract public variables?

I have an abstract worker contract and few that inherit from it. Those contracts have some public variables, each one different. I want to display them on my website. Is there any way to return all ...
2
votes
0answers
27 views

One time catastrophic solidity bug suddenly vanished

I'm writing a Blackjack game in solidity. In the following function, the player ended up winning one time with a hand strength of 30 after doubling down even though they should have busted. ...
2
votes
0answers
55 views

How to implement percentage deposit function to smart contract

I need to implement on the deposit function when the ownerAddress is doing a deposit a 10% to be freeze in the smart contract and and if the ownerAddress want's to call the returnDeposit function by ...
2
votes
0answers
47 views

Why is putting data to storage more expensive during the deployment of contract than storing the same data by a method?

I am working with truffle and solidity (v0.4.23) and found out that when I pass in an argument of constructor some bigger amount of data (16kB) that are saved to storage of a smart contract, it is ...
2
votes
0answers
42 views

Can I call a library function from a payable function?

I seem to get a revert each time I try this. I'm unable to get any useful revert message from truffle, so any assistance there might also help solve this. I have a library: library LibInterface { ....
2
votes
0answers
51 views

STOP after RETURN in bytecode generated by solidity

I am currently analyzing the code generated by the solidity compiler. Let's take this simple example: pragma solidity^0.4.24; contract test { constructor() public { } } The code generated with ...
2
votes
0answers
27 views

What is the command PUSH29 010..00 in solidity compiled bytecode?

If you take a look to the bytecode of several contracts compiled from solidity you can notice that in the first ".data" basic block there is this command: PUSH29 ...
2
votes
0answers
36 views

Interacting with a complex deployed contract from my other contract

For example, I want to call a create market function from augur in my contract. I'm using the recommended pattern, but there are additional contracts that this function brings in, ex ICash, IMarket ...
2
votes
0answers
296 views

Contract too large

I am sure this has already been answered but I could not find a clear answer. I get the following error: Contract creation initialization returns data with length of more than 24576 bytes. The ...
2
votes
0answers
20 views

How does createProxyImpl work in ProxyFactory Contract?

function createProxyImpl(address _target, bytes _data) internal returns (address proxyContract) { assembly { let contractCode := mload(0x40) // Find empty storage location using "...
2
votes
0answers
23 views

msg.sender is not showing corect value

I am facing a strange issue. Please read the below case craefully and assit me to geth this issue resolved. I have ERC20Token created by Zeppling templates. [Please ignore syntaxes, I am just trying ...