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.

1
vote
0answers
28 views

What can be the difference between Remix VM, Ganache win, ropsten?

I cannot share the code, but in short something based on a payable fallback in a complicated multi contract application has this behavior: 1) tested in remix using VM: perfect 2) tested in remix on ...
1
vote
1answer
20 views

How to access nested struct values?

I'm new in solidity programming so for learning purpose I'm developing e-voting system using ethereum blockchain. Code mentioned below, pragma solidity 0.4.25; contract RegisterCandidate { // ...
3
votes
1answer
36 views

How to make an array of functions, and how to call it

this: mapping(uint => function()) funcMap; doesn't give any error in Remix. But I don't know how to call it: pragma solidity ^0.5.2; contract b { mapping(uint => function()) funcMap; ...
1
vote
2answers
62 views

Inheritence in Solidity

I want to implement my contract in much better way and want to use the inheritence. I wrote the code and i face one problem that i want to access the mapping variable of Contract A in the Contract B. ...
1
vote
1answer
25 views

Why do we have to mention Solidity version?

While writing code in solidity, why do we have to mention the compiler version?
0
votes
1answer
25 views

Key-value immutable storage: on-chain vs IPFS

I'm currently working on a D-App for a client. It's basically a temper-proof immutable storage of 'objects', each object being defined with 8 key-value pairs (strings) and a collection of pictures. ...
0
votes
1answer
25 views

I need to have a simple contract for sending ether from one account to another account with specified values?

pragma solidity ^0.5.2; contract sendEther{ address payable rec= address(0xD694fab8b63BeF0149aa47b8333dFeAe7f55E9C7); address public sender = msg.sender; function send() public payable{ rec....
1
vote
1answer
36 views

Couldn't understand the error message: ParserError: Expected ';' but got '(' Constructor Survey (address _owner) payable public

pragma solidity 0.5.0+; contract Survey { /* Events */ event SurveyInitialized(address indexed owner, uint indexed surveyReward); /* Contract State */ address public owner; ...
0
votes
0answers
17 views

solc/wrapper not working with reactjs

My compile.js code: var wrapper = require('solc/wrapper') var solc = wrapper(window.Module) const Compile = (code,name) => { return solc.compile(code, 1).contracts[':'+name]; }; export default ...
0
votes
1answer
44 views

I need to know how to send ether from one address to another address for my Dapp

I have coded the below code it executes well but the ether cannot be send only the gas fees are sent? pragma solidity ^0.5.2; contract sendEther{ address payable rec= address(...
0
votes
1answer
30 views

Is it ok to build app with huge data in ethereum blockchain

I agree that the smart contract works well for small Apps. Is it ok to develop a app with huge data. For this let us take an example of building a huge patient database across hospitals (only with key ...
1
vote
0answers
34 views

Interacting with contracts on Solidity 0.4.* and Solidity 0.5.* in Truffle v5

I have a big contract (A) that is built using Solidity 0.4.25. I also want to build several contracts (B) that will talk to (A), but they will be built using Solidity 0.5.*. As I understand, I will ...
1
vote
1answer
29 views

Any who has done any smart contract analysis? [closed]

I want to analyze smart contract application and I wanted to know if there is a crawler for it and after the contracts have been crawled using the data's from the contracts to analyze each block.
1
vote
1answer
34 views

Compiling error when using .value() for sending money between contracts using solidity and truffle framework

Dear fellow block builders! I am new to this field and I would like to implement my first project mimicking the famous DAO attack using re-entrance. I've programmed two smart contracts - the DAO and ...
0
votes
0answers
17 views

Estimate Gas Error when deploy smart contract on Rinkeby

When deploy the smart contract to rinkeby i got this error But the same code deployment run successfully on Main net and Ropsten. Any idea how this happen?
5
votes
2answers
99 views

Return the struct inside array inside array

pragma solidity >= 0.4.25 < 0.6; contract Bank { struct Customer { uint age; } Customer[][] customers; function foo() public { if (customers.length > 0) { ...
0
votes
1answer
26 views

Supply amount exceed total supply! Why the quantity supply shown 1.00 E+59

the quantity amount over the total supply, shown 1E +59 Airdrop solidity code maybe got something problem, does someone had idea?? Can't check for token Holder, "Sorry, We Are Unable To Generate The ...
0
votes
0answers
23 views

How to generate sign to pass to transferPreSigned(), contract is not asking for sign while transfer()

I'm creating ERC865 token so that users can send tokens without having ether. I followed 1 and 2. As per 1, sender will sign transaction object while calling transfer() but I'm unable to see any "...
1
vote
2answers
66 views

Error when compiling

I'm using the latest version of Truffle. When I try to compile my contract I get this error. I don't know what is happening /home/josue/Desktop/blockchain/ebay/contracts/Migrations.sol:20:5: ...
0
votes
0answers
37 views

Save data of variable of smart contract in js

can anyone let me know how to save data of a variable of my smart contract in javascript variable. for example if i have a function in my smart contract and that function returns some value now how do ...
0
votes
0answers
15 views

Saving data from blockchain in javascript variable [duplicate]

Can anyone please let me know how to save a data from my solidity contract in my javascript variable. For example i have a function in my contract that returns a number now how do i save that ...
1
vote
1answer
31 views

Why am I getting “Trying to create an instance of an abstract contract.” error when I use factory contract pattern?

I have 2 contracts : Registry, Factory. Registry contract is compatible with ERC721 contract like this: pragma solidity ^0.4.24; import "../openzeppelin-solidity/contracts/token/ERC721/...
1
vote
1answer
25 views

Solidity ParseError with null

mapping (address => uint) itemsPerCreator; if (itemsPerCreator[_creator] == null){} Remix give me a error: ParseError: Expected primary expression. _creator is a addres type variable. Inside ...
1
vote
1answer
8 views

Token Transferring issue to the respective winner

My code has a function which randomly select a subscriber from the list and all of the sum of the tokens should transfer to the winner account address. but unfortunately it is not working for me. ...
0
votes
2answers
39 views

Trying to send balance to owner of contract

Code is: pragma solidity ^0.4.16; contract init { address owner; function init() { owner = msg.sender; } function send() public payable{ ...
1
vote
1answer
61 views

Issue in comparing token contract address and address(0) in Solidity 0.5.0

I am trying to compare the token contract address with the address(0). This was working fine in older version of truffle and solidity compiler (0.4.24). When I upgraded truffle and started using the ...
1
vote
1answer
67 views

Call a payable contract's function from another contract via an interface

I have two contracts, they are connected via an interface. When user calls contract1 function, it uses an interface to call contract2 function which updates it's storage. My problem is that I can ...
0
votes
1answer
21 views

Function execution right based on external contract state, ballot and proposal example

i'm building a sample application which require voting. I think it needs to be split into 2 contracts where the owner of Ballot will create Proposal contracts. Splitting simply because the logic is ...
1
vote
1answer
31 views

Initiate transaction from server to smart contract

In my case, i have an API written in PHP which periodically checks the database. If certain condition was met, i need to send an alert message from the API to an account/node in the Ethereum ...
1
vote
1answer
88 views

Out of gas error for a view function

having a problem with calling a method of my deployed contract in the main Ethereum network. I have a 'view' function which returns user's refund balance, everything worked fine in my local ...
2
votes
1answer
32 views

Unused variables warning in address.call return tuple (bool, bytes memory)

I have the following code fragment. function forward(address destination, bytes memory data) public { (bool res, bytes memory retData) = destination.call(data); assert(res); } Since retData ...
0
votes
0answers
20 views

Questions on MinterRole contract in openzeppelin

I am using the openzeppelin for creating the ICO contract. I am concerned about the MinterRole here. After I develop Token contract, I added the sale contract as a minter using "addMinter" function. ...
0
votes
1answer
43 views

About Abi Encoder V2

I came across the following code and found the term "pragma experimental ABIEncoderV2". Can anybody be specific in telling what this actually means? //pragma solidity ^0.5.2; pragma experimental ...
4
votes
2answers
104 views

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails. My process to deploy: 1) delete buidl/ folder 2) truffle compile 3) truffle migrate Truffle v5 ...
0
votes
1answer
32 views

How to check if number is not in array and then push it ;

How to check if number is not in array and then push it function randomnumber() public returns (uint){ for(uint i=1; i< 50; i++){ uint random = uint(keccak256(block.blockhash(block.number -...
0
votes
0answers
12 views

how to get return type of function of a deployed contract in another contract

I have 2 contracts - user and property. A person who is registered on the website through function registeruser in contract user, can only buy or sell a property in contract property. I have a ...
1
vote
1answer
36 views

How to extract “runtime” bin from a EVM bin found on etherscan.io

I would like to extract the runtime bin from the EVM bin that can be found in the etherscan.io. For instance for this famous contract (https://etherscan.io/address/...
0
votes
0answers
30 views

Terminal error when running node compile.js

Hi and please bear with me I'm a newbie to coding! I see someone else asked a similar question but there was no response at Invalid asm.js: Invalid member of stdlib when loading Remix IDE Anyway, my ...
0
votes
0answers
18 views

In Tether Token issue() and redeem() functions belongs to which Standard?

function issue(uint amount) public onlyOwner { //_totalSupply + amount must be greater than the _totalSupply value require(_totalSupply + amount > _totalSupply); //balance of owner + ...
0
votes
1answer
31 views

Error InternalCompilerError: Stack too deep, try removing local variables

pragma solidity ^0.4.23; contract CareerCertificate { struct Certificate { bytes32 a;// existente - DUDA bool b;// existente - DUDA uint c;// existente - DUDA bytes32 d; ...
1
vote
1answer
31 views

How to get the return type of a function of an already deployed contract?

I am currently working on a real estate blockchain project. Now I have 2 contracts user.sol and property.sol. The person who is registered on the website through user.sol can only buy or sell property ...
2
votes
1answer
26 views

How to set the call back in WEB3 with Jquery

I have 2 functions in blockchain contract to get the investors and funds for an address and tried to save that in excel. 1st Function To get the list of investors getInvestorsList() 2nd Function ...
0
votes
0answers
24 views

How to Transfer And TransferFrom On The Tether Smart-contract from another smart-contract? It uses onlyPayloadSize?

Hi I'm trying to call transfer and transferFrom on the Tether smart-contact token located at 0xdAC17F958D2ee523a2206206994597C13D831ec7. It is the only token I have a problem with transferring from ...
1
vote
1answer
27 views

Does a storage array have a unique address on the block-chain?

The question in the title is a little vague, so I will try to explain here. Suppose I have a contract with a storage array: pragma solidity 0.4.24; contract MyContract { uint256[10] public ...
0
votes
2answers
30 views

HMAC-x implementation for solidity

Is there any implementation of HMAC-SHA1 or HMAC-SHA256 or any other hashing algorithms for solidity? I found this but it's not working.
1
vote
1answer
40 views

Problem with approve and transferFrom for making payments using ERC20 Token Contract

I have a contract that uses the ERC20 token contract for making payments. Now, in the ERC20 token contract we have the following implementation of approve function: function approve(address _spender,...
0
votes
0answers
30 views

i can't get rid of this error

const HDWalletProvider = require("truffle-hdwallet-provider"); const Web3 = require('web3'); const {interface,bytecode} = require('./compile.js'); const provider = new HDWalletProvider( 'slim ...
0
votes
2answers
24 views

Why doesn't the EVM revert on integer overflow/underflow?

After writing a few contracts in Solidity, I've noticed a reoccurring theme of always having to think about possible integer overflow/underflow attacks. It seems to me that Solidity should be as ...
0
votes
1answer
37 views

Is it possible to have 15 variables in a struct in solidity?

I have a struct with two variables bool, nine bytes 32 and three uint. The problems I want to add another bytes32 but I get this error "InternalCompilerError: Stack too deep, try removing local ...
-1
votes
0answers
14 views

when to pass the gas as argument while testing the Smart Contract

I am going through one of the tutorials , and I am bit confused that when to pass the gas argument to send function. below is the screenshot in which gas is being specified as parameter. Now another ...