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,742 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
324 views

Ropsten contract execution [Reverted]

Can someone help me and tell me where in my code is the problem. How to fix this ? https://ropsten.etherscan.io/tx/0xbd2079c12f90bb9396d79e7aeb5b5914472dd25c9e62ce36ffa85f6e88d7b594 Is there any ...
0
votes
1answer
155 views

Private Ethereum Smart Contract API call to notify (without needing the external api response to update the state) without using Oraclize

In a Private Ethereum Smart Contract, can we do an external API call just to notify (without needing the external api response to update the state) without using Oraclize? Understand Oraclize is ...
0
votes
1answer
68 views

Does this function makes my contract weak?

Ive just published a contract to etherscan, but notice something that i miss. One of my payable function (deposit()) is not set to be called only from owner. Is it going to make me troubles and should ...
0
votes
1answer
128 views

How to use web3.py to get data from public chain

Platform: Win10+geth1.8.2 I have opened geth to sync block, it's ok to use 'geth attach' directly, but I can't get any return from web3.py. Anyone can help me?
0
votes
0answers
367 views

Solcjs doesn't use the last version of compiler

I am compiling a contract using the npm package solcjs. The package is at version 0.4.21 (npm view solc). However compilation fails because my pragma is set to ^0.4.21 while solcjs states current ...
0
votes
0answers
30 views

Why would push in solidity only push once?

I have the code which follows. It adds the hashes into contracts fine but the my myHashes array gets just one value at 0. Is there any reason why this push would fail? pragma solidity ^0.4.18; ...
0
votes
0answers
69 views

how to refer a previous transaction in current transaction in ethereum private blockchain

I am trying to build an private block chain based use case (not a financial one) to benefit from the decentralized nature of BC. The scenario is something like this, there are multiple nodes connected ...
0
votes
2answers
336 views

Is there a way to dynamically create a contract that points to a previous contract?

I would like to implement a tracking system .. where i track events between two parties who deliver an item between them .. then the receiver would deliver it to another person and so on... I would ...
0
votes
1answer
60 views

Retrieval of signer

What are the values of v,r,s in ecrecovery? function dsign(bytes32 hash) public constant returns(bytes32){ bytes memory prefix = "\x19Ethereum Signed Message:\n32"; bytes32 prefixedHash = ...
0
votes
0answers
631 views

Listen to emitted event from front-end

Could somebody please provide me code that works to listen to an event from your front-end. It was working for me and there are a few tutorials that I've tried now to fix it but it still persists with ...
0
votes
0answers
90 views

Best practices for handling payment in smart contracts

I am developing a Dapp in which users can buy and sell stamps. I have two different smart contract with the following struct each (plus setter/getter functions): //Stamp.sol struct Stamp { ...
0
votes
0answers
241 views

In truffle Console Works, but when called in Javascript, Metamask hangs, Solidity contract doesn't update

So I have a function where I am asking the user to send two strings and 1 ether at the same time. When I execute the function in the console, the solidity contract is updated. When I execute the same ...
0
votes
0answers
68 views

Why does this contract work on Ropsten but not on a private blockchain?

The following contract runs successfully in Ropsten but not on a private blockchain. I assumed it could be a gas issue. So I increased the gaslimit and started a new blockchain but I get the same ...
0
votes
0answers
110 views

Using Oraclize for ICO smart contract

What is the advantages of using Oraclize for the development of an ICO Smart contract? doesn't it just add unnecessary complexity?
0
votes
1answer
98 views

Getting error : This type of error is only supported in new experimental ABI Encoder while passing struct inside function

How can I pass struct to Function I tried doing it but all in vain struct testSruct { uint size; } function testFunc( testSruct test) public returns(bool replaced) { return true; } ...
0
votes
0answers
40 views

Transfer token automate

I'm new to solidity I need to transfer my token(ERC20) to a list of specified addresses. pragma solidity ^0.4.19; import "./BorgiasCapitalFundToken.sol"; contract SendBCF { ...
0
votes
1answer
62 views

Transferring files over blockchain from ropsten-test network

I am new to blockchain and working on a university project. I am trying to simply buy and sell music over the blockchain. Currently I am using a string to act as the 'transaction', but learnt this ...
0
votes
0answers
80 views

Sending ether from contract cause error

Hi In my contract I send ether from my contract to other address like address.transfer(winnerAmount);. It transfer ether successfully if my array have one address. If I have more than one address it ...
0
votes
1answer
136 views

Generating ERC20 Token on main network

I have done up the scripts on Remix and managed to generate Tokens successfully on Ropsten Network. However, when using the exact contract script on actual main network, the status remain as "pending ...
0
votes
0answers
97 views

Storing string containing delimiters in contracts - Error: invalid argument 0

I have created an array in contract where I'm pushing a string(concatt = IN23450.001 by concatenating 'IN2345' and '0.001'). Contract contract BDetails { struct Details { bytes32[] ...
0
votes
1answer
186 views

Solidity | How to throw “string” argument using Send() function?

I have a function which get a parameter as String and compare it like below. function freezeAccount(string _value) onlyOwner public { if (keccak256(_value) == keccak256("true")){ isFrozen = "true"...
0
votes
2answers
345 views

Stuck at emitting an event in Solidity

I am stuck at Step-6 of Bitdegree's Solidity tutorial. Question is to Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up ...
0
votes
1answer
184 views

How to send ERC20 to 0x0000000000000000000000000000000000000000

How to send ERC20 to 0x0000000000000000000000000000000000000000 I have tried to do this on myetherwallet and it will not send as a transaction, is there a special way to send here? Thanks
0
votes
0answers
27 views

Return a value while hiding output from logs

I would like to return a value to one ethereum address without the other parties of the contract seeing the returned value. The returned values always show up in the logs as decoded output. How do I ...
0
votes
0answers
307 views

Send request failed { code: -32602, message: 'invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash' }

I am new to ethereum and deploying my first contract with simple method getting following error: [2018-03-24 11:08:14.364] [ERROR] ipcProviderBackend - Send request failed { code: -32602, message: '...
0
votes
2answers
187 views

A function declared payable is throwing a VMerror:revert in Remix

I was trying to fund a campaign created with a funding goal 10000000000000000000 and funding cap 10000000000000000000 by calling the payable method contributeMsgValue with parameter["...
0
votes
1answer
52 views

How to automate blockchain transactions of users without having to ask them to enter wallet addresses?

I am working on a game with an in-game currency. The goal would be that when a player buys something, he only have to click on buy, without having to enter the public address and so on. Are smart ...
0
votes
1answer
737 views

Web3 | TransferFrom() transactions always Failed

I'm trying to send Custom ERC20 Token to Owner Wallet Address using transferFrom() function using Web3.js However all the Transactions are failed. Which is the same problem occur on Remix IDE. Some ...
0
votes
1answer
53 views

How to use web3js to call a function with “payable” and transfer some ether to contract?

My code is like this : gameInstance.initGame.sendTransaction({from: webInstance.eth.coinbase, to: contractAddress, value: webInstance.toWei(person_num, "ether")}); Of course, it doesn't work very ...
0
votes
2answers
67 views

How many functions allowed per contract? + solidity

I deployed a contract to ropsten and tried to call a method from frontend, but was getting TypeError: Cannot read property 'call' of undefined So I checked my instance via this.Test.deployed()....
0
votes
0answers
287 views

Calling function of one contract in another using truffle

I have one contract and in it's constructor I have initialized properties of balances contract TestChainCoin is RefundableCrowdsale { function TestChainCoin() RefundableCrowdsale() { ...
0
votes
2answers
83 views

Adding mincap in the crowdsale code and returning the funds on not reaching the goal

I have generated a crowdsale contract and i want to add mincap to the crowdsale so that after reaching the mincap and not achieving the goal, the crowdsale will return all the funds to the investors. ...
0
votes
1answer
309 views

How to prevent callback event occur twice?

Hi this is my web3 code events.watch(function (error,result){ if (error) { console.log('Error:'+JSON.stringify(error)); res.send({'status':0,'message':...
0
votes
1answer
225 views

Can't invoke SC function: Error: gas required exceeds allowance or always failing transaction

I've deployed my smart contract to Rinkeby test net. The "addProject" function works fine. But when I try the "addProjectFile" function I got error. "Error: gas required exceeds allowance or ...
0
votes
0answers
932 views

Getting a contract's fallback payable function to fire from another contract?

My contract (contract A) is meant to send txs to another contract (Contract B). I want to end up having the fallback payable function of Contract B get called. I try to accomplish this by making a ...
0
votes
0answers
307 views

Consequences of 'VM Exception while processing transaction: invalid opcode'

The question Hello everyone, could anyone explain to me the consequences of: VM Exception while processing transaction: invalid opcode. The context I'm passing in an integer in web3js that is not ...
0
votes
3answers
355 views

What is the right approach to implement payable fallback function in crowdsale contract?

I am implementing crowdsale smart contract to accept ether and invoke ERC20 smart contract to assign tokens count calculated depending on the amount of ether invested. I heard that just implementing ...
0
votes
1answer
173 views

Why does the transaction stay in queue from more than 240 second

I am running quorum nodes via the Quorum-maker script, and when trying to call functions from my already deployed smart contract, I get this error : Transaction ...
0
votes
1answer
199 views

transfer/send error cases

I have a (noob) question on the usage of transfer and send. I have seen that transfer is equivalent to require(x.send(k)); When I use send() I know that I have to check whether there was an error ...
0
votes
2answers
126 views

How do I make sure that no one else deploy crowdsale on my token except me?

I have ERC20 fixed amount token, And I want to deploy pre-ICO crowdsale and later ICO crowdsale contracts. How do I make sure that no one else deploy crowdsale on my token except me?
0
votes
1answer
271 views

Threat Model Question - Code Injection / ROP possible in Ethereum Smart Contracts?

I am trying to understand a basic threat model for Ethereum Smart Contracts, to perform some research on how existing attacks techniques may be applied here as well. Is there a risk of a contract with ...
0
votes
0answers
444 views

web3.eth.call() to find token balance

data = web3.utils.sha3('balanceOf(address1)').slice(0,10) + randomstring.generate({ length:24, charset:'0'}) + address1.substring(2); web3.eth.call({to : config.ContractAddress, data : data}).then((...
0
votes
2answers
184 views

Empty bytes32[] in truffle console

I am trying to get from truffle develop console an array of identifiers using a custom get function but the return array is []. Here is my contract: pragma solidity ^0.4.18; contract MyInfo { ...
0
votes
2answers
444 views

How to destroy a token or list of token from a another contract?

[Edit 14-03-2018] I want to create a contract A that can generate a random number of Token A and another contract B that receive and destroy one or many of this token to generate a new Token B. It's ...
0
votes
1answer
533 views

Time Specified calls in Solidity using Oraclize

I have started learning coding in Solidity and I have written the below contract using the official Oraclize guidelines. My aim is to: Make the update() function be called on its own on the ...
0
votes
1answer
67 views

Using oraclize function into fallback function

I have an issue with my oraclize. I need to call oraclaze for update exchange rate. If i call function updatePrice() manually - it's ok, global variable dollarCost is updating. But if I call ...
0
votes
1answer
245 views

How to access storage areas when libraries are used?

I am testing storage areas to see exactly the efficiency aspects of this and I have trouble finding the storage on the disk for the contract/library combination. Here is the code - pragma solidity ^...
0
votes
1answer
139 views

How blocks are verified in a private blockchain?

I have created a private blockchain in my machine and deployed a smart contract in the same. Then I have created a UI using web3. I could add peers to that network and all the peers could get the data ...
0
votes
1answer
237 views

Accesing state variables in an other contract

I as trying to add methods in a contract, but it got so big that i couldn't deploy it with truffle. Now i need to create an otehr contract that will be called instead of the original contract to ...
0
votes
2answers
309 views

ERC20 How to transfer the balance to a new address

I want to call the ERC20 contract with other contracts and transfer the corresponding balance to the contract caller. What should I do?