Smart contracts also known as a smart property are computer protocols that facilitate, verify, or enforce the negotiation or performance of a contract, or that make a contractual clause unnecessary.
Questions tagged [smartcontracts]
3050 questions
13
votes
7 answers
The transaction declared chain ID 5777, but the connected node is on 1337
I am trying to deploy my SimpleStorage.sol contract to a ganache local chain by making a transaction using python. It seems to have trouble connecting to the chain.
from solcx import compile_standard
from web3 import Web3
import json
import os
from…

E_charles
- 133
- 1
- 4
13
votes
3 answers
How can I return an array of struct in solidity?
I am designing a solution for an ethereum smart contract that does bidding. The use-case includes reserving a name eg. "myName" and assigning to an address. And then, people can bid for that name (in this case myName). There can be multiple such…

Suraj Kohli
- 547
- 2
- 5
- 11
13
votes
1 answer
who is the owner of the contracts deployed using truffle?
I am using testrpc and truffle to test my contract.
When I type truffle migrate , this will deploy my contract to the testrpc network.
My question is , which account (from testrpc accounts) has been used to deploy the contract.
In other word, whose…

sheemar
- 467
- 3
- 13
12
votes
4 answers
How to return array of address in solidity?
I am creating a smart contract in solidity ^0.5.1 in which I get the following error:
data location must be a memory for the return parameter in the function, but none was given.
In the below function I am getting error.
function getCitizen()public…

harsh
- 337
- 1
- 2
- 14
11
votes
3 answers
What is difference between internal and private in Solidity?
In Solidity we have four types of access. Two of them are private and internal.
What is the difference if both of them can be used inside smart contract and both of them are not visible after deploying?

Adam Kozlowski
- 5,606
- 2
- 32
- 51
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
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
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
10
votes
4 answers
I can not deploy the program to dev net with anchor
I get this error where I run anchor deploy:
Deploying workspace: http://127.0.0.1:8899
Upgrade authority: /home//.config/solana/id.json
Deploying program "faucet"...
Program path:…

Noldorin Zhang
- 181
- 1
- 2
- 7
10
votes
2 answers
How Execution price is calculated in Uniswap?
I've already spend few hours trying to understand execution price.
I understand the the concept of Mid price as it is the reserve ratio between two pairs.
According to Uniswap sdk documentation, Execution price is the ratio of assets sent/received.…

decentralmind
- 101
- 3
10
votes
3 answers
How to make an API call in solidity?
I have a smart contract that I’m trying to make, it pays out the winners of my League of Legends tournament. However I’m running into an issue. I need to make an API call to get the winner of the match, I have a simple URL that I’ve…
user13637241
10
votes
0 answers
How to fix 'write tcp 127.0.0.1:54917->127.0.0.1:8545: i/o timeout' error in golang code that listens to smart contract events
I am using golang to listen to the smart contract events. I deployed my contracts to ganache ui and ganache-cli ports. But I get the below error:
➜ sc_events go run main.go
2019/04/17 14:25:04 write tcp 127.0.0.1:54917->127.0.0.1:8545: i/o…

Sudharsan Ravikumar
- 433
- 6
- 13
10
votes
3 answers
Solidity - Solidity code to Input JSON Description
I want to compile my ethereum HelloWorld.sol smart contract. In all the tutorials is that you do it like this:
var solc = require('solc');
var compiledContract = solc.compile(fs.readFileSync('HelloWorld.sol').toString();
where HelloWorld.sol…

Banana Cake
- 1,172
- 1
- 12
- 31
10
votes
8 answers
Is it possible to store images on the Ethereum blockchain?
I'm ramping up on learning Solidity, and have some ideas. At the moment I am curious if files/images can be put on the blockchain. I'm thinking an alternative would be some hybrid approach where some stuff is on the blockchain, and some stuff is in…

Nik Hammer-Ellis
- 1,042
- 2
- 9
- 14