Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 52

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

60 votes
Accepted

Is the block.timestamp value in Solidity seconds or milliseconds?

From the Solidity documentation (here and here): ... timestamp of the current block in seconds since the epoch For your other question: Also, is it safe to use block.timestamp to check if 30 …
Richard Horrocks's user avatar
47 votes
Accepted

What is the difference between `now` and `block.timestamp`?

From the documentation: now (uint): current block timestamp (alias for block.timestamp) Update: (Thanks @ShaneFontaine) Solidity 0.7.0 deprecated the now keyword. …
Richard Horrocks's user avatar
43 votes
Accepted

Visibility for constructor is ignored. If you want the contract to be non-deployable, making...

This is saying that adding public - a visibility specifier - to a constructor has no effect. Constructors are run only once, when the contract is initially deployed. They can't be called at a later ti …
Richard Horrocks's user avatar
33 votes
Accepted

What is uint256?

With regard to Solidity... This is really more a general computer science question that would best be answered on Stack Overflow. At the risk of repeating what @Ismael has linked to... …
Richard Horrocks's user avatar
32 votes
Accepted

Error while compiling: Stack too deep

The Solidity code doesn't appear to be consistent in the number of variables it sees as a problem, but you've got a limit of around 16 or 17. … Edit 2019: A very detailed explanation of this error, and how it can be avoided, is discussed in the article “Stack Too Deep”- Error in Solidity. …
Richard Horrocks's user avatar
30 votes
Accepted

Can I square root in Solidity?

An implementation of a square root function was added to the dapp-bin as part of a maths library a while back. Have a look at PR#50 (which is actually still open). I think the discussions boil down t …
Richard Horrocks's user avatar
21 votes
Accepted

What uint type should be declared for unix timestamps?

Not really an answer to what you're asking, but... Decreasing the size of a uint to less that 256 bits will increase the associated gas costs, not decrease it like you might be expecting. It'll be be …
Richard Horrocks's user avatar
19 votes

Meaning of 'using SafeMath for uint256;'

using ... for ... is explained in Solidity's documentation, here, and is a way to attach library functions to a given type. So in your case: using SafeMath for uint256; ...means that the functions …
Richard Horrocks's user avatar
16 votes
3 answers
5k views

What is formal verification, and why is it important for smart contracts?

"Formal verification" has appeared in various previous questions and answers, and I believe was the topic for one of the talks at DevCon2. Main question: It's perhaps quite broad, but what is formal …
Richard Horrocks's user avatar
13 votes
Accepted

Control Structures- why is switch and goto not in Solidity?

Solidity isn't Javascript. Neither of them are there. switch offers nothing more than a convenient if...else shortcut. I don't know why it wan't implemented in Solidity. …
Richard Horrocks's user avatar
12 votes
Accepted

ProviderError: max code size exceeded

How can I adjust the code size or any other method to resolve this error. The contract code size limit is 24kB (24,576 bytes). You'll need to reduce the size of the contract before deploying, or spl …
Richard Horrocks's user avatar
11 votes
Accepted

Why did Serpent die?

The creator recommends Solidity as a default choice, LLL if you want close-to-the-metal optimizations, or Viper if you like its features though it is still experimental. …
Richard Horrocks's user avatar
11 votes
Accepted

Where solidity files are stored in Remix IDE

The key is the name of the file, the value is the contents (i.e. the Solidity code). …
Richard Horrocks's user avatar
11 votes

Convert wei to ether in contract

The base unit for currency in Solidity is Wei. That means if you're dealing with balances, and you don't specify a unit, then it defaults to Wei. …
Richard Horrocks's user avatar
11 votes
Accepted

How to pass struct params in remix ide?

Your function takes an array of structures as an argument:
Richard Horrocks's user avatar

1
2 3 4 5
9
15 30 50 per page