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.

1,743 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
216 views

Error while calling function in smart contract using nodejs?

I have deployed a contract in private blockchain using mist wallet. When I try to call the function in the smart contract using web3 api it through the below error /home/karthikeyan/Desktop/n2/...
0
votes
0answers
124 views

can't get transfer to execute

I am trying to run the following solidity function: function test() payable { msg.sender.transfer((balances[msg.sender]/1000)*this.balance); } Where this.balance is 0.1 Ether and balances[msg.sender]...
0
votes
2answers
654 views

Mist stuck not downloading last 100 blocks

My mist wallet won't download the final blocks it needs to be fully synced to the blockchain. I have 0.18 ether in my account which is visible on etherscan, but it won't show on Mist. Is getting ...
0
votes
1answer
105 views

Problems funding Ethereum Wallet

Tried making three separate transactions from two separate wallets (Coinme and Coinbase) each in relatively small amounts (less than $50) to fund my Ethereum Wallet 8.0 for Mac. None have appeared ...
0
votes
1answer
154 views

Unable to change contract data with nodejs (web3)

I created a contract, and deployed it into my private blockchain, as you can see I use mapping and dynamically allocated array. When I am trying to add a domain by 'addDomain' method with remix web ...
0
votes
0answers
619 views

totalSupply in ERC20Basic contract is not initialized to zero. Does that matter?

I copied code from TenX, which copied code from OpenZeppelin. TenX and OpenZeppelin has this code for contract ERC20Basic: contract ERC20Basic { uint256 public totalSupply; function balanceOf(...
0
votes
1answer
124 views

Browsing a mapping variable

This is my contract where I am building a list of members who will use a addVote function. The allMembersVoted function always seems to return false even though the Remix debugger shows that, the ...
0
votes
0answers
266 views

Invalid opcode during division

I have seen many posts around the division operation in Solidity e.g. Cant' do any integer division. Firstly, the error I am facing is different. Secondly, I am ensuring that, all numbers in division ...
0
votes
1answer
2k views

invalid address error on running code - solidity

Here is my code : var Web3 = require('web3'); var fs = require("fs"); var Artifactor = require("truffle-artifactor"); var provider = new Web3.providers.HttpProvider("http://localhost:8545"); var ...
0
votes
0answers
467 views

returning struct in solidity

I have seen here that we can return struct for internal functions. Why can we return struct for non-internal function? Also, I can see in the same link "structs would have to be integrated into the ...
0
votes
1answer
69 views

Time-Currency Tokens

How would you go about creating a token that has a value based on time? (Time-currency Tokens) What would be the solidity code be? I can't find much examples on this. Thanks.!
0
votes
1answer
86 views

Question about how to have interacting contracts

Let's say I'm doing a crowdsale, but instead of selling a set amount of tokens I'm just giving tokens away at a pre-set price. In other words, my token has the following functoin: function give(...
0
votes
1answer
275 views

Modifiers misunderstanding

pragma solidity ^0.4.0; contract test { bool test_bool1 = false; bool test_bool2 = true; modifier test_modifier(bool _test_bool){ if (_test_bool == false) throw; _; } ...
0
votes
0answers
625 views

Solidity "Error: Invalid type for argument in function call. Invalid

This error doesn't make sense Error: Invalid type for argument in function call. Invalid implicit conversion from function (bytes memory) external to function (bytes memory) external requested.
0
votes
1answer
27 views

How to signTransaction of a smart contract methods?

I have a smart contract contains this method: function addOneUser (User memory _user) public { bytes32 hash = keccak256(abi.encode(_user.name)); users[hash] = _user; } I want ...
0
votes
2answers
76 views

ParserError: Expected pragma, import directive or contract /interface/library definition

In an attempt to compile my ABI and verify my contract, I am getting the following warning: "ParserError: Expected pragma, import directive or contract /interface/library definition" on the first line ...
0
votes
3answers
157 views

condition check of struct mapping in solidity?

struct User { string username; string password; address userid; bool isAdmin; } mapping (uint => User) users; function checkIfUserExists(address userid) public ...
0
votes
1answer
32 views

Get deployed contract details from Private network in all connected Peers

I have created one Ethereum private network and added two nodes inside that n/w. I have migrate one contract using truffle in that n/w from one node. Now I want to access that contract inside ...
0
votes
1answer
19 views

create Tookens problem

For some time I have been writing my own tooken. I call it COIN I come across the last three problems: my fallback function does not work code: function () payable { createTookens (); he ...
0
votes
3answers
862 views

How to get events result using web3 1.0.0 version

function depositToEscrow(bytes32 _id) public payable returns(uint) { DepositToEscrow(msg.sender,orderdata[_id].buyer,msg.value,orderdata[_id].amount); } suppose this is my function in a smart ...
0
votes
1answer
567 views

use metamask to send eth to many adresses

i want to use metamask / myetherwallet and not mist because of sync problemems to send token to 100 addresse i have this code (solidity) but i dont know how to implement it please help me link ...
0
votes
1answer
1k views

Please provide example for web3.currentProvider

The following document states that "MetaMask is going to continue to inject the ethereum provider as web3.currentProvider for the forseeable future.": https://github.com/MetaMask/faq/blob/master/...
0
votes
1answer
74 views

Parent-Child Contract Synergy Broken

When I call a function from a child contract which has been generated through a parent contract, then the mapping within the parent contract which consist of information related to the child contract (...
-1
votes
0answers
15 views

Type Error: Invalid Implicit conversion from uint256[1] memory to uint256[2] memory

I am facing an error while deploying a contract containing the following code, //Original Code pragma solidity ^0.4.14; import './Verifier.sol'; contract sha256hash is Verifier { bool public success ...
-1
votes
1answer
64 views

Unable to test a smart contract on ropsten test network

I launch and verify an ERC20 based smart contract on a ropsten test network which allows user to interact with the contract (send eth to it and the contract automatically send token in returns as in ...
-1
votes
1answer
50 views

Smart contract to strore and retrieve address and ID in blockchian using mapping

I want to store some address and their ids in blockchain using mapping and i want to know how to get the stored addresses when searching with their respective IDs.
-1
votes
1answer
59 views

Problem retrieving array of struct with web3js

I'm trying to return the struct values contained in array everytime i push a button thet call inserimento and ritornavalore functions. here is my code in solidity: pragma solidity ^0.5.1; pragma ...
-1
votes
1answer
436 views

How to concatenate string array into a single string

I am trying to concatenate a whole array of string into a single array for printing purpose. function getArray() public view returns (string) { arr.push("Max"); arr.push("good"); arr....
-1
votes
1answer
321 views

How to diagnose “invalid opcode” when compiling?

I have a huge contract so isolating the cause will be very arduous manually. Is there any way to get an indication automatically of what might be causing an "invalid opcode" error?
-1
votes
1answer
62 views

Capture Solidity Emit Events without Web3 — E.g., Calling via Postman

Is there some way to capture Solidity Emit Events without the use of Web3? For example, I am calling via Postman JSON RPC eth_sendTransaction. How to capture the returned results?
-1
votes
1answer
64 views

Interacting with Ethereum smart contract that has been deployed via address

I'am total beginner in Ethereum so how to interact with smart contract via address ? here is the address : 0x259a065256212183490b3ee3f4702c900c37d712 ABI: [{"constant":true,"inputs":[],"name":"...
-1
votes
1answer
366 views

how to withdraw ether from a ERC20 token contract Address

how to add withdraw function to get smart contract ether to my wallet https://github.com/rohitsahu21/Token-Sale
-1
votes
1answer
233 views

why appears this warnings

browser/ballot.sol:3:28: Warning: Functions in interfaces should be declared external. interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes ...
-1
votes
1answer
387 views

What is the data option of eth_sendTransaction?

I am trying to send ERC20 token using JSON RPC. I am very new in this step and learning. I am using eth_sendTransaction function. What is "value" and "data" option in this case ? Please help
-1
votes
1answer
279 views

minimum investment required during ICO?

how and where to set minimum investment in ETH & BTC in ERC20 contract ? done lots of google search but cant able to find the suitable article or tutorial how to place it in !
-1
votes
1answer
79 views

Trying to create a simple coin, but getting warnings for the last two functions. Can you find and solve the error?

pragma solidity ^0.4.0; contract Bubblecoin{ mapping(address => uint) balances; uint supply; function totalSupply() public constant returns (uint){ return supply; } ...
-1
votes
1answer
182 views

Value of msg.sender is not changing after specifying {from} in truffle

Given two contracts : contract First { function cSender() public view returns(address){ return msg.sender; } } contract Second { First f; function Second() public { f = new First(); ...
-1
votes
1answer
325 views

What is the problem with Transfer function?

Here, ERC20(token) - 'token' is given Undeclared identification issue, why? // low level token purchase function function buyTokens(address beneficiary) public payable { require(beneficiary != ...
-1
votes
2answers
1k views

How to deploy a contract in web3js?

I tested in testrpc, and already learned how to create and deploy contract by geth commands, but always failed in web3js script. my very simple contract: pragma solidity ^0.4.18; contract Test { ...
-2
votes
1answer
1k views

ParserError: Expected '(' but got identifier function OrderItem(uint _itemid, string _itemname) public returns(address){

browser/Logistics.sol:60:14: ParserError: Expected '(' but got identifier function OrderItem(uint _itemid, string _itemname) public returns(address){ ^-------^ pragma solidity ^0.4....
-2
votes
1answer
96 views

browser/ballot.sol:102:16: ParserError: Expected '{'

I'm trying to create an ERC20 Token just testing how it works, but unfortunately, I get this Error: browser/ballot.sol:102:16: ParserError: Expected '{' but got identifier contract TEST TOKEN is ...
-2
votes
1answer
46 views

Solidity expressed in different languages such as chinese?

I refer to the ethereum yellow paper. "Driving Factors. There are many goals of this project; one key goal is to facilitate transactions between consenting individuals who would otherwise have no ...
-5
votes
1answer
364 views

ParserError: Expected token Semicolon got 'If' if (tokens > balanceOf[this]) { ^

function () payable { require(balanceOf[this] > 0); uint256 tokens = 5000 * msg.value / 1000000000000000000 if (tokens > balanceOf[this]) { tokens = balanceOf[this]; ...

1
31 32 33 34
35