Whitepaper - Ethereum Classic With Cover
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Ethereum</strong> <strong>Classic</strong> Documentation, Release 0.1<br />
info Additional metadata output from the compiler<br />
source The source code<br />
language<br />
languageVersion<br />
compilerVersion<br />
abiDefinition<br />
userDoc<br />
developerDoc<br />
The contract language (Solidity, Serpent, LLL)<br />
The contract language version<br />
The solidity compiler version that was used to compile this contract.<br />
The Application Binary Interface Definition<br />
The NatSpec Doc for users.<br />
The NatSpec Doc for developers.<br />
The immediate structuring of the compiler output (into code and info) reflects the two very different paths of<br />
deployment. The compiled EVM code is sent off to the blockchain with a contract creation transaction while the<br />
rest (info) will ideally live on the decentralised cloud as publicly verifiable metadata complementing the code on<br />
the blockchain.<br />
If your source contains multiple contracts, the output will contain an entry for each contact, the corresponding<br />
contract info object can be retrieved with the name of the contract as attribute name. You can try this by inspecting<br />
the most current GlobalRegistrar code:<br />
contracts = eth.compile.solidity(globalRegistrarSrc)<br />
Create and deploy a contract<br />
Before you begin this section, make sure you have both an unlocked account as well as some funds.<br />
You will now create a contract on the blockchain by sending a transaction to the empty address with the EVM<br />
code from the previous section as data.<br />
Note: This can be accomplished much easier using the online Solidity realtime compiler or the Mix IDE program.<br />
var primaryAddress = eth.accounts[0]<br />
var abi = [{ constant: false, inputs: [{ name: 'a', type: 'uint256' } ]<br />
var MyContract = eth.contract(abi)<br />
var contract = MyContract.new(arg1, arg2, ..., {from: primaryAddress, data: evmByteCodeFromPreviou<br />
All binary data is serialised in hexadecimal form. Hex strings always have a hex prefix 0x.<br />
Note: Note that arg1, arg2, ... are the arguments for the contract constructor, in case it accepts any. If<br />
the contract does not require any constructor arguments then these arguments can be omitted.<br />
It is worth pointing out that this step requires you to pay for execution. Your balance on the account (that you put<br />
as sender in the from field) will be reduced according to the gas rules of the EVM once your transaction makes<br />
it into a block. After some time, your transaction should appear included in a block confirming that the state it<br />
brought about is a consensus. Your contract now lives on the blockchain.<br />
The asynchronous way of doing the same looks like this:<br />
MyContract.new([arg1, arg2, ...,]{from: primaryAccount, data: evmCode}, function(err, contract) {<br />
if (!err && contract.address)<br />
console.log(contract.address);<br />
});<br />
82 Chapter 1. Contents