Questions tagged [solidity]

Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine. A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.

Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine.

2349 questions
34
votes
1 answer

What is address(0) in Solidity

Can anyone explain to me what address(0) is in Solidity? I found the following in the docs but it doesn't really make sense to me: If the target account is the zero-account (the account with the address 0), the transaction creates a new contract.…
pizzarob
  • 10,072
  • 4
  • 37
  • 63
25
votes
5 answers

Are there null like thing in solidity

struct buyer{ uint amount; Status status; } mapping(address=>buyer) public buyers; mapping(uint=>address) buyerIndex; uint public buyerNum; //Order a product. function(){ uint doubleValue=value*2; …
Hao WU
  • 361
  • 1
  • 3
  • 5
20
votes
6 answers

How to find out if an Ethereum address is a contract?

An address in Solidity can be an account or a contract (or other things, such as a transaction). When I have a variable x, holding an address, how can I test if it is a contract or not? (Yes, I've read the chapter on types in the doc)
bortzmeyer
  • 30,796
  • 10
  • 61
  • 89
19
votes
8 answers

String concatenation in solidity?

how do i concatenate strings in solidity? var str = 'asdf' var b = str + 'sdf' seems not to work.. I looked up the documentation (https://github.com/ethereum/wiki/wiki/Solidity-Tutorial#elementary-types-value-types) and there is not much mentioned…
tObi
  • 1,675
  • 3
  • 18
  • 30
18
votes
3 answers

How to return mapping list in Solidity? (Ethereum contract)

I want to make simple smart contract that has a list, can set item, and can get the list. Code in solidity: contract lister { mapping(int => string) list; int id = 0; function getList() returns ( /*HERE*/ ) { return list; …
6londe
  • 366
  • 1
  • 6
  • 16
17
votes
3 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
  • 977
  • 1
  • 12
  • 30
15
votes
10 answers

npm solc: AssertionError [ERR_ASSERTION]: Invalid callback specified

I am trying to compile solidity smart contract using npm solc. I tried to follow different examples. Link to example: https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440 I wrote my code like…
Mouazzam
  • 379
  • 3
  • 15
15
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
  • 260
  • 3
  • 10
13
votes
2 answers

Copying of type struct memory[] memory to storage not yet supported

How do I add a new empty Parent instance to the list of parents in the code sample below? I keep getting UnimplementedFeatureError: Copying of type struct Test.Child memory[] memory to storage not yet supported. Minimal example: contract Test { …
Jonas H.
  • 2,017
  • 2
  • 16
  • 21
13
votes
6 answers

String array in solidity

I came across quite a common problem that it seems I can't solve elegantly and efficiently in solidity. I've to pass an arbitrary long array of arbitrary long strings to a solidity contract. In my mind it should be something like function…
Fabio
  • 315
  • 1
  • 4
  • 14
12
votes
4 answers

Is there a pop functionality for solidity arrays?

I have used solidity to push data into an array. Is there a similar function for pop ? string[] myArray; myArray.push("hello") What is the best solution for this ? How do I delete an element in a dynamic array in solidity ?
Suraj Kohli
  • 377
  • 2
  • 4
  • 8
12
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
  • 407
  • 3
  • 10
11
votes
1 answer

Converting Object Promise to String in Javascript

I'm working with React, Next.Js, semantic-ui-react and Solidity. It is my goal to print out the users address (from MetaMask) and a ProjectTitle (set by User) as meta infomation for a semantic-ui-react card. To print out the address in the 'header'…
Saensation
  • 251
  • 1
  • 2
  • 7
11
votes
3 answers

web3 websocket connection prevents node process from exiting

I have a node js process that creates a web3 websocket connection, like so: web3 = new Web3('ws://localhost:7545') When the process completes (I send it a SIGTERM), it does not exit, but rather hangs forever with no console output. I registered a…
Andy Pang
  • 339
  • 2
  • 10
10
votes
1 answer

Module is extraneous npm

I obviously check there is connect-privkey-to-provider module in dependencies. However, it keep saying Module 'connect-privkey-to-provider' is extraneous npm and cannot find module 'connect-privkey-to-provider' What's wrong with my code? PS…
1Sun
  • 1,925
  • 3
  • 9
  • 20
1
2 3
99 100