Questions tagged [ethereum]

Ethereum is a blockchain currency (like Bitcoin) with a public ledger. Questions should relate to programming. General questions about Ethereum should be asked on https://ethereum.stackexchange.com

is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It provides a decentralized Turing-complete virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes. Ethereum also provides a cryptocurrency token called , which can be transferred between accounts and used to compensate participant nodes for computations performed. Gas, an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network.

was proposed in late 2013 by Vitalik Buterin, a cryptocurrency researcher and programmer.

The official website of is Ethereum.org

6757 questions
18
votes
1 answer

How can I use different addresses to call functions in Hardhat tests and scripts?

When running tests and scripts, all functions are called by the first address provided by Hardhat. I'd like to know if there's a way to change the calling address within the same test or script. Thanks in advance!
Nico
  • 181
  • 1
  • 4
18
votes
1 answer

Warning: Function state mutability can be restricted to pure function

I am new to solidity and I have been trying to print out simple messages using functions in solidity, but I have failed to deploy successfully, and there is an error that I can not figure out what's wrong. This is what I have tried so far: pragma…
Alo_159
  • 181
  • 1
  • 1
  • 3
18
votes
1 answer

Handling user profiles in Ethereum DApps

I'm in the process of creating an Ethereum DApp. The DApp consists of users who have associated data like email, name, and a profile picture. I would like to store the contents of the user within IPFS as a JSON object and reference this on chain…
Dondrey Taylor
  • 290
  • 3
  • 10
17
votes
2 answers

Solidity, Solc Error: Struct containing a (nested) mapping cannot be constructed

I am using Solc version 0.7.0 installed by npm. When I try to create a Struct that contains mapping, I received an error: "Struct containing a (nested) mapping cannot be constructed." Please check the code: // SPDX-License-Identifier: MIT pragma…
coding
  • 627
  • 7
  • 20
17
votes
4 answers

UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit

I am trying to deploy my simple solidity smart contract onto the Rinkeby Network but I keep getting the error: UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit. My solidity code is…
Jason
  • 1,059
  • 1
  • 13
  • 32
17
votes
2 answers

Is it possible to modify a variable value from another contract?

I could get the information about access another contract's variable from here But I couldn't find how to modify another contract's variable. Here is the example of contract A, contract A { uint public target; } And this is the example of…
Henry Kim
  • 575
  • 4
  • 19
17
votes
2 answers

Calling external contract in solidity dynamically

I am trying to make a contract have a function that is capable of calling functions of another contract. The key part of my goal is that the contract should not be able to be deployed without any import statements and will not know the name of the…
GK1
  • 447
  • 1
  • 5
  • 11
17
votes
2 answers

Member equal is not available in type(library Assert)

The problem arises when I want to test whether a string value is correct. Numbers are asserted correctly and don't return an error message when they are trying to be compiled. However, when I try to assert a string, it returns the following error…
DevNebulae
  • 4,566
  • 3
  • 16
  • 27
17
votes
2 answers

Division in Ethereum Solidity

I am creating a contract that issues tokens. I would like an account that holds tokens to be able to check what percentage they own out of all the tokens issued. I know that Ethereum has not implemented floating point numbers yet. What should I do?
GK1
  • 447
  • 1
  • 5
  • 11
17
votes
2 answers

Getting the address of a contract deployed by another contract

I am trying to deploy a contract from another factory contract and then return the address of the newly created contract. The address it returns however is the transaction hash not the contract address. I believe this is because the contract is not…
Joe
  • 321
  • 1
  • 2
  • 12
17
votes
2 answers

How do I initialize an array in a struct

I have a struct Purchase in which I'm putting an array of payments. However, when I try to add the new payments array in my makePayment method I get an error back from the solidity compiler: "Internal compiler error: Copying of type struct Payment…
unflores
  • 1,764
  • 2
  • 15
  • 35
16
votes
3 answers

How to get all tokens by wallet address

I am trying to pull a list of token contracts held by a wallet address, similar to how bscscan does, except programmatically. bscscan.com/apis does not have an endpoint, and web3js seems to only report the ETH balance. This is possible to achieve,…
Nomad
  • 163
  • 1
  • 1
  • 6
16
votes
2 answers

Send signed transactions to Ropsten or Truffle develop network with Trezor (Hardware Wallet)

Im trying to integrate web3js with Trezor in a truffle dev network or using ropsten test network. The idea is to sign the transactions using the hardware wallet and then send a raw transaction using web3js Im getting that we dont have balance to…
Marcos Martínez
  • 545
  • 2
  • 9
  • 24
16
votes
3 answers

What is the of use Web3.providers.HttpProvider("")

I want to interact with a smart contract using web3js. Every example will start with following var Web3 = require('web3'); var web3 = new Web3('http://localhost:8545'); // or var web3 = new Web3(new…
Divya Galla
  • 513
  • 1
  • 9
  • 31
16
votes
9 answers

Ethereum Web3.js returns "Cannot find module 'web3-requestManager'"

I'm trying to start using Ethereum Web3.js with node 6.11.1 on a macosx I installed web3 with the following command: npm install web3 Then i launch this - apparently - simple node command: Web3 = require('web3'); Well, it returns the following…
Umberto Stanca
  • 193
  • 1
  • 1
  • 4