The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
2
votes
3answers
121 views

How smart contract transactions work?

I read that smart contracts don’t have a private key, so they can’t sign a transaction. My question is: when a smart contract starts a transaction to an EOA, how are we sure that the smart contract ...
3
votes
1answer
50 views

What are remappings and how do they work in solidity?

How can they be used with solc?
4
votes
1answer
123 views

What is SMTChecker used for in Solidity?

From the solidity docs: If you use pragma experimental SMTChecker;, then you get additional safety warnings which are obtained by querying an SMT solver. The component does not yet support all ...
5
votes
1answer
67 views

When should I use calldata and when should I use memory?

I have seen people use both memory and calldata keywords when writing Solidity. Specifically, they are used when declaring function parameters. When should I use memory and when should I use calldata?...
0
votes
2answers
42 views

Am I Generating Random Numbers In A Non-Mallable Fashion?

Would this be a non-malleable way to generate numbers for my particular use case? Let me explain: I allow people to register for a lottery-type event. If a winning seed belongs to their ticket set, ...
0
votes
1answer
29 views

Setting methods permissions a quorum network

I have 3 solidity smart contracts that run in a quorum network with 7 nodes. At the moment i use the constructor to set the owner of the smart contract, that is the node that deployed it. ...
0
votes
1answer
27 views

is it possible triggering a contract on specific date? [duplicate]

Can I trigger a smart contract on specific date? If I deploy a contract today and I want execute some function of that contract tomorrow without any exteral intervention. Is it possible?
0
votes
3answers
80 views

How do I make a smart contract send a message to a user along with a transaction?

Smart contracts can obviously send transactions through the Ethereum network but can they also send a simple message along with the transaction? Usaully you would put the message into hex code in the ...
2
votes
2answers
60 views

Drizzle and Contract Instances

I am currently developing a dApp with Drizzle on top of ReactJS. My project consists of, basically, 8 .sol files. 4 of them are just abstract contracts that include the functions, structs etc. for ...
1
vote
1answer
20 views

Are there identifiers for smart contracts?

Say I want to reference another smart contract in my smart contract. Do smart contracts have an identifier (like a number 0xjdjdjdjdjjddj etc.)? And if they don't, how would you reference a ...
0
votes
1answer
20 views

Passing blocknumber to eth.contract.method.balanceOf

I read that there is an option to pass blocknumber to contract.methods.balanceOf I am currently passing it like this: const address ='0x6C1F09F6271fbE133Db38DB9c9280307F5d22160'; contract.methods....
1
vote
0answers
46 views

Cannot execute contract in non-intaractive scripts

I want to deploy and to execute ERC-20 contract on geth with non-interactive scripts. But, it seems that non-interactive scripts and console shows different results. Enviroment ubuntu 18.04(docker ...
0
votes
1answer
26 views

I accidentally sent a token to a token contract. Can I get it back? $MWAT [closed]

community! Instead of transferring my ERC20 token $MWAT (RED PLATFORM) to my wallet, I accidentally sent it to the contract itself https://etherscan.io/tx/...
0
votes
0answers
11 views

Random Number Generation, Appropriate case or no? [duplicate]

I'm building a lottery where I need to generate a list of random numbers. Basically, I have a group of people who will commit to a prize by staking a certain amount of tokens to their commitment - ...
0
votes
1answer
106 views

How to use DAI in my contract

I'm familiar with smart contracts development. Although, every time I developed something, I used traditional ether. For the sake of simplicity, let's assume this contract. pragma solidity ^0.5.0; ...
0
votes
1answer
34 views

How to save data using multiple structures and arrays in solidity?

How can i use multiple arrays please? e.g: I have this contract: pragma solidity >=0.4.21 <0.6.0; contract SessionManagement { struct ChargeProfileSegment{ uint startDateTimeSeg;...
0
votes
0answers
54 views

How to get the result from another contract's Optional method while return empty if it does not exist or throws?

For example I want to write a contract where when one passes the address of another contract to it, it will check whether this other contract has the name() function, and if the name() function ...
0
votes
1answer
28 views

“onlyOwner” Function restrict the call from child contract

I have a basic knowledge of solidity. I am trying to create an upgradable ERC20 Token. For that, I create TokenStorage contract and Logic contract and trying to write the Proxy contract. In the Logic ...
1
vote
3answers
85 views

Alternatives to Metamask

What are existing alternatives to metamask with that works online inside existing browsers, that don't require installing a browser extension? What are some of the tradeoffs between them?
1
vote
1answer
61 views

VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if

Hi Guys 👋 I have two contacts first one is SubToken and second one is MainContract. First I deploy MainContract after that I use createNewContract function and I create new SubToken. and then I ...
1
vote
1answer
35 views

How can I reduce the gas price for the fallback function?

Below is my fallback function for ethereum. It currently require 91000 gaslimit which is way more than 21000. Metamask always starts the transaction with 21000 gas stipend due to which transaction ...
0
votes
1answer
46 views

What I need to verify contract with open-source license?

i m deployed contract in etherscan mainnet. i m verify it with open-source license like (MIT, GNU). now the problem were i don't know were to define license in etherscan ?? and etherscan will validate ...
1
vote
1answer
44 views

VS Code and Solidity files have a lot of warnings

Every time I use VS Code to develop Solidity, files I have a lot of this weird warnings saying: no-trailing-whitespace: Line contains trailing whitespace I googled a bit and I understand why they ...
1
vote
1answer
38 views

How to construct deployable bytecode from runtime bytecode?

For example I want to redeploy/clone a contract to another address but don't have the original source code, so I only have the runtime bytecode stored on the blockchain. If I try to deploy the runtime ...
0
votes
0answers
25 views

Ethereum Name Service implementation

I would like to create a Smart Contract that implements a name service. It will allow anyone to register a name. Once a name is registered and associated with an address, it belongs to that address. ...
0
votes
0answers
20 views

Does the use of Non-interactive zero-knowledge proof (zk-snark) will eliminate the use of (consensus algorithm e.g. work proof)?

The privacy of the blockchain transaction is a high-demand topic these days due to some application use case requiring strict privacy protection. Some of the techniques applied to blockchain ...
2
votes
2answers
49 views

Web3 - Access return value of events

I want to get the value that my smart contract returns in javascript. Here is the contract. (version 0.4.25 - web3 version 1.2) pragma solidity ^0.4.25; contract SimpleStorage { uint public ...
0
votes
1answer
168 views

problem connecting web3 v 1.2.1 with metamask : 'currentProvider' of undefined

I am using Web3 v1.2.1 with nodejs v10 and following this link. I am having issue connecting with metamask,below is my code snippet: const Web3 = require('web3') const window = require('window'); ...
0
votes
1answer
32 views

Is msg.sender.send(msg.value); safe?

Is there any sort of reentrancy attack that could go along with using this line of code in my smart contract?
9
votes
1answer
78 views

What will happen to legacy smart contracts when Ethereum 2.0 is released?

Most importantly, ERC20 and ERC721 tokens. Will they be migrated to the new chain? Will migration only be optionally possible for contracts with an owner? What about contracts which rely on proof of ...
3
votes
2answers
97 views

Solidity - Return value of Smart Contract Transact

Why do Solidity transact functions not return any value? Here is an easy example. I tested it in remix and web3. pragma solidity ^0.4.25; contract SimpleStorage { uint public storedData; ...
0
votes
1answer
48 views

Solidity event not showing up from Web3.js

I'm trying to set up an event in Solidity and listen to it from Web3 but I keep getting a null response. Here's my code: The relevant part of the contract: event NewUser(string userid); function ...
4
votes
1answer
48 views

Can a Smart Contract receive and send E-Mails?

As the title states, I would like to know whether one could create a smart contract on Ethereum that is able to send and receive E-Mails.
0
votes
1answer
36 views

Ethereum Contract Scalability (Single vs Multiple Contracts)

I am writing a token swap contract on Ethereum Blockchain to manage ERC 20 token swap in an exchange. The Questions is that in terms of scalability, which of the following two options would be better ...
1
vote
1answer
24 views

How do mappings in solidity occupy memory

Say, I declare a mapping that uses uint256 numbers as keys and maps them to a single 8 bit character. I add 5 members to this mapping. Obviously, I can then access any of these 5 characters using ...
0
votes
0answers
9 views

DigixDAO smart contract functionality/pattern

Can someone explain the usage of initialisation functionality and _resolver arguments in the various constructors of digixdao? i.e. following contract What is a resolver and isn't the job of a ...
0
votes
1answer
32 views

Solidity group addresses with a name. Eg: Whats app groups

I want to create a squad(group) which consists of a group addresses. Like Squad XYZ consists of Addr1 with name 'A',Addr2 with Name 'B', Addr3 with name 'C'. pragma solidity ^0.5.9; contract Squads{ ...
1
vote
1answer
47 views

How to get timestamp of an event log in emitted event from smart contract

I want to get the timestamp of an event. How can I get time of event fired, if the event data does not contain any time value?
0
votes
1answer
29 views

Getting information from contract address?

pragma solidity ^0.5.0; import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol'; contract SubToken{ using SafeMath for uint; struct token{ ...
0
votes
1answer
12 views

interface function declarations to be used internally

Is it possible to use externally declared interface functions internally in a smart contract? i.e. say contract A inherits interface A, would contract A be able to implement the functions from ...
-3
votes
2answers
52 views

Trying to create an instance of an abstract contract

pragma solidity ^0.5.0; import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol'; contract SubToken{ mapping(address => uint) balances; ...
0
votes
1answer
31 views

Inheritance and contract creation

If I modularise a contract into two contracts, and inherit one of them instead using a monolithic approach, will the deployment costs be larger with two contracts or is the cost the same as with the ...
0
votes
0answers
22 views

Contract Design Patterns | Should I use some sort of factory pattern?

I have 3 structs which are nested into each other i.e. struct A <- struct B <-- struct C All 3 structs belong to their own contracts (contract A, contract B, contract C) and each contract has ...
0
votes
0answers
10 views

when to create a library contract

when should one consider creating library instead of a contract? Would it make sense to create a library if all it does is calculations or reporting read values?
0
votes
1answer
42 views

Saving a function in a variable in Solidity

I am very new to solidity and stack exchange as well. I am trying to use the date time api from https://github.com/pipermerriam/ethereum-datetime/tree/master/contracts. What getYear(date) does is ...
0
votes
0answers
31 views

Best Practices Of Building A DAO Contract Structure Tree

When building a DAO of interconnected smart contracts on Ethereum, what is the best way to organise the contract structure? More specifically, are there any particular design pattern(s) like MVC in ...
0
votes
1answer
19 views

Smart Contracts designing for desktop application [closed]

Can I use smart contract for my desktop application? Even if I don't need blockchain. If yes, then which platform would you recommend?
3
votes
1answer
56 views

approve-transferfrom pattern between contracts

What is the general process-flow of approving contract a to spend tokens on behalf of contract b and how would a sufficient function implementation look like which successfully achieves this? For ...
0
votes
1answer
45 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...
0
votes
1answer
144 views

read error unexpected EOF

I'm working a evidence application with quorum.I want to store the entire contents of a file on my private blockchain. Although it's not recommended. At first I use a linux command 'split' cut a big ...