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
12
votes
5 answers

Creating Ethereum Contracts (go ethereum)

Trying to follow the wiki example for go ethereum to create a basic contract: https://github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions Everything seems to work until I get down until the last line: source = "contract test { function…
Raymond Carl
  • 368
  • 4
  • 13
11
votes
2 answers

Interact with deployed contract with ABI using Remix

How can I interact with an already deployed contract on ether(not mine) using Remix without the source code, but I have the ABI. The reason I want to do it is because some contract has more than 20 .sol files which I dont want to manually copy and…
Vova
  • 143
  • 5
11
votes
5 answers

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify “pragma solidity ^0.8.0”

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify “pragma solidity ^0.8.0” Here is a photo of the error - https://gyazo.com/2f5ea2f50cc1d4ef5eea2f21d0e04fe7 All my contracts are using the ^0.8.0 pragma. My…
Palm
  • 360
  • 2
  • 17
11
votes
2 answers

Solidity: How to represent bytes32 as string

This may be simple in other languages but I can't figure out how to do it in Solidity. I have a bytes32 like this 0x05416460deb76d57af601be17e777b93592d8d4d4a4096c57876a91c84f4a712. I don't want to convert the bytes to a string, rather I just want…
chnski
  • 557
  • 1
  • 4
  • 20
11
votes
4 answers

Does Solidity supports floating point number

I am new in solidity language. Have seen their documentation. Is there any floating point data type ?
Anijit Sau
  • 555
  • 2
  • 8
  • 25
11
votes
2 answers

Solidity : How does function parameters' size affects gas cost?

before anything here's some context : Let's say I'm implementing a dApp, and I want to reduce the number of times users have to call the related smart-contract. In order to do this, all the users' actions are stacked-up, client-side. Eventually,…
Folk
  • 111
  • 1
  • 3
11
votes
2 answers

upgradable smart contracts with Solidity: interface vs library?

In the context of upgradable smart contracts, when should one use interfaces and when libraries? I read several similar questions and blog posts, but none of them give a straight-to-the-point answer: (Sub) contract vs. library vs. struct vs.…
Mike
  • 393
  • 1
  • 3
  • 11
11
votes
2 answers

Deleting mapping from mapping in Solidity

I have something like this: mapping (address => mapping(string => uint)) m_Map; It can be accessed as m_Map[strCampaignName][addrRecipient], campaign can have multiple recipients... Now at some point (ICO failed), I need to remove that campaign…
Steve Brown
  • 369
  • 1
  • 3
  • 12
11
votes
2 answers

Solidity setting a mapping to empty

I am trying to create a smart contract using Solidity 0.4.4. I was wondering if there is a way to set a mapping with some values already entered to an empty one? For example: This initailises a new mappping mapping (uint => uint) map; Here I add…
antonis
  • 123
  • 1
  • 1
  • 9
11
votes
1 answer

What is the initial value of Ethereum contract variables?

I make some contracts code with mapping data. When I first access data value, ethereum returns 0. Is it specification of ethereum? In other word, Can I write a contract on the assumption that variable's initial value is 0?
11
votes
2 answers

How to close the console in the geth console

In Ethereum I opened the javascript console with "geth console" but I can not close it anymore. I have tried ctrl-c, but it does not work.
Thomas R.
  • 375
  • 1
  • 3
  • 12
10
votes
4 answers

"npx hardhat accounts" not available in Hardhat latest version 2.9.9

I have installed the latest version of hardhat. It installed fine. After setting hardhat up and installing all the required packages, when I run: npx hardhat accounts It gives an error: Error HH303: Unrecognized task accounts It seems like…
Umair
  • 313
  • 3
  • 10
10
votes
2 answers

why and when is setApprovalForAll called?

I'm having a hard time understanding why and when SetApprovalForAll is called on NFT generating contracts. Take Cool Cats, for example. And for convenience there's a screen shot of relevant transactions, below. I've noticed that for this contract…
Doug P
  • 361
  • 1
  • 4
  • 15
10
votes
6 answers

Metamask not connecting to localhost 8545

I was trying to follow a tutorial from devto.io and to send transactions to the smart contract, I would need to connect my MetaMask wallet using one of the accounts created when I ran npx hardhat node command. To do so, I opened MetaMask and updated…
fairdev610
  • 148
  • 1
  • 1
  • 10
10
votes
3 answers

Solidity: Data location must be "memory" or "calldata" for return parameter in function

I am learning Ethereum dev in Solidity and trying to run a simple HelloWorld program but ran into the following error: Data location must be "memory" or "calldata" for return parameter in function, but none was given. My code: pragma solidity…
Yash Jain
  • 442
  • 7
  • 19