Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Ethereum 2.0 (Serenity) & PoS

I understand that the underlying consensus model changes from PoW to PoS. However, will it also result in changes to how wallets interact with the network? Will transaction fees still have to be paid ...
0
votes
0answers
29 views

Type Error: web3.eth.Contract is not a constructor but web3.version is 1.0.0

Why can't I instantiate my smart contract? When I try and instantiate an instance of a smart contract with the following code... let contractInstance = new web3.eth.Contract(abi, '...
0
votes
0answers
28 views

Smart Contract is not working on Geth private network, while it does work on Ganache as well as Remix

I've only begun working with geth from last week and have faced the quite a challenge. I've written a smart contract and it works on remix (JavaScript VM) but somehow it does not work on my geth ...
0
votes
0answers
19 views

Fetch ETH USD Rate from past using Oracle

Is it possible to fetch the USD rate of ETH at a specific time in the past to a smart contract from an external API using an oracle? i.e. I have a function which tracks whether now > start + 10 ...
0
votes
0answers
20 views

What are some practical considerations for leap seconds?

From the solidity docs on time units: Take care if you perform calendar calculations using these units, because not every year equals 365 days and not even every day has 24 hours because of leap ...
2
votes
1answer
21 views

Getter functions for loop security

Is there any security issue when making for-loops inside getter functions ? Let's say the array is very large, and it takes a long time to loop through the array. Is it a potential threat or I can ...
0
votes
0answers
17 views

Contract with multiple signing keys

How things work I have a Factory contract, FContract. FContract can be called by a user as many times as they want, creating instances of, let's call it, contractA. Thus, they're able to own as many ...
0
votes
0answers
12 views

Call smart contract function in geth

Environment, Ubuntu 18.04: bs@dharma ~/Schau $ geth version Geth Version: 1.9.3-stable Git Commit: cfbb969da803d4cc92e1a64fc1b3c06db299b564 Architecture: amd64 Protocol Versions: [63] Network Id: 1 ...
0
votes
1answer
13 views

Storing a monero address in smart contracts?

Assuming I would have to store Monero addresses or any cryptonote based coins addresses in a smart contract, would there be any issues? Consider that those addresses are as long as this random ...
1
vote
1answer
28 views

What are the steps of deploying a smart contract to the blockchain?

Are the above steps correct for deploying a smart contract to the blockchain: A node creates a smart contract The smart contract is converted to byte code The node creates a block out of the byte ...
0
votes
1answer
19 views

Risk of Messages Not Having a Signature

As per my understanding transactions are signed before sending to Ethereum. Else, no transfer of Ether will happen. However, messages sent to Smart Contracts (SC) aren't signed (e.g., using methods....
5
votes
2answers
37 views

Pros and Cons of smart contract upgradable patterns

There have been quite many arguments around how to achieve smart contract updates like Upgradeable smart contracts. I feel Proxycontract with Delegate-call is currently the most famous one. But aside ...
1
vote
1answer
8 views

What is the unit for the tx.gasprice?

Is it a wei, kwei, mwei, gwei, ... Something else? The API doesn't say much.
1
vote
1answer
34 views

How to get top 5 token holders?

I want to keep a track of top 5 token holders inside the contract in terms of their token balances, is there any efficient way to do that in solidity?
0
votes
1answer
18 views

How to match the data in the struct?

If the Set function receives two inputs 1.["0xca35b7d915458ef540ade6068dfe2f44e8fa733c",50,"ROC","park"] 2.["0x14723a09acff6d2a60dcdf7aa4aff308fddc160c",60,"AU","school"] How can I return all the ...
-1
votes
0answers
19 views

How to select a wallet address by the token number he owns?

I need to allocate a winner among the token holders. I want to keep the concept that the more tokens someone buys the more chance there will be that he will be the winner. now lets say 960 tokens ...
0
votes
1answer
16 views

How can I use Ethereum smart contracts with another crypto currency?

I am learning/playing around with some concepts of the blockchain, smart contracts and Ethereum. I have created my own "toy" cryptocurency ("myCoin") by forking a coin using the CryptoNote algo. I ...
1
vote
1answer
31 views

Could not find __Truffle__NotFound.sol from any sources

This is the file I'm trying to compile. I've been using truffle for a few years and I remember that we used to be able to compile files with different names than the contracts inside. I'm using ...
2
votes
1answer
21 views

How to transfer wei from a contract to a specific address?

I was making an auction system and I wanted to make sure that when someone bid higher the contract would return the money to the address of the previous bid. pragma solidity >=0.4.22 <0.6.0; ...
0
votes
1answer
21 views

Two smart contracts interact can't pass value when I using web3.js

I have two different smart contracts interaction_1 and interaction_2 I input the data(team) from remix ide. What I want to accomplish is when user input team in user_input function at interaction_1,...
0
votes
2answers
50 views

Ethereum smart contract require function

I have one question about the "require function" of smart contract. Function is as following, function set(uint currentTs) public { require(msg.sender == owner); ts = currentTs; } I'm not ...
0
votes
0answers
21 views

Contract can't import remote repository locally

I made a compiler script that takes all contracts in folder ./contracts/ and produces a .json for each contract, containing an ABI and Bytecode. This worked fine for a while. However, I added some ...
0
votes
1answer
17 views

How a contract notifies its event listener when an event trigged?

It's confusing for me about how the event listener obtains event in time. Does it mean the listener APP(web3 code) keeps online and just waiting for notificaiton from the contract generating event, ...
0
votes
1answer
34 views

web3 - web3.utils.toHex zeros length

I'm trying to send 12 integer as bytes to a contract function. If I use web3.utils.toHex(12) the variable will become 0xc The problem is that when contract function parses bytes, it reads uint256, ...
1
vote
1answer
24 views

How to call a function with params and check them

I want to create a smart contract that users can send a number to and receive an amount of ether. function airdrop(uint val) public payable { require(airdrop == true); if (val == 0x31){ ...
2
votes
3answers
105 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
45 views

What are remappings and how do they work in solidity?

How can they be used with solc?
4
votes
1answer
109 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
51 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
20 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
25 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
44 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
46 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
18 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
18 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
42 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
22 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
64 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
26 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 ...
3
votes
2answers
61 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
47 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
32 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
38 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
29 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
34 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
21 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. ...