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

2
votes
3answers
159 views

Handling decimals in somewhat complex math

I'm a bit lost on what to do with the following calculation. The problem is that decimals are being round up/down, which obviously doesn't give me the result I desire. int totalValue = 275000; int ...
1
vote
1answer
20 views

How to increase the number of test accounts?

I have encountered a problem where I need a large number of test accounts. How can I increase the number of test accounts from 10. Remix and ganache only give 10 accounts. I require more than that.
1
vote
1answer
18 views

Return fees - is it save?

I would like to return partially fees to users of my dApp. Once they have reached X amount in fees, I want to make a function that will pay them ethereum automatically. Now my question: Is that secure?...
0
votes
1answer
16 views

Multiply small rational number to obtain integer piece

I'm trying to make some advanced calculations in Solidity. I was able to successfully implement the algorithm on my contract, but its results are way below zero, and whenever I try to get it with ...
-1
votes
0answers
16 views

the contract is not compiling [on hold]

pragma solidity ^0.4.18; // written for Solidity version 0.4.18 and above that doesnt break functionality contract Voting { // an event that is called whenever a Candidate is added so the ...
1
vote
1answer
36 views

Developing a CRUD database in Solidity

I want to implement a database in a private blockchain. It consists of four tables and my idea is to use four smart contracts, one for one table. For each table i'll put the corresponding attributes ...
0
votes
1answer
25 views

Storing encrypted data and decrypt on-chain

The idea was to store the encrypted number of tokens,and when user was sending his private key, smart-contract would decrypt the data and perform an action of sending tokens to someone else. The catch ...
0
votes
1answer
28 views

Multisig function calls

I am making a dapp in which ethereum user accounts that call certain functions are rewarded with an ERC20 token. All the dapp is based on functions using only one ethereum account as parameter. But if ...
0
votes
1answer
21 views

Creating a complex splitter smart contract Solidity [on hold]

I'm hoping to create a smart contract that splits the amount of Ether sent to it to an array of addresses, each of which has a percentage 'equity' that represents how much of the total they should ...
0
votes
2answers
18 views

How to find out if a wallet (an address) contains a token from a contract using web3js?

Is this possible with and without knowing the private key of the wallet.
0
votes
1answer
17 views

Fallback function optimization: what better?

I have ERC20 contract with payable function. 1 function () external payable { uint256 amount = msg.value * unitsOneEthCanBuy / 1000000000000; balances[msg.sender] +=amount; balances[...
1
vote
1answer
26 views

How to check balance of a smart contract in Remix IDE Javascript VM?

I'm working on a smart contract that can hold some ETH. Currently, I'm unable to see what is its balance in the Remix IDE. I'm trying to use the console: I have access to web3 but how to check the ...
0
votes
0answers
25 views

MetaMask Calling Child Contract Methods?

I had created a contract(Organisation.sol) that create other contracts(Session.sol). When I call any method from(Organisation.sol) using web3js it work well. But If I ever tried to call any method ...
0
votes
1answer
24 views

How to deploy A contract created by another contract in the browser?

Hey I am making a smart contract that create another smart contracts. Organization.sol create Session.sol . When I create a session using createdSession function I got it's address and I already had ...
0
votes
0answers
28 views

Is Geth v1.8.27 incompatible with Solidity 0.5.0?

I set up a private chain using geth v1.8.27, then deployed an erc20 contract in solidity 0.5.0 complied using the 0.5.7+commit.6da8b019 version of compiler. After the transaction was mined, I tried to ...
0
votes
1answer
24 views

.transfer fails

Trying to call .transfer() within a function makes it fail. I am aware that the difference between .send() and .transfer() is that .send dont throw. The function works properly when using .send(), but ...
0
votes
1answer
33 views

Calculated Gas Costs of Contract execution

I have a smart contract that maps a string to a string value and stores it on the Blockchain. I want to analyse the Gas Used by Transaction. One time the execution consumes 92,843 Gas (https://rinkeby....
1
vote
2answers
36 views

How can we detect if tokens are transferred to our smart contract and avoid “allow”?

Imagine you have a smart contract that accepts all forms of ERC20s. You want users to call a function by which they will send you their ERC20s and in exchange receive a greeting. Technically we can ...
0
votes
0answers
15 views

AttributeError: 'list' object has no attribute 'buildTransaction'

Im trying to send a transaction to contract function with web3.py on ropsten testnet. while doing so, Im getting this error. AttributeError: 'list' object has no attribute 'buildTransaction' here ...
0
votes
1answer
24 views

When I create contract using another contract how could I access his methods in web3js?

Hey I have file 'contractFactory.sol' inside this file I have contract contractFactory{ event contractCreated(string name, address institution, address parent); function createContract( ...
0
votes
2answers
17 views

Calling a smart-contract fallback function from another contract

contract A { function one() public { //transfer to B to call its fallback function B(addressB).transfer(value); } contract B { function() external payable { someaddress....
0
votes
1answer
30 views

how to send transaction with web3.py

I'm trying to use web3.py with infura.io to interact with my smartcontract. here is my simple greeter contract code pragma solidity ^0.5.7; contract greeter{ string greeting; function greet(...
1
vote
1answer
15 views

How to pass account address to truffle deployer?

How do I pass my account address to the contract constructor while deploying with truffle migration? I want to pass address into MyAdress like below. deployer.deploy(MyContract, MyAddress) My ...
0
votes
1answer
15 views

Using geth Light Node to detect ERC-721 transactions

Is it possible to use a geth light node to detect incoming transactions executed via ERC-721 contracts? I have experienced being not able to get receipts using getTransactionReceipt in native and ...
0
votes
0answers
35 views

How to call A child Contract function in web3js?

Hey I am new at blockchain development and I need to make contract name organization that create sessions contracts. I had already implemented the solidity code but I have a problem in front-end ...
0
votes
1answer
26 views

What's the root cause “contract error - Gas estimation failed Gas estimation errored with the following message (see below)”?

Rest of the error: The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. I got that message on several cases, usually on different mistakes. What'...
1
vote
1answer
35 views

EVM bytecode debugging jumps

How can i determine forehand the destination of JUMP for which there is no PUSH instruction thst preceeds it and the entries in the code where they where set, when analysing the bytecode? I looked ...
0
votes
1answer
27 views

Is it possible to modify privateFor addreses in a private Smart Contract (Quorum)?

I know how a private smart contract works providing a list of accepted addreses to privateFor property, but what if I want to disable (or enable) any address visibility? Should I deploy a new Smart ...
2
votes
3answers
35 views

ERC721 Tokens - Hold ETH in the token?

Would it be possible to create a ERC721 Token for say a game item, but I want the Token to basically have ETH inside the token, so that a user could destroy the token to reclai
0
votes
1answer
24 views

Smart contract method relayer

I was wondering if there was a way, in theory, to call from a sc two functions from a secondary sc in which the result from the first function is a parameter of the second function so something like: ...
0
votes
1answer
23 views

Regarding interaction between smart contracts [closed]

If we have a case where we have Two smart contracts. Contract A passes value to Contract B. the address of contract A is also passed to contract B in the smart contract. while compiling the contract B ...
1
vote
0answers
31 views

supply chain contract

As per this contract can some explain about the what input the user will provide and explain about the transporter type when he select option 1 then what input should we give. please explain about the ...
0
votes
0answers
11 views

How do i select a random number from a given range in my contract? [duplicate]

I am trying to create a simple gambling app in which the users are all assigned numbers when they enter the contest and i need to select a winner based on this number. Consider the numbers are 1-100 ...
1
vote
1answer
97 views

How to charge percentage of transaction cost?

Example: uint public createPostCost = 0.0003 ether; function createPost(bytes32 _post) public payable { require(msg.value >= createPostCost); Post memory newPost; ...
1
vote
2answers
59 views

Inconsistent Result for Web3 Constant Method Call

Deployed a local private Ethereum environment. While trying to invoke a constant method of a solidity contract getting inconsistent results. Sometimes the result is returned and mostly not. When I ...
0
votes
2answers
31 views

Out of Gas Exception on Tobalaba

I deployed the same contract to Rinkeby, Ropsten and Tobalaba networks. Rinkeby and Ropsten work fine, but the contract execution on Tobalaba fails because of an out-of-gas exception: https://tobalaba....
0
votes
2answers
19 views

Check a user's address when accessing the agreement

I am developing a contract where a predetermined address can change a contract variable. The structure of my current contract is as follows: pragma solidity ^0.5.0; contract privacyPreferences { ...
0
votes
1answer
13 views

Deploy Contract Syntax Error

I am testing a contract, when I run the truffle migrate command, in my deplyment contract located in the migrations folder the following error appears: var HelloWorld=artifacts.require (“./HelloWorld....
0
votes
1answer
23 views

Contract change registry

If i have a smart contract stored on block 10, when i change the status of this contract, the altered contract will be stored on the next block or the status of the contract will be stored in block 10 ...
1
vote
1answer
16 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
0
votes
0answers
13 views

Function doesn't return any value but modify the data in the contract

I have a function that can retrive all data and one for retrive only not readed data. On Remix with JavaScrpit VM it's work, but on Remix with my private blockchain linked with web3 provider the ...
0
votes
1answer
31 views

CREATE / CREATE2 Verification

Where do I verify whether a contract has been created with CREATE or CREATE2, would I have to disassemble the contract and look for a CREATE2 opcode in the contract creation code?
0
votes
1answer
20 views

Retrieve the status of a contract by its creator

In a situation where there are multiple contracts stored in different blocks, is there any method to retrieve the status of a contract through its owner's address? (e.g. in my situation, each person ...
1
vote
1answer
16 views

reverse crowd sale possibility

Is it possible to do a reverse crowd sale? e.g. send tokens to a smart contract to get ether back. Or would this require to load the contract with WETH or something in advance?
5
votes
1answer
50 views

What is WETH and why can't we just use ETH?

can someone explain why we need WETH? what's the purpose of WETH, can't we just use plain ETH? it's not like it removes the tx fees or something. Hopefully someone can shed light on the concept.
1
vote
1answer
102 views

How to prevent selfdestruct from another contract

I have a contract A calling another contract B Contract A contract A { function sendValue(B _externalContract, uint _value) { _externalContract.acceptValue(_value); } } contract B { ...
1
vote
1answer
20 views

Listen smart contract event

I use parity --light geth --syncmode "light" I would like to listen smart contract Event. Do I need to download all blockchain on local PC or light mode will be enough?
1
vote
2answers
29 views

Decentralized Exchange on Ethereum?

Is a decentralized exchange basically a smart contract that includes all the exchange functionality? Where is the engine?
2
votes
1answer
16 views

Any other provider instead of Oraclize

Are there any other providers for calling external APIs in Solidity other than Oraclize?
0
votes
1answer
41 views

Using AbiEncoderV2 for encoding data in raw transactions

I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my node.js back-end using ...