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
0
votes
1answer
14 views

Need to enumerate keys of a mapping

I have a directed multigraph of courts "trusting" each other: struct TrustedCourt { uint256 courtId; mapping (uint256 => uint256) limits; // intercourt token => amount } ...
1
vote
2answers
15 views

How to generate a new token address?

Developing an ERC1155 contract, how to generate an address for a new token? I need to create an API function like function createToken() returns (address). How? Should I just use an incrementing-by-...
0
votes
1answer
30 views

Error Handling on Contract Calls to Other Contracts

I'm trying to call a function from another contract and need a way to accommodate errors. Say contract A has the method getBalance: function getBalance(address x) public view ...
0
votes
0answers
30 views

Comparison of 2 child-contract-values in factory-contract

in my solidity code I create a tracking-contract and auction-contracts out of a factory-contract. The last function 'a4_Payment' of the auction-contract should be triggered out of the master-contract ...
0
votes
0answers
16 views

Can a factory-contract access/read/modify variables in generated child-contracts?

at the moment I am experimenting with the factory/child-logic in solidity. With my factory contract I am able to create child contracts in which an auction is executed. Now I want to return a variable ...
0
votes
1answer
20 views

Could I implement a kill switch in my solidity program?

I was wondering if there was a way to put a killswitch into my solidity code? I am using v0.4.21+commit.dfe3193c Thanks a bunch!
0
votes
1answer
8 views

How estimate GAS from a contract call with Web3j

I'm trying to estimate gas cost of a contract call, i need to send a string to a contract, but i need to see if i overtook the GAS limit. I'm trying like this: Transaction t = Transaction....
0
votes
1answer
20 views

Is there any chance to retrieve data on a database(sql) to a smart contract [duplicate]

I want to write a smart contract that gets id numbers as inputs and then retrieve data that are recorded in a database.Is there any specific database for that process.
0
votes
1answer
29 views

Solidity - Creating child contract

Recent code: pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; contract Master { address Pi_C_Owner; address payable public NewAuctionPayable; //Hilfsvariable um ...
0
votes
2answers
22 views

How can I add mint and burn function to my erc20 contract code? [closed]

How can I add mint and burn function to my erc20 contract code? This code is working properly but I couldn't add mint and burn function that work. Is there anyone who will help me about fixing this ...
0
votes
1answer
41 views

Solidity smart contract function in function [closed]

I tried to write a smart contract like the following. There are two function of a contract: the first function makes confirmation of a condition, the second function makes a new contract, if all ...
0
votes
0answers
19 views

Failed to compile <modul not found>

please help me Module not found: Can't resolve 'web3' in 'C:\Users\block\src\components' i don'k know why .. my app.js import React, { Component } from 'react'; import logo from './logo.svg'; ...
0
votes
2answers
19 views

Check if contract exists in list

I've got a contract which creates another contracts and stores them in a list. How can I check that contract with specific index already exists? import "./User.sol"; contract Main is Ownable { ...
0
votes
1answer
39 views

Must consider things for every smart contract

When creating smart contract from scratch, what kind of things you should consider? For example: 1.Certain functions should be accessible only by creator/specific addresses 2.Fallback function Is ...
0
votes
1answer
23 views

Keeping a finite set of addresses (Solidity)

struct Data { ... } contract Court { mapping(address => Data) subcourts; } I want to keep track of a small finite set (which can be added or removed) of all keys of this mapping. What is the ...
0
votes
0answers
10 views

Auction Contract with “Right to Bid”

I build a basic reverse auction you see here using Solidity and the ethereum remix IDE. In addition to the functionalities already implemented I would like to add a "SafetyLimit" amounting to half the ...
0
votes
1answer
68 views
+50

Linked contracts not running on go-ethereum

A very simple linked contracts example where A contract has a variable and B contract queries the A contract's variable is running ok on Ropsten+myetherwallet and Remix sandbox, but it fails when ...
0
votes
0answers
25 views

Bunch of Smart contracts with Ownerships and User fees free transfers

I need a community advise on how to organize smart contracts architecture. So what we have: Users who have not eth and wallets. Users generate actions which involves token transfers. Users don't care ...
0
votes
0answers
19 views

which type can use to store abi in a contract

If I want to store abi in contract, which type can be use? and How can I get it later. For example, if I use bytes to store a contract's abi. How can I use JSON.parse to get it. I have not find a ...
0
votes
1answer
28 views

Why my smart contract's function always return 0?

I'm new on Ethereum. I'm trying to deploy my first smart contract in my private blockchain but my function always returns 0. I wrote the simple Smart Contract: pragma solidity^0.5.0; contract ...
0
votes
1answer
45 views

Help me Understand the flow of this smart contract

I have 2 smart contract, below is the implementatin of them : 1) import "./MaintainableUpgradeabilityProxy.sol"; function _createProxy(address implementation, address serviceRegistry) internal ...
0
votes
0answers
25 views

How simulate blockchain and smart contract in VANET?

I am a beginner in the blokchain, I am blocked how I start simulate a blockchain and smart contract in vanet. Can you help me and inform me how I have to simulate blockchain and smart contract in the ...
0
votes
1answer
27 views

How to call ecrecover() in pure assembly?

If I do remember correctly, it’s a contract built‑in in the Ethereum Virtual machine, isn’t it? if yes, what’s the address to call for it?
2
votes
2answers
86 views

How to assemble a contract’s code?

I wrote a contract into bare assembly (no solidity or Vhyper syntax and with all address being static). How to convert it into bytecode? If possible using the new http://remix.ethereum.org or another ...
0
votes
2answers
29 views

how to write a test case for msg.sender==0?

In my contract I am use the below mapping. mapping(address => uint)Drivers In the function function registerDriver(uint _perkm) public payable returns(string memory) { require(...
0
votes
1answer
20 views

Create2 and new contract deploy at used address

Given that it seems possible, using somehow CREATE2, to deploy a new smart contract at a certain address where a different smart contract existed before to be killed... (see @smarx answer here Can ...
0
votes
1answer
31 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
1answer
39 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
37 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
22 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
1answer
31 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
30 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
1answer
29 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
1answer
18 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
16 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
33 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
20 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....
6
votes
2answers
52 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
13 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
36 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
23 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 ...
0
votes
1answer
19 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
57 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
28 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
22 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
52 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
23 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
19 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
43 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
25 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){ ...