Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
1answer
21 views

How to set up Quorum Blockchain?

I have read a lot about Quorum blockchain. My goal is to run and test it. I have found many articles. Could anyone suggest me good start-up articles for setting-up the Quorum on a number of nodes and ...
0
votes
2answers
19 views

No such file or directory: 'solc': 'solc'

I have been trying to follow the following tutorial [https://github.com/adamyala/Your_First_Decentralized_Application_Python] But the following error occurs: I have followed all the steps in ...
2
votes
1answer
13 views

What is the alternative to using **label** in solidity inline assembly code?

What is the alternative to using label in Solidity inline assembly code? Label is deprecated in new version.
0
votes
0answers
19 views

ERC721, approveForAll-implementation, and others

I am currently implementing ERC721 as the standard for token-exchange in the game I am programming. I am taking inspiration from the CryptoKitties-smart contract. One thing I have realized, is that ...
2
votes
1answer
17 views

Invalid implicit conversion from uint256 to bytes memory requested

I am trying to create a simple random function but it gives me an error. I can't figure out what I do wrong. Solidity 0.5.0; function random() private view returns(uint){ uint source = ...
2
votes
0answers
39 views

Solidity get return variable from a send method in React

I'm trying to call a method that pushes data to my Blockchain and then returns back the ID of the new struct I created. This is how I'm calling the method in my React code: const documentId = await ...
0
votes
0answers
23 views

Solidity and mongodb

Hello I have to create dapp, and more specific I want to create something like store where people can create items and sell them. The problem is I want to keep information about the items offchain (...
1
vote
1answer
23 views

Solidity Vs Vyper

What is the key differences between Solidity and Vyper? In present and future which one can more acceptable for making smart contracts and why?
1
vote
1answer
14 views

Augur, publicBuyCompleteSets reverts

I'm building a contract function that purchases and distributes complete sets of AugurShares for a specific market. (Testing on Rinkeby). Version of Augur-core (node_modules/augur) used: https://...
0
votes
0answers
13 views

Verify transaction was included in certain block within smart contract

Is there a good resource for proving that a particular transaction was included in block x?
1
vote
1answer
20 views

Method to verify an address nonce within a contract?

Hey I'm looking for a simple way to verify that a certain address has executed x number of transactions? I noticed that this can be accomplished by having them deploy some contract and verifying ...
0
votes
1answer
24 views

Is there any Reentrancy attack in given code snippet? If yes then how can I fix it?

function withdrawForeignTokens(address _tokenContract) onlyOwner IsAuthenticate public returns (bool) { ERC223Interface token = ERC223Interface(_tokenContract); return token.transfer(...
0
votes
0answers
32 views

TypeError: Data location must be “memory” for parameter in function, but none was given

Contract fail to compile in IDE Remix.due to the following error: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. version:0.5.6+commit....
-2
votes
0answers
21 views

Error: Type “mapping(string => string)” not supported for state variable.\n\tmapping (string => string) dataLink; [closed]

My work is in terminal. First i install the solidity compiler by $ sudo npm install solc@0.4.11 $ node ...
0
votes
0answers
20 views

Not storing Item in variable

I am working on making a game where users can collect items. I have chosen to store the ERC721 tokens that represent the items in this way: Item struct: User struct and map that maps account-...
0
votes
2answers
22 views

Getting error in truffle migrate

I am trying to compile a sample solidity contract,sampleapp.sol. The code is given below: pragma solidity >=0.4.21 <0.6.0; contract SimpleStorage { uint storedData; function set(uint ...
1
vote
1answer
20 views

Check Augur market validity in solidity contract

I'm trying to validate my market created through my node on Rinkeby Testnet. I created some markets on Rinkeby Testnet (using Augur.js) running my own Rinkeby Augur node. When I get the markets ...
0
votes
1answer
17 views

Is there a good erc20 source using web3js?

I'm looking for some source codes using web3js for interaction with erc20 tokens and contracts. Does anyone know good source codes using web3js? Thanks in advance!
0
votes
0answers
5 views

How to make contract on MEW to forward all eth from address to address automatically every second? [closed]

help me please. How on MEW with new interface make contact that will forward all future transactions on other address? For asnwer that helps i will send 0.30 eth Thank you!
1
vote
2answers
121 views

what is the meaning of 0x0? say when variable gets assigned to it, example: keccak256(number) = 0x0;

Is 0x0 just zero? thanks keccak256(number) = 0x0; Or when not used as address I mean just to denote variable?
1
vote
1answer
29 views

Ideal way to store hash on the ethereum blockchain

I would like to store a certificate on the blockchain. I only need to store its hash and if its been verified by both parties or not. Should I create a struct that is made up of bytes32 for the hash, ...
0
votes
0answers
17 views

Error while running npm run

sh: 1: lite-server: not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! eth-todo-list@1.0.0 dev: `lite-server` npm ERR! spawn ENOENT npm ERR! npm ...
1
vote
1answer
30 views

I can't able to understand the following function in the solidity

function multiowned(address[] _owners, uint _required) { m_numOwners = _owners.length + 1; m_owners[1] = uint(msg.sender); m_ownerIndex[uint(msg.sender)] = 1; for (uint i = 0; i < ...
3
votes
2answers
54 views

Truffle Test Issue With `address payable` and Compiler Version

I am trying to run truffle test on an old contract which was written using pragma solidity 0.4.24;. While I am able to deploy the contracts using truffle migrate, I get the following error when ...
0
votes
0answers
19 views

Best way to support restoring of all the keys of a mapping

I have a contract, in which I maintain the keys of a mapping in two different ways: Storing each key in an array Emitting an event for each key I do this in order to be able to restore the keys (and ...
1
vote
1answer
28 views

Smart contract now vs javascript now

I have a trouble with comparing timestamp parameter(in test) and now in smart contract. Here is my smart contract: function create(uint created_at) public { require(now > created_at, "The ...
0
votes
1answer
48 views

Mapping problem

**I am Using Solidity compiler 0.4.11 When I compile my code i get the error that is " Error: Type "mapping(string => string)" not supported for state variable.\n\tmapping (string => string) dataLink *...
1
vote
2answers
32 views

Smart contract that receives only one token

Is it possible to forbid to a smart-contract to receive all erc20 tokens and ether except my own token that was created in another contract? I mean I want my contract to receive only tokens from ...
0
votes
1answer
23 views

How to get total values in mapping and details of each transaction

I am trying to write a simple contract contract students{ uint public totalTokens; constructor() public { totalTokens = 800; } struct Students{ uint amount; string givenFor; } mapping (...
2
votes
2answers
57 views

Cannot able to call the contract inside the truffle console

I am new to the truffle framework. I have initialised my contract Dapp with the constructor function as given below pragma solidity ^0.5.0; contract Dapp { uint public totalSupply; ...
1
vote
0answers
14 views

Can I extend the interface of a contract without redeploying it?

The case I'm dealing with is a contract which should serve as a Data Abstraction Layer. So ideally, it should provide only getter functions and setter functions. For example, my interface is: ...
0
votes
0answers
25 views

Type Conversion

I am getting an error on line "_tmp[i] = bytes1((_base % 10) + 48);" and it says explicit type conversion not allowed from "uint256" to "bytes1". The code snippet which i have enclosed converts an ...
0
votes
1answer
12 views

error handling in sending custom token to multiple addresses in one transaction

i am trying to write a contract in which there is a function to divide the amount into equal parts and then deposit it into multiple accounts in one transaction. The problem is that, i want function ...
0
votes
1answer
25 views

Solidity Contract Deployment fails - but account has plenty of ETH

I was just trying to deploy a new contract on the Ethereum MAIN-Net (not Ropsten, Rinkeby or the other test-nets) - and I’m getting this strange error: Message: sender doesn't have enough funds to ...
0
votes
1answer
18 views

Replacing a requirement for TRC10 token with TRC20 on a TRX contract

I have a contract that allows users to buy a token and pay with a TRC10 token deployed on Tron. Is it possible to replace the token ID with a TRC20 address instead? And if so, how do I implement it? ...
-1
votes
1answer
22 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.
0
votes
0answers
27 views

Issue calling one contract from another using Quorum

I'm using truffle and running locally with 4 quorum nodes, trying to call another contract's function, but keep getting 0 in return instead of the expected value the I get once calling the contract ...
-3
votes
0answers
16 views

web3 = new Web3(provider); showing that the referenceerror: require is not defined

^ ReferenceError: reuire is not defined at Object.<anonymous> (/Users/rushi/eth/inbox/test/Inbox.test.js:8:15) at Module._compile (module.js:643:30) at Object.Module._extensions..js (...
0
votes
0answers
28 views

Function works on ethfiddle but reverts in mist

I've had this occur a few times, where I create a smart contract and one of the functions works in ethfiddle but reverts in Mist. I realized that in the Mist wallet, when I run the functions that fail,...
1
vote
1answer
28 views

Token real synchronization from my website

I like to integrate a real token synchronization (From distributer wallet account to user's wallet address the token need to transfer) in my website. My website needs to interact with the blockchain ...
0
votes
1answer
23 views

Expected ';' but got 'payable'

I have written following Smart contract. pragma solidity >=0.4.17; contract factoryCampaign { Campaign[] public deployedCampaign; function createCampaign (uint256 minimumContribution) ...
-2
votes
2answers
36 views

Type Conversion and Operator Compatibility [closed]

The code snippet i have included Converts an ASCII string value into an uint as long as the string its self is a valid unsigned integer and i am getting errors on line "assert(uint8(_bytesValue[i]) >= ...
0
votes
1answer
21 views

How “factory” codes are used in proxy contracts?

What is this factory_ exactly in the following piece of code? constructor(DSProxyFactory factory_) public { factory = factory_; } https://gist.github.com/Sowmayjain/...
0
votes
1answer
25 views

Gas specification for function call

Is it possible to specify gas cost for a particular function call? E.g. Let's say I want a transfer() function to cost 50000000 gas, would I be able to hardcode this into the function?
0
votes
0answers
35 views

transferFrom function works but approve does not

I'm building an escrow contract and using web3js to interact with it. Currently, I am trying to approve and send an amount of custom ERC20 token from a wallet to the escrow contract. The problem is, ...
7
votes
1answer
88 views

Why does adding a view function make write functions cost more gas?

When I add a view or pure function to a contract, it sometimes impacts the gas costs for unrelated write functions in the same contract - requiring another 22 gas. pragma solidity ^0.5.0; contract ...
1
vote
1answer
33 views

can't call function from contract using web3.js due to gas issue

i'm really new to ethereum and solidity, so any help will be approtiat. i'm building a smart contract and dapp using ganach and web3.js . in my smart contract I have a function(named "add_pilot") ...
1
vote
1answer
16 views

Location specifiers in solidity function parameters

I understand that I need to tell solidity where a parameter is located, for example a string: function f(string memory abc) {... Because a string could be calldata (passed in original method call) ...
0
votes
2answers
32 views

After compiling contract, there is no build directory inside project directory?

After writing 'truffle compile' in terminal , it just give the message i.e. compiling your contracts...and exit, no build directory is formed in Project directory. What is the issue?
1
vote
1answer
23 views

What is the time zone of the Ethereum block chain?

In Solidty, you can use now keyword or block.timestamp to get the timestamp of the current block. This value, which is set by the block miner, can be used to work with time in your smart contract (...