Questions tagged [contract-development]

Questions regarding the development of smart contracts

671 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
52 views

How to Measure and Manage Witness Size

In https://ethresear.ch/t/the-eth1-eth2-transition, Vitalik wrote: If you are a developer, you can eliminate the largest part of disruption from gas cost changes by proactively making sure you ...
5
votes
2answers
975 views

Contract creation gas cost depends on code in library function?

I have a contract fooContract which is using a fooLib library, calling fooLib.foo(LibStruct storage param) The transaction cost to create fooContract seems to depend on the code in the fooLib.foo() ...
5
votes
1answer
1k views

Solidity: How could I decrease gas usage of complex structs?

Struct is very expensive as labelled here: It seems extremely expensive when storing struct type. https://www.cryptocompare.com/coins/guides/what-is-the-gas-in-ethereum/: sstore 100 Paid ...
4
votes
1answer
749 views

Reset all values in a mapping

I am trying to figure out how to have the balance of all players reset to (amount) when a certain condition happens. This is the function that will update a specific player balance. How do I make it ...
4
votes
1answer
166 views

How to deploy existing DAPP to my private ethereum node?

I am looking to build a PoC around a trading platform on a block chain platform. I am trying to deploy the dapp available here to my local ethereum node. Package contains: a. HTML frontend part b. ...
4
votes
1answer
1k views

how to call smart contract function in C#.net core

protected async void Page_Load(object sender, EventArgs e) { var senderAddress = "0x605a1f8d368cbdd4d0a5cbad74f75c428660f17b"; var password = "zxcasdqwe123"; ...
4
votes
0answers
503 views

Managing multiple Ether addresses in one contract?

Although I have a background in Bitcoin (creating the WLOX exchange platform), I am completely new to Ethereum. I am trying to find a way to manage multiple accounts/addresses as a pool to (1) be ...
4
votes
0answers
299 views

Storing a truffle contract interface in version control

What I'm doing When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address). So far I ...
4
votes
0answers
422 views

Event and/or watch does not work

I have a contract for a simple bidding scenario as below: pragma solidity ^0.4.9; /* Contract accepting biddings during 30 minutes */ contract SimpleBidding { address contractOwnersAccount; ...
4
votes
1answer
790 views

Sending string to deployed contract function

var source = fs.readFileSync("./vote.sol", "utf-8") var compiled = web3.eth.compile.solidity(source); var abi = compiled.identify.info.abiDefinition; var Vote = web3.eth.contract(abi); var ...
4
votes
1answer
142 views

How to work with inherited contracts in EthereumJ?

In EthereumJ, I have two contracts i deployed them individually,first one was deployed but for the second i got error as in that i was calling function of first one and example i have second is first ,...
3
votes
0answers
83 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' ...
3
votes
0answers
86 views

Zero Knowledge Range Proofs

I am new to the world of Zero Knowledge Range Proofs. I read the following on GitHub: https://github.com/ing-bank/zkproofs The Zero Knowledge Range Proof allows the blockchain network to validate ...
3
votes
0answers
297 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. ...
3
votes
1answer
480 views

Remix: Gas required exceeds allowance or always failing transaction

I have a contract which has transferFrom function mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; mapping (address => bool) public ...
3
votes
1answer
840 views

ERC223 Token Fallback Function Usage

I'm currently writing the "Trade" smart contract which is similar to "Crowdsale" smart contract. The only function that I want to add is "sell" function. In general Crowdsale smart contract is used ...
3
votes
0answers
114 views

How to parse through the logsBloom of a block or transaction using solidity

Currently trying to figure out how to parse through the logsBloom portion of block and transaction headers using solidity. I've researched the topic so far and have come to the understanding that RLP ...
3
votes
0answers
71 views

Methods and constants order in the contract ABI

Is it possible to annotate methods and constants order in the contract ABI before compilation?
3
votes
0answers
903 views

contract.method.getData getData is undefined

When I use contract.method.getData(params) it throws an error getData is undefined. I searched on github and saw someone used request instead, and I used contract.method.request and it has successed! ...
3
votes
0answers
235 views

Benefits of library versus a plain contract (upgradeability)

I'm trying to find what the benefit is of a library. I found the following statements. (Please correct me if i'm wrong) Cost less gas to deploy Uses the storage of the calling contract the library ...
3
votes
0answers
157 views

Smart contracts and ICO questions

I am trying to learn and understand how ICOs and the smart contracts used in them work and I am having a hard time understanding the following: Take for example ParagoinCoin, you can see here that it ...
3
votes
2answers
262 views

Does the EVM process transactions or is it used solely to execute contract code?

Does the EVM process transactions or is it used solely to execute contract code? I wonder whether the EVM is used to process transactions? I know it is used to execute (or interpret) the bytecode of ...
3
votes
0answers
513 views

Smart Contract for accepting multiple ERC20 Tokens

If I wanted a smart contract to send tokens based on the exchange price of the ERC20 token received, or any agreed upon value in US dollars how would I do so? For example, If i wanted my tokens to ...
3
votes
0answers
141 views

Identity valuation using smart contracts

Hi I'm currently exploring whether it makes sense to build a platform which would use a blockchain to verify a user and the data that they would add to the platform. Very simple example would be ...
3
votes
0answers
1k views

How can we lock an ERC20 token in a contract and generate another ERC20 token proportionally over the locked duration?

"Gnosis tokens (GNO) are the generator for Wisdom token (WIZ) creation. WIZ can only be created via activating the utility of the Gnosis (GNO) tokens. This is done via a smart contract system. The ...
3
votes
0answers
37 views

Is there any way to generate cheap proofs of Ethereum's state?

A contract on the Ethereum network can interact with other contracts within it without requiring any proof, because the system itself defines methods for cross-contract communication (SEND, CALL). ...
3
votes
0answers
459 views

Ethereum and child chains like NXT/Ardor?

Doing some research on how we can implement this type of system with ethereum smart contracts. Currently the upcoming Nxt/Ardor system implements a child chain system where the main chain deals with ...
3
votes
0answers
317 views

How to debug Bad jump destination error

I am trying to work through the https://ethereum.org/token#improved-coin tutorial. I deployed the contract to testnet. Initialized tokens, set the buy and sell price. Now, one of my accounts has 50 ...
3
votes
0answers
128 views

Is there any reference on writing contracts directly with the bytecode language?

It would be great to have a complete reference of all the opcodes available, their exact effects and costs, and an example "Hello World" in ethereum assembly. Edit: this question isn't a duplicate of ...
3
votes
0answers
99 views

Contribute function of crowdsale is not working

I am having a crowdsale contract. I am trying to run contribute function using command: contractInstance.contribute.sendTransaction(101,{from:eth.accounts[0],value:200, gas:4000000}). It is creating a ...
3
votes
1answer
323 views

importing a contract does not access to its modifiers

Contract A imports Contract B and Contract B contains a modifier that I want to use in contract A. Contract A is set to inherit from Contract B, however I get the following when I try to use the ...
3
votes
0answers
125 views

How to enable autobuy of Ethers in exchange of my CryptoCurrency?

I'm referring this page : https://www.ethereum.org/token#automatic-selling-and-buying My question is that how is it possible to integrate third party in our Smart Contracts to be deployed on Ethereum ...
3
votes
0answers
126 views

Using Mix IDE on a private testnet?

Is it possible to run/debug contracts in mix-ide on a private test net?
3
votes
0answers
133 views

How to use an accessor for imbricated data types?

I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping. How can i access the array in that code for: struct AnotherStruct {....} ...
3
votes
1answer
93 views

What is the maximum computation a query or constant function in solidity can perform?

Since query or constant functions are just executed on single node there is no dependency on gas or gas limit. I am performing Quicksort in query/constant method. EVM can sort an array of length up to ...
3
votes
1answer
607 views

How do I connect to the Remix JavaScript VM from my front end

I have been developing using Remix and Metamask but it's a slow progress when pushing to the test networks. I have switched to the JS VM in Remix but I am not sure about how to connect my frontend to ...
3
votes
1answer
2k views

What is the burn() and burnFrom() function in EThereum Token Creation contract?

Please find the below ethereum token creation contract. It has two burn functions. It is having redendent params also. Why it is placed, what is the importance of the functions. pragma solidity ^0.4....
2
votes
0answers
28 views

How to make sure an external smart contract can only call one function in my smart contract per transaction?

How do I make sure that only users and smart contracts can call one function per transaction? Say I have two functions: function foo() {} function bar() {} It's ok to call each function in isolation, ...
2
votes
0answers
112 views

Swap tokens to Ether on Uniswap V2 TRANSFER_FROM_FAILED

I am trying to swap DAI to ETH on kovan testnet my wallet and contract both have DAI tokens. Whenever I swap the token through web3 the transaction fails Fail with error 'TransferHelper: ...
2
votes
0answers
25 views

Is gas cost of external calls included in gas cost of the main call?

When I call external methods of other contracts from my contract, is the gas fee of these calls included in the gas fee displayed by MetaMask? My transaction reverts (execution reverted) for an ...
2
votes
0answers
26 views

Are there well-solved patterns and practices for handling errors in Solidity?

In the spirit of Are there well-solved and simple storage patterns for Solidity?... Are there known, battle-tested practices for how to deal with errors in large Solidity codebases? It's common in ...
2
votes
1answer
107 views

Token Swap From Ethereum Host Network To Different Blockchain

What is a good way to swap tokens from the Ethereum host network to a different network (i.e. the Tron blockchain)? Would the best way to do this be to have a smart contract where ERC20 token holders ...
2
votes
1answer
55 views

Automatically extracting functions names and parameters from ABI JSON file

I have done some work on captioned subject. For example, I can extract all getter functions (and some constructors as well) of all given smart contracts (in abi json file format). Then i can call (...
2
votes
1answer
121 views

How can a smart contract store mutable data outside blockchain?

As storing persistent data on blockchain is costly due to the storage operation being gas-expensive, what are the solutions to store mutable data outside the realm of blockchain from within a smart ...
2
votes
2answers
211 views

How to generate a new token for ERC1155?

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-...
2
votes
0answers
27 views

Name Styling Best Practices Internal/External variables/functions etc

The solidity docs clearly specify how to style function order, types etc. However, are there an appropriate way to also separate between internal/external variables, functions etc. I see some people ...
2
votes
2answers
90 views

To transfer tokens from owner address to an address, if latter address moves some other tokens to a given particular address

I am writing a contract for an ERC20 token (say ABC). Is it possible to airdrop some of these newly minted ABC tokens to those ERC20 addresses, every time, if they transfer a different token (named ...
2
votes
0answers
151 views

How the following pairing equality be verified in Etherum Smart contracts?

I have found available precompiled contracts in solidity. For example, this answer enter link description here points out a precompiled contract that can verify BLS signature. However, looking to the ...
2
votes
1answer
79 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; ...
2
votes
0answers
139 views

Can I extend the interface of a contract without redeploying it?

The case I'm dealing with is a contract which should serve as a Data Abstraction Layer. So ideally, it should provide only getter functions and setter functions. For example, my interface is: ...

1
2 3 4 5
14