Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

How to create forwarder wallet in Ethereum?

I have more than one ETH wallet. I want to automatically combine these wallets into one wallet. For example, when I get an ETH in wallet 0x1, I want it to automatically transfer it to wallet 0x2. Can ...
0
votes
0answers
17 views

Supply chain asset exchange

I'm trying to create a supply chain example using solidity. This is the part of the code where I create an raw material asset (rawMaterial contract) and transfer it to the next company in the supply ...
0
votes
0answers
6 views

Can you use biconomy or GSN to pay for gas when deploying a contract?

I'm building a small dapp to allow users to deploy smart contracts without needed gas, where I'll use GSN or biconomy. I'm not sure you can use meta-transaction services like these for transactions ...
1
vote
0answers
31 views

Execution erorr: Invalid opcode on estimateGas | Possible unhandled promise rejection

pragma solidity ^0.5.0; I get invalid opcode error when trying to estimate gas needed for my transaction from react-native using the following line of code: const gasAmount = await contract.methods ...
0
votes
1answer
25 views

solc-js error: “before each” hook for “deploys a contract”: SyntaxError: Unexpected token u in JSON at position 0

The issue is probably here: const { interface, bytecode } = require('../compile');. interface in the test file is undefined. inbox/contracts/Inbox.sol: pragma solidity ^0.7.0; contract Inbox { ...
0
votes
1answer
31 views

ETH not showing up

To help me get started learning how to create contracts, I had 1 ETH sent from the Ropsten Ethereum Faucet to my MetaMask address. It arrived fine, but when I tried to send it to MyCrypto address it ...
0
votes
0answers
24 views

How to authenticate user details in smart contract? [closed]

I am building a login system in my dapp for which i have to check the details with already registered users .I tried it by getting user details in frontend and then authenticate it but i think it is ...
0
votes
0answers
13 views

Unbounded loop solidity internals

Under the hood, what happens in an unbounded loop? let's say I'm trying to send tokens to an infinite amount of addresses and end up with an out of gas error. Will the function which executes the ...
0
votes
1answer
20 views

Call private internal function from another contract

Is it possible for me to call from a contract B, that has an instance of A, a private or internal function of contract A?
0
votes
1answer
27 views

Who gets the gas for smart contract execution?

When I deploy a contract by sending a new transaction, the miner who adds the transaction to the blockchain gets the gas, right? When I execute I contract by sending a new transaction, the miner who ...
0
votes
0answers
26 views

TypeError: Expression has to be an lvalue

I have a parent contract: contract Transaction { enum C_facts { Inital, Requested, Promissed, Declared, Accepted, Declined, Rejected } C_facts public c_fact = C_facts....
0
votes
0answers
14 views

Know which function was called [closed]

I'm using remix and i want to know which function was called so that I can update a state variable. Does anyone know how to do this?
0
votes
0answers
7 views

getTransactionReceipt() in JavaScriptVM Environment

Is it possible to get a transaction receipt using Remix in JavascriptVM Environment? If it is how can i do that? Thanks in advance
0
votes
0answers
24 views

How to get a callback function to return to a separate contract? [closed]

Let's say I have the following structure: contract A { function getResult(){ unint256 result = B.getRandom(); } } contract B { function getRandom(){ // This function has a ...
0
votes
0answers
17 views

The code is not returning the value of x? [duplicate]

pragma solidity >=0.5.0 <0.7.0; contract Example{ uint256 public x=3; function setArr(uint256 y) public returns(uint256){ x=y; return getArr(x); } function getArr(...
1
vote
2answers
70 views

Am I allowed to copy and reuse a smart contract?

Let's say i'd like to take an existing smart contract from the Ethereum blockchain and use it for my own project on the Tron chain. Apart from any technical issues: Is it legal to do that? Can i just ...
-1
votes
0answers
22 views

Can someone help me out with my Solidity code?

I'm trying to write a life insurance smart contract. My nested mapping of the beneficiaries compiles an error (undeclared identifier) and I really do not know how to divide the policy cash value and ...
0
votes
0answers
20 views

Testing contract functions with calls from hundreds of accounts

Do any of the available IDEs support calling functions from hundreds of accounts at once, or, should I write a contract that manages the accounts as contract accounts? contract Test { uint ...
0
votes
0answers
19 views

Auction project in Solidity: Why do I get “VM error: invalid opcode” for this code?

I am trying to do an Auction project and this part is bugging me. I can't figure out what is the problem that's causing the following error message: "VM error: invalid opcode.". Even if I do ...
0
votes
0answers
32 views

Deliver a dapp to a client, how to set as owner?

So, as a freelancer that wants to make a smart contract for a client, how do you set such client as the owner of the contract? Would it be setting the owner variable to the eth address of the client, ...
0
votes
1answer
27 views

cannot transfer token from EOA account to a contract from function

i was making a contract for staking where user transfer its token to a contract and i will give him interest but i got stuck to this problem i have been searching for 3-4 days but for it is not ...
1
vote
1answer
39 views

Building a recursive smart contract — is it possible?

I would like to create a sort of tree type hierarchy of contracts. Think of it like a multi-level-marketing scheme -- the person at the top will receive X. For each of the k people he recruits he ...
1
vote
1answer
21 views

How does array.length— work?

I'm having trouble understanding why people call array.length-- after deleting an element in an array (as seen in this answer and many others). Why is there need for doing so? When is the length of ...
3
votes
1answer
46 views

call opcode gas consumption on a non EOA address depends if the addres is “new” or not

I have the following contract, reduced to the minimum for testing reasons: pragma solidity ^0.6.11; contract PackedMultiplexer { function multiTransfer(address _address1, uint _amount1, address ...
1
vote
1answer
24 views

What is the right way to calculate gas price and limit for contract deployment?

I have tried several times and reached up to a gasPrice of 65 Gwei and a gasLimit of 500,000 which is $7.6 and still the deployment fails with error "Out of gas". After spending tens of USD ...
0
votes
2answers
24 views

Token Access Issue

Hi Sir we Create Token but we cloud'n have full access on Tokens. Like we create 2000M Token but when I add it in my Metamask I got only 200M Tokens. Cloud you please me out for this?
1
vote
0answers
12 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 ...
1
vote
1answer
26 views

State Variables: What are they and how to create them?

I am new to ethereum and Solidity. I thought state variables are supposed to retain their value between calls. In the Solidity documentation, in the section State Variables, it says that state ...
0
votes
1answer
12 views

When a contract calls other contracts, is it an atomic operation?

If a contract calls several external methods of other contract(s), is it as a whole one atomic transaction (reverted as a whole if an exception happens)?
1
vote
1answer
125 views

Is Solidity being replaced as the de facto standard for smart contract development?

Is Solidity being replaced by languages such as Rust or other programming languages for smart contract development?
2
votes
1answer
29 views

“out of gas” message when calling another solidity contract's method

I want to call another solidity contract's method using Call/DelegateCall. Although the transaction seems successful, but I did not get the expected result, and it shows "Although one or more ...
0
votes
2answers
35 views

solidity, how to wait n second function or others solution

I am working on a project for p2p energy trading using blockchain. I am building an experiment on my own to demonstrate the concept for my master thesis. For this project I have two python scripts, ...
0
votes
1answer
32 views

Can someone read this private variable?

my purpose is to generate a random key when the smart contract is created and save that key in a private variable. I don't what to know its value either. Let's take for example the code below: pragma ...
0
votes
1answer
26 views

Error: Returned error: VM Exception while processing transaction: revert when using methods.MyMethods.Send

I am writing a simple betting application that will return double the ether deposited by the player, provided they guess correctly the random number generated by the virtual slot machine. it works ...
0
votes
0answers
18 views

Error: No Keyring found for the requested account

I am an student and in this moment practicing how to create a simple smart contract in remix.ethereum.org. I got compiled the small program with function get without problem. When I deploy the program ...
0
votes
1answer
25 views

How to withdraw Other ERC20 tokens besides Ethereum from my contract

I'm trying to implement something like this (which works) function withdraw() public { msg.sender.transfer(address(this).balance) } but I need to be able to withdraw ERC20 tokens other than ...
0
votes
1answer
46 views

how create address for each ethereum user [duplicate]

I have a group of Ethereum users how do I create an address for each user to send their data on the network?? I want a way to create addresses for each user??
0
votes
1answer
48 views

how different users write their data in ethereum network?

How a number of blockchain users save their data in the blockchain network using ethereum. Meaning more than one user sends his data using Python to save it in blockchain networl ?? How do I ...
0
votes
1answer
35 views

How to forward tokens without paying a gas [closed]

I'm working on a project and I need to know if this statement is possible: I have 10 registered users. Each user has an erc20 wallet. It is possible that when user A, C, E, or whoever deposit their ...
0
votes
2answers
50 views

High Gas Cost for Factory Contract!

I've noticed that when a contract factory creates a new contract with the 'new' keyword, the transaction costs an absurd amount of gas as if it were deploying the contract for the first time. I don't ...
1
vote
1answer
32 views

Why does retrieving stored data cost so much compared to using calldata in Solidity?

I have a function that I need to pass an arbitrary length array of addresses to. In remix, just calling a function that has an address[] costs around 30k gas for an array of 5 addresses: function fun(...
0
votes
0answers
25 views

Polymorphism in Solidity

I understand that Solidity supports contract polymorphism, but what pattern would one use to create abstract data types for use in derived contracts? Motivating example: Say I have an abstract Storage ...
0
votes
0answers
29 views

Getting an “ Unhandled promise rejection” error when making transaction from account1 to a contract

I keep getting a Promise Rejection error whenever I make a transaction from account 1 to a contract. The contract is used to send ether to account 2 when it receives ether from account 1. For security ...
0
votes
1answer
22 views

Display top referrer number

I am developing an ETH game with a referral structure. Each account that exists in the game has a "Referral Count" associated with it that updates as people sign up using their referral link....
0
votes
2answers
31 views

Does any such smart contract exist where the creator's private key is not required at the time of unlocking?

Is the following type of smart contract possible, and if so, what is it called? Party A creates a smart contract with available funds for a secondary party and signs the transaction Party B enters ...
0
votes
2answers
45 views

Where can I find full ERC 721 example programs?

I am building a program with an ERC 721 token. My code runs without using the standard components provided by Open Zeppelin IERC721. Now I want to adapt it to the ERC 721 standard. Unfortunately the ...
0
votes
2answers
68 views

How do I give every user Ethereum an address and does it affect security

I have a project with Ethereum Blockchain the users send the data to the server and the server writes the data in the blockchain network My question is how do I represent the server in the smart ...
0
votes
0answers
17 views

Truffle test stuck when testing with geth endpoint

I tried to test the truffle suite official metacoin example using truffle test. I opened a local private chain using geth with http rpc service open at localhost:8545. My truffle-config.js file is ...
0
votes
0answers
46 views

require Statement returns Transaction Revert Error instead of provided custom error message

For example, i have this piece of code here require(keys[_address].purpose != _purpose, "Key Already Exists"); in a Smart Contract. Upon executing a function and failing a requirement, ...
1
vote
1answer
23 views

Will it be possible to get a contract's balance by block number in Solidity?

Will it be possible to get address state at a given block within smart contract execution logic? Something like: block(10297202).(address('Ox...').balance) I assume it's not possible currently due to: ...

1
2 3 4 5
65