Ethereum contract deployment and interaction
As an engineer, it is inherently of interest to me to investigate the 'languages' available to developers on the Ethereum platform.
It is actively being developed, and as a result there are a lot of discussions about its strengths and weaknesses.
Whilst there is some fantastic documentation which is supplemented by the example code provided by the foundation, I had yet to find a clear, and concise web based interface for generically and universally submitting and interfacing with contracts on the Ethereum network.
As such we have built this functionality over at EthTools.com
Submitting a contract
Submitting a contract requires a user account to submit a transaction to the blockchain which contains the bytecode of the contract in question.
To get this bytecode one must compile (convert) their Solidity sourcecode.
We have taken the functionality of browser solidity and implemented it as a step by step process that integrates with the other EthTools.com tooling to make the compilation, signing, and submission of a contract as simple as possible.
We have implemented functionality to allow quick, painless, one click linking of libraries as well as allowing a user to specify additional options to the compiler.
It really is as easy as 1, 2, 3.. 4, 5 :)
Interacting with a contract
Contracts provide function definitions which when called 'do something'.
There is little point in having deployed a contract if you can not interact with it.
Again we have implemented functionality such that any contract can be interacted with through a web based interface. You simply provide the arguments (if there are any) to the function in question, and click a button.
Reading from the Ethereum blockchain is free. As such any functions which simply return data can be called with one click. These results are returned near instantaneously.
Functions which write to the Blockchain however incur costs. These are the costs incurred by the miners who secure the block chain. As such, once again, our interact functionality integrates directly with our wallet tools such that you can pay the gas fees associated with a write operation.
As write operations require miners to 'mine' the transaction onto the blockchain, their execution is not instantaneous. There may be a short delay whilst the transaction is confirmed as having been included in a block on the chain. As a result no return values are received (and thus displayed) instantly. You can however utilise Events to trigger a response when the transaction has been mined. We will display a log of events triggered by a given function call as/when they are received.
The long and the short of it is that using this tooling you can submit and interact with an Ethereum contract without leaving the page.
Verifying a contract
To be able to display the available methods that one can call on a deployed contract, we need to know what they are.
When compiled we are left with bytecode from which one can not inherently discern a contract interface.
Whilst the Solidity compiler returns an Application Binary Interface, sadly (:P) not all contracts are deployed to the blockchain using EthTools.com
To discern the interface for a contract submitted through another platform we require you to verify it.
This requires you to submit your contracts sourcecode, and select the version of the compiler with which it was originally compiled. We then recompile the code, and verify that the generated bytecode matches that found on the blockchain.
Not only does this allow you to interact with the contract through EthTools.com, but it also allows us to present information about your contract to our other users.
Other users can read through your sourcecode, and verify that it does what you say that it does. This mechanism provides confidence and security to your users.
Whilst heavily tested, we are iterating quickly and breaking things.
Please let us know if you encounter any issues with the functionality, or have any suggestions for its further development.
Whilst tested with simple contracts, we have not tested (and don't advise) using this functionality for extremely large and complex contracts. Compilation will be slow, and reading and displaying extremely complex interfaces may not offer an optimal user experience.
This functionality is really provided to make development and testing of simple modular functionality as quick and easy as possible.
It is fantastic for example as a playbox for developing your first Solidity contracts.