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 [contract-development]

Questions regarding the development of smart contracts

0
votes
0answers
5 views

How to push new struct to storage?

I get an error when trying to push the newRound struct to storage. How can it be fixed? Error: UnimplementedFeatureError: Copying of type struct Lottery.Ticket memory[] memory to storage not yet ...
0
votes
2answers
11 views

Verify transfered amount of two transactions from same ERC20 to same Contract

I making a contract to sell stuff in a decentralized way and want to use following method to transfer founds. function transferToken(address token, address from, uint256 amount) internal { IERC20 ...
0
votes
1answer
31 views

The correct approach to changing inherited variable content

What is the correct approach to change the content of an inherited variable? If contract A inherits contract B which has an variable b, and contract A is initialising the inherited variable b ...
8
votes
2answers
331 views

When a smart contract is deployed, is its source code publicly viewable?

When a smart contract is deployed to the blockchain, is the source code then publicly viewable to all participants? For example, what you see here in Etherchain. I am aware that there are some ...
0
votes
2answers
170 views

Is it possible to create a tool that reads smart contracts and check if it's safe?

I'm really in need of help with my thesis project. I'm currently finding the gap that my adviser is asking for and I seem to be having a hard time with it. What I could think of is actually creating a ...
0
votes
1answer
16 views

Emit not firing event more than once

I'm experimenting a little bit with the blockchain, I'm currently trying to send from an oracle an address to store on the blockchain through a smart contract. The code (very simple and without checks)...
1
vote
0answers
6 views

One-to-many mapping inside struct

I have two structs: struct A{ uint bid; mapping(uint => B[]) BMap; //bid - index for struct B } struct B{ uint cid; } mapping(uint => A[]) AMap; How can we push and fetch 'cid' ...
1
vote
1answer
35 views

Is there any simple explanation to multisig wallets?

I read on ConsenSys and Ethereum MultiSigWallet. I got that "The purpose of multisig wallets is to increase security by requiring multiple parties to agree on transactions before execution. ...
0
votes
2answers
45 views

Pre populating an Ethereum contract with digital assets

I would like some advice on what approach with be best to take to achieve the following. I want to release the contract with around 50,000 digital assets, think of it like pre filling a database with ...
0
votes
0answers
16 views

How to flush token to another contract from token holder's token balance from ERC-20 contract?

I have to implement the following scenario: - One ERC-20 token contract. - Another contract which will flush tokens of ERC-20 tokens. - Add these tokens to one, defined Admin address. Note: All ...
1
vote
1answer
27 views

Drizzle CacheCall always returns null

I have set up drizzle to be able to connect to my smart contract from my react-application. After some fiddling, I decided to make this function in my smart contract: /*** test ***/ uint numberFive = ...
0
votes
2answers
94 views

Undeclared identifier 'balances'

How do I fix the undeclared identifier balances[msg.sender] = 1000000000000000000000000000; in the below code pragma solidity ^0.4.4; contract Token { /// @return total amount of tokens ...
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
1answer
43 views

What are good ways to randomize a million people into pairs?

I came up with this, each person invokes the function that randomizes them into a pair, it generates a random pair, and if that pair is full, the function scans through pairs until it finds a vacant ...
0
votes
1answer
20 views

Delay a transaction

Is it possible to delay a transaction in one contract? let's say Alice wants to send a product to Bob and Bob has to transfer, for example, 2 Ethers to Alice for buying that product. How can I do ...
0
votes
2answers
35 views

How to limit number of tokens that can be transfered in a given timeframe?

How can one ensure that an ERC20 token holder can’t send/transfer/other more than X token in given period Y where Y could an hour, day, week, month etc. Would be better if this can be done without ...
1
vote
1answer
16 views

Create Contract Solidity 0.5

My code works with compiler 0.4.25 but not with the latest version. I want to keep track of every "Contract 2" that "Contract 1" create. Contract 1 uint public countContract; address[] public ...
0
votes
1answer
36 views

Transactions from contract adress

I want to get all transaction associated with a contract in ethereum. I tried to found the solution with Web3, or etherscan API ,but i didn't found anything. Thanks for your help :)
1
vote
1answer
35 views

Contract NOT created when using “new” on testnet

I've got a contract which one of his functions creates a new contract in the following manner: (Solidity) function createCarrier() public { P2Carrier newCarrier = new P2Carrier(msg.sender); ...
0
votes
2answers
148 views

Remix IDE error: send transaction failed : invalid address. if you use injected provider, please check it is properly unlocked

I've got the error message in the title when I'm trying to deploy my contract: pragma solidity ^0.4.22; contract University { address public owner; address public student; address ...
1
vote
2answers
24 views

On-chain settlement based on off-chain activity

I'm build a DApp where the end-user should be able to attach a proof (could be information, data, attachment, whatever). Now, if the DApp accepts this proof as being legit off-chain, then I want the ...
0
votes
1answer
21 views

How to integrate Drizzle with react

I have currently set up a truffle project with react, redux and react-router. I just finished writing my first implementation of the smart contract, and now want redux to connect with the smart ...
0
votes
1answer
35 views

How to run mist on mac os

I am very new to Ethereum dev and I am currently following a tutorial. However, the Remix IDE seems a bit different from the one on my computer, likely because Mist has updated since the tutorial has ...
0
votes
1answer
19 views

How to return values from dynamic array push function?

How to fetch value from dynamic array push function? Below is the code of pushing function, but how will I fetching that array values? contract PushStruct { struct MyStruct { uint field1; ...
0
votes
0answers
21 views

Uncaught (in promise) TypeError: rentalInstance.carsCount is not a function

I am beginner in writing Dapp. I am writing with truffle and solidity. Rental.sol pragma solidity ^0.5.0; contract Rental { // address[16] public rentals; // address public owner; ...
1
vote
1answer
14 views

onERC721Recieved implementation

As per the ERC721 requirements, I have to implement onERC721Recieved. This is how I did it: function onERC721Received( address _operator, address _from, uint256 _tokenId, ...
3
votes
2answers
48 views

Can we do ethereum transaction for free on private blockchain

I am very new to ethereum Blockchain. Please give some suggestion regarding one query regarding gas fee. Can we do ethereum transaction and smart contract deployment for free on private blockchain ...
0
votes
2answers
37 views

Require specific token to execute a smart contract

Is it possible to only allow parties that agreed to a smart contract on the Ethereum blockchain to use a specific token for it's executing (e.g. not using Ether but token xxx)?
0
votes
1answer
40 views

a uint storage variable can't be reset to 0

when test a contract i meet a confusing condition, so i tracked it by commented out per line, and distinguish it's a uint storage variable be reset to 0. To make it clear, i write a test contract like ...
0
votes
3answers
42 views

Owner is returned as 0x0000 … , what should I do?

I am a japanese student. I am studying ethereum. pragma solidity ^ 0.4.18; contract Owned { address public owner; // contract owner // / modifier for access check modifier onlyOwner () { ...
1
vote
1answer
37 views

Smart Contract To Send Multiple Outputs

I'm learning about smart contracts currently and a bit confused as to how they really work. My website allows users to send ETH from their wallet on site to another address off site. During which I'd ...
0
votes
1answer
37 views

Difference between the way methods are called in smart contract

What is the difference between instance.totalSupply() vs instance.methods.totalSupply().call() To my knowledge one is for truffle and the other is for web3. But truffle also uses web3 then why can ...
0
votes
1answer
77 views

I need help to understand why a function call reverted without any reason

I have a Registry contract, which holds addresses of different smart contracts. The registry has getter for every contract address it holds. In other contract at some point I need to retrieve one of ...
0
votes
0answers
17 views

The transaction block is getting added to the block chain But transaction is getting failed to execute. @lauri Peltonen [on hold]

After update, we are trying to send eth/erc20 token from main wallet to other wallet The transaction block is getting added to the block chain But transaction is getting failed to execute. I am ...
0
votes
1answer
95 views

Deploying multiple contracts with web3js 1.0 at once

I'm new to Nodejs and Ethereum so I apologize in advance for any obvious mistakes. I want to deploy multiple contracts in advance to have addresses ready when they are needed. I use this to deploy ...
9
votes
5answers
6k views

How to convert an address to bytes in Solidity?

What is the recommended way to convert an address to bytes in Solidity?
0
votes
1answer
40 views

Debug transaction

I have deployed smart contract and my transactions stop to reach contract from time to time. I see that INFO [06-26|16:06:57] Submitted transaction fullhash=...
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.
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 = ...
0
votes
2answers
40 views

Is this contract correct?

Hi i write simple contract to test. Does he have any known mistakes or bugs? What would you change in it for the better? Thanks for answer. pragma solidity ^0.4.21; contract Lock { uint256 ...
0
votes
1answer
45 views

How to vaildate the structure of a smart contract?

I want to automatically verify the structure of a published smart contract. A smart contract should be valid if the smart contract matches a template. Only the storage can diverge between the template ...
0
votes
1answer
23 views

What DSAuthority(0) and eos.owner() means and does?

In ERC20 EOS crowdsale contract, what these three lines(469-471) does? function initialize(DSToken eos) auth { assert(address(EOS) == address(0)); //[Someone explained this line here][...
0
votes
1answer
45 views

Storing and Updating an array in a smart contract (for creating permissioned networks and updating members)

Can I define a smart contract including a dynamic array that I can update its content later? precisely,I have some IoT(Internet of things) nodes sharing the received data from sensors with each ...
0
votes
2answers
42 views

Ethereum solution for shopping website

I have a shopping website and I decide to use Ethereum Do u have any solution for this conditions? we have 2 kinds of users we have 2 products with non-content price (price change randomly) we don'...
0
votes
1answer
43 views

Function burnfrom error: gas required exceeds allowance or always failing transaction

I have created a contract using Remix. When I run the function burnFrom(), it shows: gas required exceeds allowance or always failing transaction. What am I doing wrong? function burnFrom(address ...
1
vote
2answers
42 views

Contract A has a function that depends on Contract B's state. How does concurrency work for these two contracts?

I was thinking about a scenario where one contract depends on another contract's state. For example, contract a may want to decide on its next state update based on the current state of contract b by ...
0
votes
2answers
32 views

how to call smartcontract with eth.sendRawTranasction() [duplicate]

i want to call my erc20 token smartcontract with eth.raw transaction. suppose i want to call .transfer("0x0",500) and send with web3.eth.rawTranscation so where can i add this call function? rawTx : {...
2
votes
1answer
54 views

Trustless Inter-chain transaction with Bitcoin- are there any flaws?

Let's say that Alice wants to send Bob 1 BTC, and in return Bob will send Alice 1 ETH. Alice's Bitcoin address is BTC_A, and Alice's Ethereum address is ETH_A. Likewise, Bob owns addresses BTC_B and ...
2
votes
1answer
48 views

How do smart contracts deal with data that fluctuates?

In my limited understanding of smart contracts, I've read that every node on the Ethereum network must execute a smart contract to come to consensus. I'm guessing that not all these nodes execute the ...
1
vote
1answer
50 views

How to get require() to accept decimal value of ether in payable functions in Solidity?

On using, require(msg.value == registerFeeMap[msg.sender] /_currentRate) (fractional ETH value calculated) require(msg.value == registerFeeMap[msg.sender]*10**18/ _currentRate) (ETH converted to ...