Solidity FAQ

StephanTualStephanTual London, EnglandPosts: 1,282Member, Moderator mod
edited October 2014 in Solidity
The wiki for Solidity can be found at:

So why a 4th language? Well, Solidity could one day very well replace all three existing high level languages (Mutan, Serpent and LLL).

It indeed solves several particular problems with the current implementations:

Actual functions!

If you ever attempted to create a contract that has two or more actions (such as 'send', 'request', 'self-destruct', 'editSettings' etc), you probably found yourself sending a specific string or number to the contract to abstract the notion of a function call, then doing some parsing in-contract. This not only creates contracts that are hard to read, but it's also wasteful - after all, the string 'send' is only 4 bytes, but it still gets padded to 32 bytes before being passed to a contract.

Solidity solves this by providing contract functions, so that writing function sam(string32 in1) { ... } will be possible.

It's statically typed!

Anyone who ever tried to enter arbitrary text in a contract longer 32bytes will be glad to hear about the new string (256) and text (65536 bytes) types. They are joined by their friends bool, uint, address, real and many others, which should make development and execution a lot more efficient.

Comments that speak to the users!

For example if you wrote something like:
contract GavCoin
/// Send $((valueInmGAV / 1000).fixed(0,3)) GAV from the account of $(message.caller.address()), to an account accessible only by $(to.address()).
function send(address to, uint256 valueInmGAV) {
if (balances[message.caller] >= valueInmGAV) {
balances[to] += valueInmGAV;
balances[message.caller] -= valueInmGAV;
Then users of the "Cool Dapp 3000" could be prompted by the EtherBrowser with a message in English (or any other language) similar to: "Untrusted ÐApp "Cool Dapp 3000" attempting to transact in your name:
Send 45.780 GAV from the account of Your Name Here to an account accessible only by Cool Dapp 3000.
Do you wish to allow this?

While there are still opened questions around where said extracted documentation could live (potentially swarm), and how it would be audited, it's a step in the right direction.

As of 10/10/14, there is now a sample contract written in Solidity on the wiki.
Post edited by StephanTual on
This discussion has been closed.