Questions tagged [solidity]

Solidity is a language for smart contracts for blockchain technologies like Ethereum. It is designed to compile code for the Ethereum Virtual Machine. Use this tag for questions about programming smart contracts using the Solidity language.

Solidity is an object-oriented language whose syntax is similar to that of ECMAScript, but with static typing, and it is designed to compile to code for the Ethereum Virtual Machine for use in smart contracts in blockchain technologies.

6642 questions
8
votes
1 answer

Ethereum/Solidity - Query Transactions

Does solidity have the ability to query transactions it puts on the blockchain, based on data in the transaction? By query I mean within solidity code running inside a smart contract (not web3.js running outside a smart contract) So yesterday my…
Alex Kerezy
  • 101
  • 5
8
votes
1 answer

gas required exceeds allowance or always failing transaction on Geth private blockchain but works fine in others

I have created a private blockchain using geth. I also have a contract in which there is a function which call another function it third contract to set an address. I can call this function on Local blockchains like testRPC and Ganache blockchain,…
Farzad Salimi Jazi
  • 760
  • 10
  • 25
8
votes
1 answer

Can we get transaction information recorded in the past block using Solidity in the Smart contract?

I am studying blockchain with Ethereum, and I want to use past transaction data in the Smart contract using Solidity. If I use Web3.js module in the program written in javascript, I can get these data easily. But I can't get these data in the Smart…
i20gyawa
  • 83
  • 1
  • 4
8
votes
3 answers

How to know if a specific value exists in the mapping table or not?

I have a mapping table whcich stores multiple hashes into that table. What I want to do is that I want the user to add another hash with setinstructors() function and then try to look whether the same hash already exists in the mapping table or not.…
Vishva Patel
  • 105
  • 1
  • 1
  • 6
7
votes
2 answers

In remix Ide what does this notification means? "You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag"

You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag The notification message I have written a simple program of Hello World in the Remix IDE.
Ayushi George
  • 71
  • 2
  • 4
7
votes
4 answers

TypeError: Cannot read property 'length' of undefined - While deploying using hardhat

I am getting the following error while trying to deploy a Mock contract on the hardhat development chain. I am following: Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course by Patrick Collins on…
Rishav Sharma
  • 376
  • 2
  • 7
7
votes
2 answers

Error: Compiler version ^0.8.0 does not satisfy the r semver requirement

I am new to solidity and I am running code on Remix. It doesn't matter what version of compiler I specify, I keep on getting the same error. Can someone help me out? What does "Compiler version ^0.8.0 does not satisfy the r semver requirement"…
김예군
  • 169
  • 2
  • 7
7
votes
1 answer

How do I send transactions to RSK deployed smart contract functions via Ethers.js and Hardhat

I have followed this Hardhat tutorial and trying to test a demo smart contract on RSK regtest blockchain. Here is the hardhat.config.js setup I am using: require('@nomiclabs/hardhat-waffle'); module.exports = { solidity: '0.7.3', …
7alip
  • 895
  • 6
  • 11
7
votes
5 answers

Error: invalid BigNumber value (argument="value", value={"value":"25000000000000000"}, code=INVALID_ARGUMENT, version=bignumber/5.5.0)

I have tried changing the values from 0.025 ether to 1 ether then also its showing the same error. Also, I have tried with the rational number like 1/8 still not working. LOOKED into some answers but they didn't resolve the error. I have the same…
Megabyte
  • 139
  • 1
  • 2
  • 9
7
votes
2 answers

difference between interface and abstract contract in solidity

I am learning solidity and got to know that interface and abstract are both classes that may contain unused functions. My doubt is: What is the difference between interface and abstract contract in a solidity smart contract?
7
votes
4 answers

ParserError: Source file requires different compiler version (current compiler is 0.8.7+commit.e28d00a7.Emscripten.clang)

I was eventually trying to run this code in remix IDE, where I was running this using 0.6.6 version of Solidity and ran into this error. I've tried using some other versions like 0.8 and 0.6 as well. // SPDX-License-Identifier: MIT pragma solidity…
Gourav Singh Rawat
  • 421
  • 1
  • 7
  • 17
7
votes
2 answers

The need to allocate memory for string

I'm learning Solidity and I'm stuck on memory vs storage vs calldata. I'm reading the documentation and found this: Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function…
mdmb
  • 4,833
  • 7
  • 42
  • 90
7
votes
7 answers

MetaMask - RPC Error: Cannot set properties of undefined (setting 'loadingDefaults') error

I'm building a staking function and hitting the following error after giving permission to access my token: "MetaMask - RPC Error: Cannot set properties of undefined (setting 'loadingDefaults')" Staking function Solidity contract: // Staking…
Julien
  • 73
  • 6
7
votes
1 answer

How to check if the token on opensea is ERC721 or ERC1155 using node.js

const { OpenSeaPort, Network } = require("opensea-js"); const offer = await seaport.createBuyOrder({ asset: { tokenId, tokenAddress, schemaName }, accountAddress: WALLET_ADDRESS, startAmount: newOffer…
azvast
  • 337
  • 4
  • 10
7
votes
1 answer

ERC721: transfer caller is not owner nor approved

I have a nftToken Contract that mints token to msg.sender, then I have a function in a market contract that transfers the nft from owner to market contract. However, I am getting an error that says: ERC721: transfer caller is not owner nor…
sonika
  • 239
  • 1
  • 2
  • 9