first of all, id like to apologize for the lengthiness of this post, its the first in a series im hoping to pen in order to introduce everyone to smart contracts and dApps, in the hopes of getting more and varied dApps deployed onto the SOIL-VM.
as ive said before, i think the most important thing about SOIL is the fact we can run smart contracts (or dApps) on the blockchain. i truly believe that these are the the future of how we interact online, and given five years, smart contracts will be the underlying layer from everything from our email and social media to how we perform scientific studies and computational needs. it will lead, over the course of the next decade, to what stephen tual from Ethereum calls the "decentralization singularity".
right now, with SOIL as well as ETH, smart contracts remain fairly esoteric, not only in definition, but in building, deployment and essential end-user interaction. im hoping that thru some discussions here, we can get some other folks working of dApps on the SOIL blockchain.
why would SOIL be a great place to deploy smart contracts? the cost of the computational actions. where ETH is now $6.25, and "gas" to perform a transaction or deployment is 500 szabo (1 szabo=.00001ETH) the cost of transactions is $0.03125USD. this can add up in one is doing many transactions, which in business terms cuts in to the bottom line.
with SOIL, where whole unit costs are hovering around $0.015USD, the same transaction or computational cost works out to $0.000075USD. gas price acceptance by miners is alterable, as is the gas you want to use to perform a computation or transaction, but..well, default is default. with little incentive and nearly non-existent instructions to do so from a miners perspective, the "gas" system is becoming very inefficient and costly using ETH. what happens when ETH hits $10, or $20?
beyond the basic economic considerations of use on the EVM, the documentation for deployment and interaction with smart contracts is also less than accessible. so, maybe we need to break it down a little and put everything in simpler terms.
ive been watching the expansion of the dAppsphere over the last several months, and theres a lot of really promising projects being developed for Ethereum. being open source, this gives SOIL, as well as Expanse, the ability to really work with whats out there. unfortunately, generally without much support from the developers. but what makes smart contracts so important in the first place, especially now, in the nascent stages of the Virtual Machine architecture? and where does it go from here?
smart contracts are self-executing or self-enforcing (or both) bits of code that run on top of the virtual machine, which will create a decentralized internet, where we can access documents, perform scientific computations, and run financial and organizational schemes, just as a few examples. pretty much... imagination is the limit. as we continue to build this architecture into the blockchain, smart contracts will be able to communicate with each-other, creating massive scalability. right now, the bulk of contracts are very simple things, while there are some massive projects out there such as augur.
ethereum uses, essentially, three programming languages... solidity, serpent and lll. solidity is the language being pushed most, while serpent (a near relation to python) remains very usable. a number of online compilers exist, generally for the solidity language, to make setting up a contract from basic progamming language into machine code that is readable on the EVM. there are tons of tutorials online, although, with the speed of evolution for these languages, many times the example script is outdated and doesnt compile right, which just leads to frustration. other dApp development package managers are becoming available as well, both for solidity and for serpent, which seek to make building and deploying a contract much simpler. as we approach Homestead on ETH, which will naturally lead to improvements here on SOIL, we'll see a much greater accessibility to building dApps.
so, online compilers, on-console compilers.... thanks to peter, we have the SOIL development tool, based on cosmo, to work with.
(
https://bitcointalk.org/index.php?topic=1176709.msg13574585#msg13574585 ) but using the other compilers to break a contract code into bytecode or "web3 deployment code" can be used as well. one of the issues ive found working with these is that not every online compiler works the same, or provides the same output.
probably the most well-known online compiler is chriseth's one at github (
https://chriseth.github.io/browser-solidity/ ) and it remains the one im using more often than not. entering in your contract code in the left-side pane will present different forms of compiled code.
bytecode, which is how a contract is STORED on the blockchain is a long line of hexidecimal digits (0-9, a-h).
(*you can view the bytecode for many contracts already existing on the ETH blockchain at (
https://live.ether.camp/contracts ) and using some of the ETH block explorers, you can call up a contract's address and view the code built into it. (
https://www.etherchain.org provides the basic code (for verified source code), ABI, bytecodes and opcodes for contracts;
https://etherscan.io provides opcodes and bytecodes) )
interface brings up the contract API, which is used to communicate with the contract.
web3 deploy brings the information necessary to copy/paste into the clientside CLI (gsoil) in order to deploy the contract simply
uDApp is short for Universal DApp, which is considered "a Universal Interface for contracts on the Ethereum blockchain". the project behind this feature seems to have been abandoned, or rolled into the basic solidity compiler, solc.
other features with chriseth's compiler give you the solidity interface, opcodes, functions, and gas estimates.
etherchain's compiler at (
https://www.etherchain.org/solc ) presents much of the same information, but i find it buggy, with lots of errors in compiling presented. simple contracts work well, but anything meaty seems to have issues.
cosmo (
http://meteor-dapp-cosmo.meteor.com/ ) which is what peter's development tools are based on, presents a clean interface with which to build, compile and deploy dApps, including basic interfaces with which to call and transact with a smart contract (methods) and to interact with state-changing events, which is VERY helpful.
ether-fund (
http://ether.fund/tools/) has a development tool and compiler available under the "tools" section, but it requires an account with them, the creation of which seems to be broken. verification emails never arrive, setting up a new account leads to an error thats been in place for many months, unfixed.
compiling can also be done via the console on gsoil. first you must make sure that the compilers are available and installed. (
https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial) has a not-so-clear tutorial on how to enable this. you will have to do a little searching to find the necessary repositories for the various compilers.
ether-scripter (
http://etherscripter.com/0-5-1/) also maintains an online development tool for the serpent and lll languages, but ive not had much luck working with it thus far.
serpent also has the pyepm (pyethereum package manager) available, which requires building a .yaml file to handle releasing and setting up contracts. ill go into the list of development packages in another post.
for right now, id suggest looking into the projects available (
http://dapps.ethercasts.com/ ,
https://consensys.net/ventures/spokes/ ,
http://hack.ether.camp/) and see what interests you. start small, and work your way up into larger projects. a quick search for "smart contracts" at github also reveals a plethora of contracts being worked on. hope everyone is having a great day. me, im taking a long-deserved hike in the woods today and then, more work on my pet projects this evening.
Awesome information, thanks a lot! Thould this would be valuable to repost for information.