├── README.md ├── SUMMARY.md ├── book.json ├── chapter1.md ├── cli_tools.md ├── code_editor.md ├── cold_wallet_storage_device.md ├── dapps_deployment.md ├── ethkey.md ├── getting_started.md ├── interactive_console.md ├── javascript_console.md ├── mining.md ├── mix.md ├── mix_bc.png ├── poa.md ├── project_editor.md ├── scenarios_editor.md ├── state_mix.png ├── state_viewer.md ├── styles └── website.css ├── transaction_debugger.md ├── transaction_explorer.md └── whisper.md /README.md: -------------------------------------------------------------------------------- 1 | TurboEthereum Guide 2 | ======= 3 | 4 | This book is intended as a practical user guide for the "Turbo" Ethereum software distribution, originally named after the language in which it is written, C++. 5 | 6 | TurboEthereum is a large distribution of software including a number of diverse tools. This book begins with the installation instructions, before proceeding to introductions, walk-throughs and references for the various tools that make up TurboEthereum. 7 | 8 | The full software suite of TurboEthereum includes: 9 | 10 | - **AlethOne** (`alethone`, "A1") The mainline Ethereum desktop miner. It connects and syncs to the Ethereum network and lets you mine, and send transactions. It will also let you do pool mining. 11 | - **AlethZero** (`alethzero`, "AZ") The power-user Ethereum client. It connects and syncs to the Ethereum network and lets you mine, make transactions, run DApps and inspect the blockchain. It has plugins to allow arbitrary extension. 12 | - **++eth** (`eth`) The mainline CLI Ethereum client. Run it in the background and it will connect to the Ethereum network; you can mine, make transactions and inspect the blockchain. 13 | - **Mix** (`mix`) The integrated development environment for DApp authoring. Quickly prototype and debug decentralised applications on the Ethereum platform. 14 | - `ethkey` A key/wallet management tool for Ethereum keys. This lets you add, remove and change your keys as well as *cold wallet device*-friendly transaction inspection and signing. 15 | - `ethminer` A standalone miner. This can be used to check how fast you can mine and will mine for you in concert with `eth`, `geth` and `pyethereum`. 16 | - `ethvm` The Ethereum virtual machine emulator. You can use this to run EVM code. 17 | - `solc` The Solidity compiler. You can use this to compile Solidity programs into assembly or machine code. 18 | - `rlp` An serialisation/deserialisation tool for the Recursive Length Prefix format. 19 | 20 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](README.md) 4 | * [Installation](chapter1.md) 5 | * [CLI Tools](cli_tools.md) 6 | * [Getting started](getting_started.md) 7 | * [Interactive Console](interactive_console.md) 8 | * [Mining](mining.md) 9 | * [PoA Private Chains](poa.md) 10 | * [ethkey](ethkey.md) 11 | * [Mix](mix.md) 12 | * [Project Editor](project_editor.md) 13 | * [Scenarios Editor](scenarios_editor.md) 14 | * [State Viewer](state_viewer.md) 15 | * [Transaction Explorer](transaction_explorer.md) 16 | * [JavaScript console](javascript_console.md) 17 | * [Transaction debugger](transaction_debugger.md) 18 | * [Dapps deployment](dapps_deployment.md) 19 | * [Code Editor](code_editor.md) 20 | * [Whisper](whisper.md) 21 | * Recipes and How-tos 22 | * [Cold Wallet Storage Device](cold_wallet_storage_device.md) 23 | 24 | -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /chapter1.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Installation is a different process dependent on which platform you run. At present, TurboEthereum supports three platforms: Ubuntu, Mac OS X and Windows. 4 | 5 | For installing the desktop tools on Windows and Mac, just grab the [latest release](https://github.com/ethereum/webthree-umbrella/releases). (For Windows you might also need [this](http://www.microsoft.com/en-US/download/details.aspx?id=40784).) 6 | 7 | For installing on Ubuntu or Homebrew, instructions follow. 8 | 9 | # Installing on Ubuntu 14.04 and later (64-bit) 10 | 11 | **Warning: The `ethereum-qt` PPA will upgrade your system-wide Qt5 installation, from 5.2 on Trusty and 5.3 on Utopic, to 5.5.** 12 | 13 | For the latest stable version: 14 | ``` 15 | sudo add-apt-repository ppa:ethereum/ethereum-qt 16 | sudo add-apt-repository ppa:ethereum/ethereum 17 | sudo apt-get update 18 | sudo apt-get install cpp-ethereum 19 | ``` 20 | 21 | If you want to use the cutting edge developer version: 22 | ``` 23 | sudo add-apt-repository ppa:ethereum/ethereum-qt 24 | sudo add-apt-repository ppa:ethereum/ethereum 25 | sudo add-apt-repository ppa:ethereum/ethereum-dev 26 | sudo apt-get update 27 | sudo apt-get install cpp-ethereum 28 | ``` 29 | 30 | ## Installing the Mix IDE 31 | 32 | Mix, the developer IDE is still in its infancy and still needs a lot of work. If you are adventurous, you can try to run Mix by installing the cutting edge developer version of cpp-ethereum (see above) and then add this: 33 | 34 | ``` 35 | sudo add-apt-repository ppa:ethereum/ethereum-qt 36 | sudo add-apt-repository ppa:ethereum/ethereum 37 | sudo add-apt-repository ppa:ethereum/ethereum-dev 38 | sudo apt-get update 39 | sudo apt-get install mix 40 | mix 41 | ``` 42 | 43 | 58 | 59 | # Installing on OS X and Homebrew 60 | 61 | If you want the full suite of CLI tools, include `eth` and `ethminer`, you'll need [Homebrew](brew.sh). 62 | 63 | Once you've got Homebrew installed, tap the ethereum brew: 64 | ``` 65 | brew tap ethereum/ethereum 66 | ``` 67 | 68 | Then, for the stable version: 69 | ``` 70 | brew install cpp-ethereum 71 | brew linkapps cpp-ethereum 72 | ``` 73 | 74 | or, for the latest cutting edge developer version: 75 | ``` 76 | brew reinstall cpp-ethereum --devel 77 | brew linkapps cpp-ethereum 78 | ``` 79 | 80 | Add the `--with-gui` option to include the AlethZero and the Mix IDE in the installation; you can then find `AlethZero` and `Mix` in your Applications folder. 81 | 82 | For options and patches, see: https://github.com/ethereum/homebrew-ethereum 83 | 84 | -------------------------------------------------------------------------------- /cli_tools.md: -------------------------------------------------------------------------------- 1 | # CLI Tools 2 | 3 | -------------------------------------------------------------------------------- /code_editor.md: -------------------------------------------------------------------------------- 1 | # Code Editor 2 | 3 | This editor provides basic functionalities of a code editor. 4 | 5 | - In Solidity or JavaScript mode, an autocompletion plugin is available (Ctrl + Space). 6 | 7 | - Increasing/decreasing the font size (Ctrl +, Ctrl -) 8 | 9 | - In Solidity mode, you can display the gas estimation (Tools -> Display Gas Estimation). This will highlight all statements which requires a minimum amount of gas. Color turns to red if the gas required becomes important. 10 | It will also display the max execution cost of a transaction (for each function). 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cold_wallet_storage_device.md: -------------------------------------------------------------------------------- 1 | # Cold Wallet Storage Device 2 | 3 | A Cold Wallet Storage Device (CWSD) is a device (duh) used to store keys and sign transactions which never touches the internet, or indeed any communications channels excepting those solely for basic user interaction. The use of such a device is pretty much necessary for storing any large sum of value or other blockchain-based asset, promise or instrument. For example, a device like this has been used for operating blockchain-based keys worth many millions of dollars. 4 | 5 | For this how-to, we'll assume that the CWSD is a simple Ubuntu-based computer (a netbook works pretty well) with TurboEthereum preinstalled as per the first chapter; I will assume that you've taken the proper precautions to avoid any malware getting on to the machine (though without an internet connection, there's not too much damage malware can realistically cause). 6 | 7 | ### Kill the network 8 | 9 | The first thing to do is to make sure you've disabled any network connection, wireless or otherwise. Maybe compile a kernel without ICP/IP and Bluetooth, maybe just destroy or remove the network hardware of the computer. It is this precaution that puts the 'C' in CWSD. 10 | 11 | ### Generate the keys 12 | 13 | The next thing to do is to generate the key (or keys) that this machine will store. Run `ethkey` to create a wallet and then again to make as many keys as you would like to use. You can always make more later. For now I'll make one: 14 | 15 | ``` 16 | > ethkey createwallet 17 | Please enter a MASTER passphrase to protect your key store (make it strong!): password 18 | Please confirm the passphrase by entering it again: password 19 | > ethkey new supersecret 20 | Enter a passphrase with which to secure this account (or nothing to use the master passphrase): password 21 | Please confirm the passphrase by entering it again: password 22 | Enter a hint to help you remember this passphrase: just 'password' 23 | Created key 055dde03-47ff-dded-8950-0fe39b1fa101 24 | Name: supersecret 25 | Password hint: just 'password' 26 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 27 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 28 | ``` 29 | 30 | It will prompt for a password and confirmation for both commands. I'm just going to use the password "password" for both. 31 | 32 | This "supersecret" key has an address of `XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ`. 33 | 34 | ### Signing with the keys 35 | 36 | Signing with the keys can happen in two ways: The first is to export a transaction to sign from e.g. AlethZero, perhaps saving to a USB pendrive. Let's assume that is what we have done and we have the hex-encoded transaction at `/mnt/paygav.tx`. 37 | 38 | In order to sign this transaction we just need a single `ethkey` invocation: 39 | 40 | ``` 41 | > ethkey sign supersecret /tmp/paygav.tx 42 | ``` 43 | 44 | It will prompt you for the passphrase and finally place the signed hex in a file `/mnt/paygav.tx.signed`. Easy. If we just want to copy and paste the hex (we're too paranoid to use pen drives!) then we would just do: 45 | 46 | ``` 47 | > echo "" | ethkey sign supersecret 48 | ``` 49 | 50 | At which it will ask for your passphrase and spit out the hex of the signed transaction. 51 | 52 | Alternatively, if we don't yet have an unsigned transaction, but we actually want to construct a transactions locally, we can do that too. 53 | 54 | Let's assume our "supersecret" account has received some ether in the meantime and we want to pay somebody 2.1 grand of this ether (2100 ether for those not used to my English colloquialisms). That's easy, too. 55 | 56 | ``` 57 | > ethkey sign supersecret --tx-dest --tx-gas 55000 --tx-gasprice 50000000000 --tx-value 2100000000000000000 --tx-nonce 0 58 | ``` 59 | 60 | Note the `--tx-value` (the amount to transfer) and the `--tx-gasprice` (the price we pay for a single unit of gas) must be specified in Wei, hence the large numbers there. `--tx-nonce` only needs to be specified if it's not the first transaction sent from this account. 61 | 62 | ### Importing the key 63 | 64 | You may want to eventually import the key to your everyday device. This may be to use it directly there or simply to facilitate the creation of unsigned transactions for later signing on the CWSD. Assuming you have a strong passphrase, importing the key on to a hot device itself should not compromise the secret's safety too much (though obviously it's materially less secure than being on a physically isolated machine). 65 | 66 | To do this, simply copy the JSON file(s) in your `~/.web3/keys` path to somewhere accessible on your other (non-CWSD) computer. Let's assume this other computer now has our "supersecret" key at `/mnt/supersecret.json`. There are two ways of importing it into your Ethereum wallet. The first is simplest: 67 | 68 | ``` 69 | > ethkey import /mnt/supersecret.json supersecret 70 | Enter the passphrase for the key: password 71 | Enter a hint to help you remember the key's passphrase: just 'password' 72 | Imported key 055dde03-47ff-dded-8950-0fe39b1fa101 73 | Name: supersecret 74 | Password hint: just 'password' 75 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 76 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 77 | ``` 78 | 79 | A key can only be added to the wallet whose address is known; to figure out the address, `ethkey` will you to type your passphrase. 80 | 81 | This is less than ideal since if the machine is actually compromised (perhaps with a keylogger), then an attacker could slurp up your passphrase and key JSON and be able to fraudulently use that account as they pleased. Ouch. 82 | 83 | A more secure way, especially if you're not planning on using the key directly from this hot machine in the near future, is to provide the address manually on import. It won't ask you for the passphrase and thus potentially compromise the secret's integrity (assuming the machine is actually compromised in the first place!). 84 | 85 | To do this, I would remember the "supersecret" account was `XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ` and tell `ethkey` as such while importing: 86 | 87 | ``` 88 | > ethkey importwithaddress XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ supersecret 89 | Enter a hint to help you remember the key's passphrase: just 'password' 90 | Imported key 055dde03-47ff-dded-8950-0fe39b1fa101 91 | Name: supersecret 92 | Password hint: just 'password' 93 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 94 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 95 | ``` 96 | 97 | In both cases, we'll be able to see the key in e.g. AlethZero as one of our own, though we will not be able to sign with it without entering the passphrase. Assuming you never enter the passphrase on the hot machine (but rather do all signing on the CWSD) then you should be reasonably safe. Just be warned that the security of the secret is lieing on the network security of your hot machine *and* the strength of your key's passphrase. I really wouldn't count on the former. -------------------------------------------------------------------------------- /dapps_deployment.md: -------------------------------------------------------------------------------- 1 | # Dapps deployment 2 | 3 | 4 | This feature allows users to deploy the current project as a Dapp in the main blockchain. 5 | This will deploy contracts and register frontend resources. 6 | 7 | The deployment process includes three steps: 8 | 9 | - **Deploy contract**: 10 | This step will deploy contracts in the main blockchain. 11 | 12 | - **Package dapp**: 13 | This step is used to package and upload frontend resources. 14 | 15 | - **Register**: 16 | To render the Dapp, the Ethereum browser (Mist or AlethZero) needs to access this package. This step will register the URL where the resources are stored. 17 | 18 | To Deploy your Dapp, Please follow these instructions: 19 | 20 | Click on `Deploy`, `Deploy to Network`. 21 | This modal dialog displays three parts (see above): 22 | 23 | - **Deploy contract** 24 | 25 | - *Select Scenario* 26 | 27 | "Ethereum node URL" is the location where a node is running, there must be a node running in order to initiate deployment. 28 | 29 | "Pick Scenario to deploy" is a mandatory step. Mix will execute transactions that are in the selected scenario (all transactions except transactions that are not related to contract creation or contract call). Mix will display all the transactions in the panel below with all associated input parameters. 30 | 31 | "Gas Used": depending on the selected scenario, Mix will display the total gas used. 32 | 33 | - *Deploy Scenario* 34 | 35 | "Deployment account" allow selecting the account that Mix will use to execute transactions. 36 | 37 | "Gas Price" shows the default gas price of the network. You can also specify a different value. 38 | 39 | "Deployment cost": depending on the value of the gas price that you want to use and the selected scenario. this will display the amount ether that the deployment need. 40 | 41 | "Deployed Contract": before any deployment this part is empty. This will be filled once the deployment is finished by all contract addresses that have been created. 42 | 43 | "Verifications". This will shows the number of verifications (number of blocks generated on top of the last block which contains the last deployed transactions). Mix keep track of all the transactions. If one is missing (unvalidated) it will be displayed in this panel. 44 | 45 | - **Package dapp** 46 | 47 | - *Generate local package* 48 | 49 | The action "Generate Package" will create the package.dapp in the specified folder 50 | 51 | "Local package Url" the content of this field can be pasted directly in AlethZero in order to use the dapp before uploading it. 52 | 53 | - *Upload and share package* 54 | 55 | This step has to be done outside of Mix. package.dapp file has to be hosted by a server in order to be available by all users. 56 | 57 | "Copy Base64" will copy the base64 value of the package to the clipboard. 58 | 59 | "Host in pastebin.com" will open pastebin.com in a browser (you can then host your package as base64). 60 | 61 | - **Package dapp** 62 | 63 | "Root Registrar address" is the account address of the root registrar contract 64 | 65 | "Http URL" is the url where resources are hosted (pastebin.com or similar) 66 | 67 | "Ethereum URL" is the url that users will use in AlethZero or Mist to access your dapp. 68 | 69 | "Formatted Ethereum URL" is the url that users will use in AlethZero or Mist to access your dapp. 70 | 71 | "Gas Price" shows the default gas price of the network. You can also specify a different value. 72 | 73 | "Registration Cost" will display the amount of ether you need to register your dapp url. 74 | 75 | 76 | -------------------------------------------------------------------------------- /ethkey.md: -------------------------------------------------------------------------------- 1 | # ethkey 2 | 3 | `ethkey` is a CLI tool that allows you to interact with the Ethereum wallet. With it you can list, inspect, create, delete and modify keys and inspect, create and sign transactions. 4 | 5 | ### Keys and Wallets 6 | 7 | When using Ethereum you will own one or more `keys`. These are special files that allow you access to a particular account. Such access might allow you to spend funds, register a name or transfer an asset. Keys are standardised and compatible across major clients. They are always protected by password-based encryption. Also they do not directly identify the actual account that the key represents. To determine this, the key must be decrypted through providing the correct password. 8 | 9 | In TurboEthereum, your *wallet* keeps a track of each key that you own along with what *address* it represents. An address is just way of referring to a particular *account* in Ethereum. It, too, is protected by a password, which is generally provided when the client begins. 10 | 11 | While all clients have keys, some do not have wallets; these clients typically store the address in the key in plain view. This substantially reduces privacy. 12 | 13 | ### Creating a Wallet 14 | 15 | We'll assume you have not yet run a client such as `eth` or anything in the Aleth series of clients. If you have, you should skip this section. 16 | 17 | To create a wallet, run `ethkey` with the `createwallet` command: 18 | 19 | ``` 20 | > ethkey createwallet 21 | Please enter a MASTER passphrase to protect your key store (make it strong!): 22 | ``` 23 | 24 | You'll be asked for a "master" passphrase. This protects your privacy and acts as a default password for any keys. You'll need to confirm it by entering the same text again. 25 | 26 | ### Listing the Keys in your Wallet 27 | 28 | We can list the keys within the wallet simply by using the `list` command: 29 | 30 | ``` 31 | > ethkey list 32 | No keys found. 33 | ``` 34 | 35 | We haven't yet created any keys, and it's telling us so! Let's create one. 36 | 37 | ### Creating your First Key 38 | 39 | One of the nice things about Ethereum is that creating a key is tantamount to creating an account. You don't need to tell anybody else you're doing it, you don't even need to be connected to the Internet. Of course your new account will not contain any Ether. But it'll be yours and you can be certain that without your key and your password, nobody else can ever access it. 40 | 41 | To create a key, we use the `new` command. To use it we must pass a name - this is the name we'll give to this account in the wallet. Let's call it "test": 42 | 43 | ``` 44 | > ethkey new test 45 | Enter a passphrase with which to secure this account (or nothing to use the master passphrase): 46 | ``` 47 | 48 | It will prompt you to enter a passphrase to protect this key. If you just press enter, it'll use the default "master" passphrase. Typically this means you won't need to enter the passphrase for the key when you want to use the account (since it remembers the master passphrase). In general, you should try to use a different passphrase for each key since it prevents one compromised passphrase from giving access to other accounts. However, out of convenience you might decide that for low-security accounts to use the same passphrase. 49 | 50 | Here, let's give it the incredibly imaginitive passphrase of `123`. 51 | 52 | Once you enter a passphrase, it'll ask you to confirm it by entering again. Enter `123` a second time. 53 | 54 | Because you gave it its own passphrase, it'll also ask you to provide a hint for this password which will be displayed to you whenever it asks you to enter it. The hint is stored in the wallet and is itself protected by the master passphrase. Enter the truly awful hint of `321 backwards`. 55 | 56 | ``` 57 | > ethkey new test 58 | Enter a passphrase with which to secure this account (or nothing to use the master passphrase): 59 | Please confirm the passphrase by entering it again: 60 | Enter a hint to help you remember this passphrase: 321 backwards 61 | Created key 055dde03-47ff-dded-8950-0fe39b1fa101 62 | Name: test 63 | Password hint: 321 backwards 64 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 65 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 66 | ``` 67 | 68 | Notice the last two lines there. One is the ICAP address, the other is the raw hexadecimal address. The latter is an older representation of address that you'll sometimes see and is being phased out in favour of the shorter ICAP address which also includes a checksum to avoid problems with mistyping. All normal (aka *direct*) ICAP addresses begin with `XE` so you should be able to recognise them easily. 69 | 70 | Notice also that the key has another identifier after `Created key`. This is known as the UUID. This is a unique identifer for the key that has absolutely nothing to do with the account itself. Knowing it does nothing to help an attacker discover who you are on the network. It also happens to be the filename for the key, which you can find in either `~/.web3/keys` (Mac or Linux) or `$HOME/AppData/Web3/keys` (Windows). 71 | 72 | Now let's make sure it worked properly by listing the keys in the wallet: 73 | 74 | ``` 75 | > ethkey list 76 | 055dde03-47ff-dded-8950-0fe39b1fa101 0092e965… XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ test 77 | ``` 78 | 79 | It reports one key on each line (for a total of one key here). In this case our key is stored in a file `055dde...` and has an ICAP address beginning `XE472EVK...`. Not especially easy things to remember so rather helpful that it has its proper name, `test`, too. 80 | 81 | ### ICAP or Raw hex? 82 | 83 | You might see addresses passed as hex-only strings, especially with old software. These are dangerous since they don't include a checksum or special code to detect typos. You should generally try to keep clear of them. 84 | 85 | Occasionally, however, it's important to convert between the two. `ethkey` provides the `inspect` command for this purpose. When passed any address, file or UUID, it will tell you information about it including both formats of address. 86 | 87 | For example, to get it to tell us about our account, we might use: 88 | 89 | ``` 90 | > ethkey inspect test 91 | test (0092e965…) 92 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 93 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 94 | ``` 95 | 96 | We could just as easily use the ICAP `XE472EVK...` or raw hex `0092e965...`: 97 | 98 | ``` 99 | > ethkey inspect XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 100 | test (0092e965…) 101 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 102 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 103 | > ethkey inspect 0092e965928626f8880629cec353d3fd7ca5974f 104 | test (0092e965…) 105 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 106 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 107 | ``` 108 | 109 | ### Backing up Your Keys 110 | 111 | You should always back up your keys! Any backup solution that protects your home directory should also protect your keys (since that's where they live). However for added piece of mind make an explicit backup of your keys by copying the contents of the `~/.web3/keys` (Mac or Linux, or `$HOME/AppData/Web3/keys` for Windows) to an external disk. You might also open the files in a text editor, print them and keep them in a lawyer's safe for additional piece of mind. **If they get lost, nobody can help you!** 112 | 113 | ### Decoding a Transaction 114 | 115 | Here's an unsigned transaction. It authorises the donation of 1 ether to me: 116 | 117 | ``` 118 | ec80850ba43b74008252089400be78bf8a425471eca0cf1d255118bc080abf95880de0b6b3a7640000801b8080 119 | ``` 120 | 121 | On its own, it won't do much. We can see this by decoding it in `ethkey`: 122 | 123 | ``` 124 | > ethkey decode ec80850ba43b74008252089400be78bf8a425471eca0cf1d255118bc080abf95880de0b6b3a7640000801b8080 125 | Transaction 705d490edc318b50223efa7bb9c19d65f05c3c527e4f8e60535b46a2ed128706 126 | type: message 127 | to: XE6934MX3U67M48MPHYMC1A1X306AFKEXH (00be78bf…) 128 | data: none 129 | from: 130 | value: 1 ether (1000000000000000000 wei) 131 | nonce: 0 132 | gas: 21000 133 | gas price: 50 Gwei (50000000000 wei) 134 | signing hash: f2790ed53c803ee882c892e1d9715181dfc93780d755fbe4ffefd90701e15c31 135 | ``` 136 | 137 | Note that it states the transaction is `` to the right of `from:`. This means that at present it's useless. Signing it would make it useful (to me, at least, since it'd make me one Ether richer), or dangerous (to you if you didn't want to give me that Ether). 138 | 139 | ### Signing a Transaction 140 | 141 | `ethkey` can be used to sign a pre-existing, but unsigned, transaction (it can also create a transaction and sign it itself). In this case, the transaction is actually harmless anyway since we're signing with the key of a fresh account that has no Ether to be transferred. 142 | 143 | The command we'll use is `sign`. To use it we must identify the account with which we wish to sign. This can be the ICAP (`XE472EVK...`), the hex address (`0092e965...`), the UUID (`055dde...`), the key file or simply the plain old name (`test`). Secondly you must describe transaction it should sign. This can be done through passing the hex or through a file containing the hex. 144 | 145 | ``` 146 | > ethkey sign test ec80850ba43b74008252089400be78bf8a425471eca0cf1d255118bc080abf95880de0b6b3a7640000801b8080 147 | Enter passphrase for key (hint:321 backwards): 148 | ``` 149 | 150 | It will ask you for the passphrase from earlier, along with the ludicrously transparent hint. Enter `123`, the correct answer and it will provide you with the unsigned transaction (`a37c58...`), a `:` and the signed transaction (`f86c80...`): 151 | 152 | ``` 153 | a37c588c853dc20bbaef53b680e23642a03122897bbb9a53d25d0d8f3665a94f: f86c80850ba43b74008252089400be78bf8a425471eca0cf1d255118bc080abf95880de0b6b3a7640000801ca07638c34170f3e04313bbb6c5bfc10a0c665200515a1aa5e922c7ae6c0dd085faa079ab46048e643bb4042bcb22da86d2646eb0b727f23aa3e165102b824563c70d 154 | ``` 155 | 156 | Let's make sure it worked by decoding it. 157 | 158 | ``` 159 | > ethkey decode f86c80850ba43b74008252089400be78bf8a425471eca0cf1d255118bc080abf95880de0b6b3a7640000801ca07638c34170f3e04313bbb6c5bfc10a0c665200515a1aa5e922c7ae6c0dd085faa079ab46048e643bb4042bcb22da86d2646eb0b727f23aa3e165102b824563c70d 160 | Transaction a37c588c853dc20bbaef53b680e23642a03122897bbb9a53d25d0d8f3665a94f 161 | type: message 162 | to: XE6934MX3U67M48MPHYMC1A1X306AFKEXH (00be78bf…) 163 | data: none 164 | from: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ (0092e965…) 165 | value: 1 ether (1000000000000000000 wei) 166 | nonce: 0 167 | gas: 21000 168 | gas price: 50 Gwei (50000000000 wei) 169 | signing hash: f2790ed53c803ee882c892e1d9715181dfc93780d755fbe4ffefd90701e15c31 170 | v: 1 171 | r: 7638c34170f3e04313bbb6c5bfc10a0c665200515a1aa5e922c7ae6c0dd085fa 172 | s: 79ab46048e643bb4042bcb22da86d2646eb0b727f23aa3e165102b824563c70d 173 | ``` 174 | 175 | Being a signed transaction, it has the three fields at the end (`v`, `r` and `s`) and, importantly, the address from whom the transaction is sent (`from:`). You'll notice that the sender address (`XE472EVK...`) is indeed ours from before! 176 | 177 | The signed transaction can be sent in an e-mail in a similar way to how you might send a cheque in the mail. It can also be placed on the network to enact it; through the web3 API web3.sendRawTransaction 178 | 179 | ### Killing an Account 180 | 181 | Let's now delete our key we've made. Deleting a key actually actually deletes the underlying file. After doing this there's no going back (unless you have a backup). To avoid losing anything, we're first going to back up our account. First, let's copy the key file somewhere safe: 182 | 183 | ``` 184 | > mkdir ~/backup-keys 185 | > cp ~/.web3/keys/* ~/backup-keys 186 | ``` 187 | 188 | or, for Windows: 189 | 190 | ``` 191 | > md $HOME/backup-keys 192 | > copy $HOME/AppData/Web3/keys/*.* $HOME/backup-keys 193 | ``` 194 | 195 | Now, we'll delete the key with the `kill` command: 196 | 197 | ``` 198 | > ethkey kill test 199 | 1 key(s) deleted. 200 | ``` 201 | 202 | And bang! It's gone. 203 | 204 | Check by calling `list`: 205 | 206 | 207 | ``` 208 | > ethkey list 209 | No keys found. 210 | ``` 211 | 212 | ### Restoring an Account from a Backup 213 | 214 | Now let's support we made a horrible mistake and want to recover the account. Luckily we made a backup! 215 | 216 | We could simply copy it back into the original `keys` directory. This would indeed make the key "available", however it would only be identifiable by its UUID (the filename minus the `.json`). This is a bit of a pain. 217 | 218 | Better would be to reimport it into the wallet, which makes it addressable by its ICAP and hex, and gives it a name and password hint to boot. To do this, we need to use the `import` command, which takes the file and the name of the key: 219 | 220 | ``` 221 | > ethkey import ~/backup-keys/* test 222 | ``` 223 | 224 | or, for Windows: 225 | 226 | ``` 227 | > ethkey import $HOME/backup-keys/*.* test 228 | ``` 229 | 230 | Here it will need to know the passphrase for the key, mainly to determine the address of the key for placing into the wallet. There's no hint now because the wallet doesn't know anything about it. Enter the `123` passphrase. 231 | 232 | It will then ask you to provide a hint (assuming it's different to the master password, which ours is). Enter the same hint. 233 | 234 | ``` 235 | Enter the passphrase for the key: 236 | Enter a hint to help you remember the key's passphrase: 321 backwards 237 | Imported key 055dde03-47ff-dded-8950-0fe39b1fa101 238 | Name: test 239 | Password hint: 321 backwards 240 | ICAP: XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ 241 | Raw hex: 0092e965928626f8880629cec353d3fd7ca5974f 242 | ``` 243 | 244 | Finally it will tell you that all went well and the key is reimported. We should recognise our address by now with the `XE472EVK...`. 245 | 246 | To double-check, we can list the keys: 247 | 248 | ``` 249 | > ethkey list 250 | 055dde03-47ff-dded-8950-0fe39b1fa101 0092e965… XE472EVKU3CGMJF2YQ0J9RO1Y90BC0LDFZ test 251 | ``` 252 | 253 | All restored! 254 | 255 | ### Importing a key from another client (e.g. Geth) 256 | 257 | Because our keys all share the same format it's really easy to import keys from other clients like Geth. In fact it's exactly the same process as restoring a key from a previous backup as we did in the last step. 258 | 259 | If we assume we have a geth key at `mygethkey.json`, then to import it to use `eth`, simply use: 260 | 261 | ``` 262 | > ethkey import mygethkey.json "My Old Geth Key" 263 | ``` 264 | 265 | It will prompt you for your passphrase to ascertain the address for the key. 266 | 267 | 268 | ### Changing the Password 269 | 270 | Security people reckon that it is prudent to change your password regularly. You can do so easily with `ethkey` using the `recode` command (which actually does a whole lot more, but that's advanced usage). 271 | 272 | To do so, simply pass in the name(s) of any keys whose passwords you wish to change. Let's change our key's password: 273 | 274 | ``` 275 | > ethkey recode test 276 | Enter old passphrase for key 'test' (hint: 321 backwards): 277 | ``` 278 | 279 | So it begins by asking for your key's old passphrase. Enter in the correct answer `123`. 280 | 281 | It will then ask you for the new password (enter `321`) followed by a confirmation (enter the same) and a password hint (`123 backwards`). 282 | 283 | ``` 284 | Enter new passphrase for key 'test': 285 | Please confirm the passphrase by entering it again: 286 | Enter a hint to help you remember this passphrase: 123 backwards 287 | Re-encoded key 'test' successfully. 288 | ``` 289 | 290 | You'll finally get a confirmation that the re-encoding took place; your key is now encrypted by the new password. 291 | 292 | ## The Rest 293 | 294 | There's much more to discover with `ethkey`; it provides a suite of commands for playing with "bare" secrets, those not in the wallet (the `listbare`, `newbare`, ... commands), with brain wallets (`newbrain`, `importbrain`, `inspect`), and allows keys to be imported without actually ever being decrypted (`importwithaddress`) and conversion between ICAP and hex (`inspectbare`). 295 | 296 | Options allow you to alter transactions before you sign them and even create transactions from scratch. You can also configure the method by which keys are encrypted, changing the encryption function or its parameters. 297 | 298 | See `ethkey --help` for more information. Enjoy! 299 | 300 | -------------------------------------------------------------------------------- /getting_started.md: -------------------------------------------------------------------------------- 1 | # eth: The Command-Line Interface Client 2 | 3 | **Note: This chapter is for getting started with the command-line client `eth`. If you are interested only in AlethZero, move on to the next chapter.** 4 | 5 | `eth` or **++eth** as it is sometimes referred to, is the TurboEthereum CLI client. To use it, you should open a terminal on your system. `eth` normally just runs in the background. If you want an interactive console (you do!), it has an option: `console` (it has two others - `import` and `export`. We'll get to those later. So now, start `eth`: 6 | 7 | ``` 8 | eth console 9 | ``` 10 | 11 | You'll see a little bit of information: 12 | 13 | ``` 14 | (++)Ethereum 15 | Beware. You're entering the Frontier! 16 | 16:13:52| Id: ##59650f8a… 17 | 16:13:58| Opened blockchain DB. Latest: #d4e56740… (rebuild not needed) 18 | 16:13:58| Opened state DB. 19 | ``` 20 | 21 | ## Using the Testnet 22 | 23 | There are two Ethereum "networks": the *mainnet* (the current version of which is called "Frontier") and the *testnet* (currently called "Morden"). They're independent of each other. The only difference between the two is that ether is essentially gratis on the testnet. By default, you'll connect to the mainnet. If you want to connect to the Morden testnet instead, start `eth` with the `--testnet` option instead: 24 | 25 | ``` 26 | eth console --testnet 27 | ``` 28 | 29 | ## Setting your Master Password 30 | 31 | After this information, the first thing it will do is ask you for a master password. 32 | 33 | ``` 34 | Please enter a MASTER password to protect your key store (make it strong!): 35 | ``` 36 | 37 | The master password is a password that protects your privacy and acts as a default security measure for your various Ethereum identities. Even with access to your computer nobody can work out who your online Ethereum addresses are without this password. It's also a default security password for your other keys, if you don't want to be remembering too many password. Anyway, it's the first line of defence and aught to be strong. 38 | 39 | Enter a password, preferably taking into account [sage advice on password creation](https://xkcd.com/936/). Then when it asks for a confirmation... 40 | 41 | ``` 42 | Please confirm the password by entering it again: 43 | ``` 44 | 45 | ...enter it again. 46 | 47 | It will pause shortly while it figures out your network environment and starts it all up. After a little while, you'll see some information on the software as well as on the account it created for you. 48 | 49 | ## Your First Account 50 | 51 | This is your newly created default account (or 'identity'. I use the words interchangeably). In my case, it was the account that begins with `XE712F44`. This is an *ICAP code*, similar to an IBAN code that you might have used when doing banking transfers. You and only you have the special *secret key* for this account. It's guarded by the password you just typed. Don't ever tell anyone your password or they'll be able to send ether from this account and use it for nefarious means. 52 | 53 | ``` 54 | Transaction Signer: XE712F44QOZBKNLD20DLAEE8O2YJ7XRGP4 (be5af9b0-9917-b9bc-8f95-65cb9f042052 - 0093503f) 55 | Mining Beneficiary: XE712F44QOZBKNLD20DLAEE8O2YJ7XRGP4 (be5af9b0-9917-b9bc-8f95-65cb9f042052 - 0093503f) 56 | ``` 57 | 58 | `eth` is nice. It tells you that any transactions you do will come from your account beginning with `XE712F44`. Similarly by default, if you mine successfully with the inbuilt miner, the proceeds will go into the same account. 59 | 60 | You'll notice that there are two other codes in parentheses. The first is the *UUID* of the key. This is a code, only used on your computer, which allows us to identify which file the key is stored in without giving any any information of what account the key is for. In this case, the UUID begins with `be5af9b0`. 61 | 62 | The second piece of information that is parenthesised is the first few digits of the hex key. Older clients and Ethereum software depend on this to identify accounts. We don't use it any more because it's longer and doesn't have any way of determining if an address is invalid, so errors with mistyping can easily have major consequences. 63 | 64 | Let's check that you do indeed have the key file for this account! 65 | 66 | ### Find that Key! 67 | 68 | If you're using Linux or MacOS, open another terminal and navigate to `~/.web3/keys`. This is where all of your keys are stored. Enter `ls` and make sure there's a file that corresponds to the account's UUID. 69 | 70 | For Windows users, just use Explorer to navigate into your home folder's AppData/Web3/keys directory (you might need to enable Show Hidden Files to get there). 71 | 72 | If you don't find a file with the same name as the UUID, then something is terribly wrong (out of disk space, possibly)! Get yourself on the forums and ask before going any further. 73 | 74 | ## Syncing up 75 | 76 | You'll now start seeing a little bit of information as it tries to connect to the network. You might see a line like: 77 | 78 | ``` 79 | 18:25:31|p2p Hello: ++eth-v0.9.40-727666c2/EthDEV Server Frontier//RelWithDebInfo-Linux/g++/JIT V[ 4 ] ##979b7fa2… (eth,61) 30303 80 | ``` 81 | 82 | This is it telling you that it's managed to contact another node. After a little while it will begin to synchronise to the network. This will probably give you an awful lot of messages. If there are too many for you to handle, reduce them by changing the verbosity. We can set the verbosity to zero (the lowest and quietest) by typing: 83 | 84 | ``` 85 | web3.admin.setVerbosity(0) 86 | ``` 87 | 88 | It'll reply `true` to tell you that all is fine: 89 | 90 | ``` 91 | > web3.admin.setVerbosity(0) 92 | true 93 | ``` 94 | 95 | As it synchronises, the latest block number will constantly rise, usually rather fast. Once it is synchronised, it'll still rise but much more slowly - at around 1 block every 15 seconds. 96 | 97 | You can check its progress by using the console to get the latest block number. To do this, type: 98 | 99 | ``` 100 | web3.eth.blockNumber 101 | ``` 102 | 103 | You'll end up with something like: 104 | 105 | ``` 106 | > web3.eth.blockNumber 107 | 11254 108 | ``` 109 | 110 | ## Got ETH? 111 | 112 | You can easily check to see if you have ether in your account using the `eth.getBalance` function of `web3`. For this to work you'll need the address of which to get the balance. In my case, the address is the aforementioned `XE712F44QOZBKNLD20DLAEE8O2YJ7XRGP4`: 113 | 114 | ``` 115 | > web3.eth.getBalance("XE712F44QOZBKNLD20DLAEE8O2YJ7XRGP4") 116 | 0 117 | ``` 118 | 119 | That's not much, but then it is after all a newly cerated account. Let's query the balance of an account that actually has some funds, the Ethereum Foundation wallet: 120 | 121 | ``` 122 | > web3.eth.getBalance("XE86PXQKKKORDZQ1RWT9LGUGYZ1U57A56Y2") 123 | 11901464239480000000000000 124 | ``` 125 | 126 | Ooh, rather a lot more. The answer is given in Wei, the lowest denomination of ether. To work out what this is in sensible terms, use `web3.fromWei` and provide a sensible unit, e.g. `grand` (a grand, for those unfamiliar with English slang, is one thousand Ether): 127 | 128 | ``` 129 | > web3.fromWei(web3.eth.getBalance("de0b295669a9fd93d5f28d9ec85e40f4cb697bae"), 'grand') 130 | 11901.46423948 131 | ``` 132 | 133 | Wow that's nearly 12 million ether. 134 | 135 | 136 | ## And Finally... 137 | 138 | Aside from the full power of Javascript, there are loads of functions you can use in the console; to see them just type `web3`. 139 | 140 | When you're done playing, simply type `web3.admin.exit()` to exit `eth`. 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /interactive_console.md: -------------------------------------------------------------------------------- 1 | # eth Interactive Console 2 | 3 | In order to interact with the client you have two options. If you have no client running, you can start one and provide the `-i` argument, which will start a client with the interactive console. Alternatively, if you already have a client running, and you started it with the `-j` flag, you can just run `ethconsole`, which will give you exactly the same environment without running a second client. 4 | 5 | The interactive console is a javascript console which contains a subset of the [JSON-RPC api](https://github.com/ethereum/wiki/wiki/JSON-RPC) plus some administration functions. To see all available functions type `web3` in the console prompt and press enter. For only the administrative functions type `web3.admin`. 6 | 7 | - [Network connectivity](interactive_console.md#network-connectivity) 8 | - [Mining](interactive_console.md#mining) 9 | - [Miscellaneous administration](interactive_console.md#miscellaneous-administration) 10 | 11 | ##Network connectivity 12 | 13 | ### Querying network information 14 | 15 | To figure out if you have any peers and if you are properly connected to the network you can type `web3.net`. This will conveniently provide something like: 16 | 17 | ``` 18 | > web3.net 19 | { 20 | listening: true, 21 | getListening: [Function], 22 | peerCount: 2, 23 | getPeerCount: [Function] 24 | } 25 | ``` 26 | 27 | To query any individual value you can just call it. For example: 28 | ``` 29 | > web3.net.peerCount 30 | 2 31 | ``` 32 | 33 | ### Interacting with the network 34 | 35 | If you would like to interact with the network you can use the network admin functions. You can query them with `web3.admin.net`. 36 | 37 | ``` 38 | > web3.admin.net 39 | { 40 | start: [Function], 41 | stop: [Function], 42 | connect: [Function], 43 | peers: [Function], 44 | nodeInfo: [Function] 45 | } 46 | ``` 47 | 48 | ##### Starting the network 49 | 50 | If the client is not connected to the network you can start listening with `web3.admin.net.start()` 51 | 52 | 53 | ``` 54 | > web3.net.listening 55 | false 56 | > web3.admin.net.start() 57 | ⚡ 12:52:24|p2p Worker stopping 17126 ms 58 | ⚡ 12:52:24|ethsync Worker stopping 17146 ms 59 | ℹ 12:52:24|p2p UPnP device not found. 60 | > true 61 | > web3.net.listening 62 | true 63 | ``` 64 | 65 | #### Stopping the network 66 | 67 | In the same spirit you can stop listening with `web3.admin.net.stop()` 68 | 69 | 70 | ``` 71 | > web3.net.listening 72 | true 73 | > web3.admin.net.stop() 74 | true 75 | > web3.net.listening 76 | false 77 | > 78 | ``` 79 | 80 | #### Getting a list of peers 81 | 82 | If you would like to obtain a list with information on the peers you are connected to you can use `web3.admin.net.peers()`. 83 | 84 | ``` 85 | > web3.admin.net.peers() 86 | [{ 87 | caps: { 88 | eth: 61 89 | }, 90 | clientVersion: 'Geth/v1.0.2-4591ae56/linux/go1.4.2', 91 | host: '52.16.188.185', 92 | id: 'a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c', 93 | lastPing: 41, 94 | notes: { 95 | ask: 'nothing', 96 | manners: 'nice', 97 | sync: 'ongoing' 98 | }, 99 | port: 0 100 | }, { 101 | caps: { 102 | eth: 61 103 | }, 104 | clientVersion: '++eth-v0.9.40-a1e4483e/Gav's Node//RelWithDebInfo-Linux/g++/int', 105 | host: '92.51.165.126', 106 | id: '5374c1bff8df923d3706357eeb4983cd29a63be40a269aaa2296ee5f3b2119a8978c0ed68b8f6fc84aad0df18790417daadf91a4bfbb786a16c9b0a199fa254a', 107 | lastPing: 18, 108 | notes: { 109 | ask: 'nothing', 110 | manners: 'nice', 111 | sync: 'holding' 112 | }, 113 | port: 30300 114 | }] 115 | > 116 | ``` 117 | 118 | #### Getting your node information 119 | 120 | To obtain your node ID along with other information acout your node's address in the network then use `web3.admin.net.nodeInfo()` 121 | 122 | 123 | ``` 124 | > web3.admin.net.nodeInfo() 125 | { 126 | address: '209.131.41.48', 127 | enode: 'enode://5bf4613faca50a0ff181915b2d8e5f0a87c82ed5a57dabc9812937bdacb167cf1420652930143a743d6238e0279bd91862c72f9d1d0cbb73b86c4ca1cf966432@209.131.41.48:30303', 128 | id: '5bf4613faca50a0ff181915b2d8e5f0a87c82ed5a57dabc9812937bdacb167cf1420652930143a743d6238e0279bd91862c72f9d1d0cbb73b86c4ca1cf966432', 129 | listenAddr: '209.131.41.48:30303', 130 | name: '++eth-v0.9.41-cb61d09d/Lefteris'\ node//RelWithDebInfo-Linux/g++/int', 131 | port: 30303 132 | } 133 | ``` 134 | 135 | #### Connecting to other nodes 136 | 137 | Sometimes, peer discovery may not work properly, or you may want to connect to a particular node in the network. In those cases you can use the `web3.admin.net.connect()` function to manually connect to a peer. 138 | 139 | 140 | ``` 141 | > web3.admin.net.connect("5.1.83.226:30303") 142 | true 143 | ``` 144 | 145 | 146 | If the above was succesfull we can see our new peer in the list: 147 | 148 | ``` 149 | > web3.admin.net.peers() 150 | [{ 151 | caps: { 152 | eth: 61 153 | }, 154 | clientVersion: '++eth-v0.9.40-7faadaf4/EthDEV Frontier//RelWithDebInfo-Linux/g++/JIT', 155 | host: '5.1.83.226', 156 | id: '979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9', 157 | lastPing: 31, 158 | notes: { 159 | ask: 'nothing', 160 | manners: 'nice', 161 | sync: 'holding' 162 | }, 163 | port: 30303 164 | }, { 165 | caps: { 166 | eth: 61 167 | }, 168 | clientVersion: 'Geth/v1.0.2-4591ae56/linux/go1.4.2', 169 | host: '52.16.188.185', 170 | id: 'a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c', 171 | lastPing: 41, 172 | notes: { 173 | ask: 'nothing', 174 | manners: 'nice', 175 | sync: 'ongoing' 176 | }, 177 | port: 0 178 | }, { 179 | caps: { 180 | eth: 61 181 | }, 182 | clientVersion: '++eth-v0.9.40-a1e4483e/Gav's Node//RelWithDebInfo-Linux/g++/int', 183 | host: '92.51.165.126', 184 | id: '5374c1bff8df923d3706357eeb4983cd29a63be40a269aaa2296ee5f3b2119a8978c0ed68b8f6fc84aad0df18790417daadf91a4bfbb786a16c9b0a199fa254a', 185 | lastPing: 17, 186 | notes: { 187 | ask: 'nothing', 188 | manners: 'nice', 189 | sync: 'ongoing' 190 | }, 191 | port: 30300 192 | }] 193 | ``` 194 | 195 | ## Mining 196 | 197 | You can also start and stop mining using the interactive console. To start mining use `web3.admin.eth.setMining(true)` 198 | 199 | ``` 200 | > web3.admin.eth.setMining(true) 201 | ℹ 13:48:01|miner0 Loading full DAG of seedhash: #b903bd76… 202 | > web3.admin.eth.setMining(ttrue 203 | DAG 13:48:01|miner0 Generating DAG file. Progress: 0 % 204 | DAG 13:48:04|miner0 Generating DAG file. Progress: 1 % 205 | DAG 13:48:07|miner0 Generating DAG file. Progress: 2 % 206 | ⚡ 13:48:08|eth Stop worker 249 ms 207 | ⚡ 13:48:09|eth Stop worker 479 ms 208 | ⚡ 13:48:09|eth pause 480 ms 209 | ⚡ 13:48:09|eth Stop worker 480 ms 210 | ⚡ 13:48:09|eth pause 480 ms 211 | 212 | ``` 213 | 214 | Then again to stop mining simply invoke `web3.admin.eth.setMining(false)` 215 | 216 | ## Miscellaneous administration 217 | 218 | #### Exiting the client 219 | 220 | You can exit the client with a `Ctrl-C` signal but you can also use `web3.admin.exit()` 221 | 222 | ``` 223 | > web3.admin.exit() 224 | true 225 | ⚡ 13:36:50|eth Stop worker 510 ms 226 | ℹ 13:36:50|eth Closing blockchain DB 227 | ℹ 13:36:50|eth Closing state DB 228 | ⚡ 13:36:50|ethsync Worker stopping 582 ms 229 | ⚡ 13:36:50|p2p Worker stopping 581 ms 230 | lefteris@archlenovo ~/ew/cpp-ethereum$ 231 | ``` 232 | 233 | #### Changing the log verbosity 234 | 235 | If you would like to see more log messages you can change the log verbosity by `web3.admin.setVerbosity()`. This function takes a numeric argument from 0 to 99. 236 | 237 | ``` 238 | > web3.admin.setVerbosity(4) 239 | true 240 | ⧎ ◌ 13:40:21|p2p|17417d7b…|Geth/v1.0.1-99216f4a/linux/go1.4.2 GetBlockHashesByNumber ( 119085 - 119596 ) 241 | ⧎ ◌ 13:40:21|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116890 - 116890 ) 242 | ⧎ ◌ 13:40:21|p2p|17417d7b…|Geth/v1.0.1-99216f4a/linux/go1.4.2 GetBlocks ( 16 entries) 243 | ⧎ ◌ 13:40:21|p2p|17417d7b…|Geth/v1.0.1-99216f4a/linux/go1.4.2 16 blocks known and returned; 0 blocks unknown; 0 blocks ignored 244 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116430 - 116430 ) 245 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116660 - 116660 ) 246 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116545 - 116545 ) 247 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116487 - 116487 ) 248 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116516 - 116516 ) 249 | ⧎ ◌ 13:40:22|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116530 - 116530 ) 250 | ⧎ ◌ 13:40:23|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116523 - 116523 ) 251 | ⧎ ◌ 13:40:23|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116526 - 116526 ) 252 | ⧎ ◌ 13:40:23|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116524 - 116524 ) 253 | ⧎ ◌ 13:40:23|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116525 - 116525 ) 254 | ⧎ ◌ 13:40:23|p2p|0c88df87…|Geth/Siberia19/v1.0.2-9fb7bc74/linux/go1.4.2 GetBlockHashesByNumber ( 116525 - 117036 ) 255 | ⧎ ◌ 13:40:23|p2p Hello: Geth/v1.0.1/linux/go1.4.2 V[ 4 ] ##55581d43… (eth,61) 0 256 | ⧎ ◌ 13:40:23|p2p|55581d43…|Geth/v1.0.1/linux/go1.4.2 Status: 61 / 1 / #95e83250… , TD: 582573549 = #a4f70ef1… 257 | ⧎ ◌ 13:40:23|p2p|55581d43…|Geth/v1.0.1/linux/go1.4.2 Disconnect (reason: Unknown reason. ) 258 | ⧎ ◌ 13:40:23|p2p|55581d43…|Geth/v1.0.1/linux/go1.4.2 Closing peer session :-( 259 | ``` 260 | 261 | For a healthy logging level use the value of 1. 262 | -------------------------------------------------------------------------------- /javascript_console.md: -------------------------------------------------------------------------------- 1 | # JavaScript console 2 | 3 | Mix exposes the following objects into the global window context 4 | 5 | web3 - Ethereum JavaScript API 6 | 7 | contracts: A collection of contract objects. A key to the collection is the contract name. A value is an object with the following properties: 8 | 9 | contract: contract object instance (created as in web3.eth.contract) 10 | 11 | address: contract address from the last deployed state (see below) 12 | 13 | interface: contract ABI 14 | 15 | Check the JavaScript API Reference for further information. 16 | 17 | ###Using the JS console to add transactions and local calls 18 | 19 | In case the name of the contract is "Sample" with a function named "set", it is possible to make a transaction to call "set" by writing: 20 | 21 | contracts["Sample"].contract.set(14) 22 | 23 | If a call can be made this will be done by writing: 24 | 25 | contracts["Sample"].contract.get.call() 26 | 27 | 28 | It is also possible to use all properties and functions of the web3 object: 29 | https://github.com/ethereum/wiki/wiki/JavaScript-API 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mining.md: -------------------------------------------------------------------------------- 1 | # Mining on Ethereum 2 | 3 | Mining is a common term for securing the Ethereum network and validating new transactions in exchange for a small payment. Anyone can mine, though it really helps if you can a good GPU. How often you are paid out depends on who else is mining and how much mining power (read: computation power) your hardware has. 4 | 5 | We use a custom-made algorithm named Ethash, a combination of the Hashimoto and Dagger algorithms, designed by Tim Hughes, Vitalik Buterin and Matthew Wampler-Doty. It is memory-bandwidth-hard making is an excellent candidate for GPU mining but a bad candidate for custom hardware. We plan on switching to a proof-of-stake algorithm inover the course of the next 9 months with the Serenity release of Ethereum. 6 | 7 | Because the algorithm is memory hard, you'll need 2GB of RAM per GPU with which you wish to mine, at least for the forseeable future. (The dataset starts at 1GB and grows every few days, so you might be able to get away with 1.5GB for the first few months, if such graphics cards exist.) 8 | 9 | ASICs and FPGAs is be strongly discouraged by being rendered financially inefficient, which was confirmed in an independent audit. Don't expect to see them on the market, and if you do, proceed with extreme caution. 10 | 11 | ## Setting things up on Linux 12 | 13 | For this quick guide, you'll need Ubuntu 14.04 or 15.04 and the fglrx graphics drivers. You an use NVidia drivers and other platforms, too, but you'll have to find your own way to getting a working OpenCL install with them. 14 | 15 | If you're on 15.04, Go to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx". Once the drivers are installed and in use, you're all set, go to the next section! 16 | 17 | If you're on 14.04, go to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx". Unfortunately, for some of you this will not work due to a known bug in Ubuntu 14.04.02 preventing you from switching to the proprietary graphics drivers required to GPU mine. 18 | 19 | So, if you encounter this bug, and before you do anything else, go to "Software and updates > Updates" and select "Pre-released updates trusty proposed". Then, go back to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx"). Reboot. 20 | 21 | Once rebooted, it's well worth having a check that the drivers have now indeed been installed correctly. 22 | 23 | Whatever you do, if you are on 14.04.02 do not alter the drivers or the drivers configuration once set. For example, the usage of `aticonfig --initial` can and likely will 'break' your setup. If you accidentally alter their configuration, you'll need to de-install the drivers, reboot, reinstall the drivers and reboot. 24 | 25 | # Mining with eth 26 | 27 | Mining on Ethereum with `eth` is simple. If you need to mine with a single GPU then, just running` eth` will be sufficient. If not you can use a combination of `eth` and `ethminer`. This works on all platforms, though Linux is usually the easiest to set up. 28 | 29 | ## Mining on a single GPU 30 | 31 | In order to mine on a single GPU all that needs to be done is to run `eth` with the following arguments: 32 | 33 | ``` 34 | eth -i -v 1 -a 0xcadb3223d4eebcaa7b40ec5722967ced01cfc8f2 --client-name "OPTIONALNAMEHERE" -x 50 -m on -G 35 | ``` 36 | 37 | - `-i` Requests an interactive javascript console so that we can interact with the client 38 | - `-v 1` Set verbosity to 1. Let's not get spammed by messages. 39 | - `-a YOURWALLETADDRESS` Set the coinbase, where the mining rewards will go to. The above address is just an example. This argument is really important, make sure to not make a mistake in your wallet address or you will receive no ether payout. 40 | - `--client-name "OPTIONAL"` Set an optional client name to identify you on the network 41 | - `-x 50` Request a high amount of peers. Helps with finding peers in the beginning. 42 | - `-m on` Actually launch with mining on. 43 | - `-G` set GPU mining on. 44 | 45 | While the client is running you can interact with it using the [interactive console](interactive_console.md). 46 | 47 | ## Mining on multiple GPUs 48 | 49 | Mining with multiple GPUs and `eth` is very similar to mining with [geth and multiple GPUs](http://ethereum.gitbooks.io/frontier-guide/content/gpu.html#gpu-mining-with-ethminer). 50 | 51 | 1. Ensure that an eth++ node is running with your coinbase address properly set: 52 | ``` 53 | eth -i -v 1 -a 0xcadb3223d4eebcaa7b40ec5722967ced01cfc8f2 --client-name "OPTIONALNAMEHERE" -x 50 -j 54 | ``` 55 | Notice that we also added the `-j` argument so that the client can have the JSON-RPC server enabled to communicate with the ethminer instances. Additionally we removed the mining related arguments since `ethminer` will now do the mining for us. 56 | 57 | 2. For each of your GPUs execute a different ethminer instance: 58 | ``` 59 | ethminer --no-precompute -G --opencl-device XX 60 | ``` 61 | Where `XX` is an index number corresponding to the openCL device you want the ethminer to use. 62 | 63 | In order to easily get a list of OpenCL devices you can execute `ethminer --list-devices` which will 64 | provide a list of all devices OpenCL can detect, with also some additional information per device. Below is a sample output: 65 | ``` 66 | [0] GeForce GTX 770 67 | CL_DEVICE_TYPE: GPU 68 | CL_DEVICE_GLOBAL_MEM_SIZE: 4286345216 69 | CL_DEVICE_MAX_MEM_ALLOC_SIZE: 1071586304 70 | CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024 71 | 72 | ``` 73 | Finally the `--no-precompute` argument requests that the ethminers don't create the [DAG](https://github.com/ethereum/wiki/wiki/Ethash-DAG) of the next epoch ahead of time. 74 | 75 | ## Benchmarking 76 | 77 | Mining power tends to scale with memory bandwidth. Our implementation is written in OpenCL, which is typically supported better by AMD GPUs over NVidia. Empirical evidence confirms that AMD GPUs offer a better mining performance in terms of price than their NVidia counterparts. R9 290x appears to be the best card at present. 78 | 79 | To benchmark a single-device setup you can use `ethminer` in benchmarking mode through the `-M` option: 80 | 81 | ``` 82 | ethminer -G -M 83 | ``` 84 | 85 | If you have many devices and you'll like to benchmark each individually, you can use the `--opencl-device` option similarly to the previous section: 86 | 87 | ``` 88 | ethminer -G -M --opencl-device XX 89 | ``` 90 | Use `ethminer --list-devices` to list possible numbers to substitute for the `XX`. 91 | -------------------------------------------------------------------------------- /mix.md: -------------------------------------------------------------------------------- 1 | # Mix 2 | 3 | The IDE Mix is intended to help you as a developer to create, debug and deploy contracts and dapps (both contracts backend and frontend). 4 | 5 | Start by creating a new project that consists of 6 | * contracts 7 | * html files 8 | * JavaScript files 9 | * style files 10 | * image files 11 | 12 | -------------------------------------------------------------------------------- /mix_bc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/guide/10ec02f43966effec6980965640e741e877f6fe7/mix_bc.png -------------------------------------------------------------------------------- /poa.md: -------------------------------------------------------------------------------- 1 | # PoA Private Chains 2 | 3 | **NOTE: This chapter is work in progress.** 4 | 5 | TurboEthereum supports Proof-of-Authority (PoA) private chains through the Fluidity core ethereum client `flu`. Proof-of-authority chains utilise a number of secret keys (authorities) to collaborate and create the longest chain instead of the public Ethereum network's proof-of-work scheme (Ethash). 6 | 7 | `flu` is configured through a JSON-format file which specifies all of the various settings concerning the blockchain. Here is an example JSON file: 8 | 9 | ``` 10 | { 11 | "sealEngine": "BasicAuthority", 12 | "options": { 13 | "authorities": [ 14 | "0xfa0c706a1410c8785baa7498325cf7461b325583", 15 | "0x7766d151b2c63cb096f624daa091ccb27a2c693f" 16 | ] 17 | }, 18 | "params": { 19 | "accountStartNonce": "0x", 20 | "maximumExtraDataSize": "0x1000000", 21 | "blockReward": "0x", 22 | "registrar": "", 23 | "networkID" : "0x45" 24 | }, 25 | "genesis": { 26 | "author": "0x0000000000000000000000000000000000000000", 27 | "timestamp": "0x00", 28 | "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", 29 | "extraData": "0x", 30 | "gasLimit": "0x1000000000000" 31 | }, 32 | "accounts": { 33 | "0000000000000000000000000000000000000001": { "wei": "1", "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } }, 34 | "0000000000000000000000000000000000000002": { "wei": "1", "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } } }, 35 | "0000000000000000000000000000000000000003": { "wei": "1", "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } }, 36 | "0000000000000000000000000000000000000004": { "wei": "1", "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } } } 37 | }, 38 | "network": { 39 | "nodes": [ 40 | "enode://f12709ce6a10fdc76cea6129c6e85e44225d4539ac1e5b26d2cb73f436b9f34c2a1a623ea14a39893b10df2cdc4560e16f9db0aada9ac06b20bc4c5e5dd894c8@127.0.0.1:40401", 41 | "enode://9bd11ae2cdbdd670dcbd34fa04ff71d840a9fb658d166f4d58192ec8f3d23c07cda490e717d7707e37a4e193ee6cdc8d1ee45320badf3b5476d7a356e6ff9de5@127.0.0.1:40402" 42 | ] 43 | } 44 | } 45 | ``` 46 | 47 | Breaking it down: 48 | 49 | ``` 50 | "sealEngine": "BasicAuthority", 51 | ``` 52 | 53 | This states that the seal engine of the chain which we wish to use is the `BasicAuthority` seal engine; this creates a proof-of-authority chain (rather than the Ethash proof-of-work chain on the public network). 54 | 55 | ``` 56 | "options": { 57 | "authorities": [ 58 | "0xfa0c706a1410c8785baa7498325cf7461b325583", 59 | "0x7766d151b2c63cb096f624daa091ccb27a2c693f" 60 | ] 61 | }, 62 | ``` 63 | 64 | This provides a number of options for our `BasicAuthority` seal engine. In this case, we provide the Ethereum addresses of the two accounts which are authorised to sign a new block. 65 | 66 | Make sure you own one of these or you'll find it very difficult to append new blocks. 67 | 68 | ``` 69 | "params": { 70 | "accountStartNonce": "0x", 71 | "maximumExtraDataSize": "0x1000000", 72 | "blockReward": "0x", 73 | "registrar": "", 74 | "networkID" : "0x45" 75 | }, 76 | "genesis": { 77 | "author": "0x0000000000000000000000000000000000000000", 78 | "timestamp": "0x00", 79 | "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", 80 | "extraData": "0x", 81 | "gasLimit": "0x1000000000000" 82 | }, 83 | ``` 84 | 85 | This provides additional parameters for the chain's consensus logic. (The difference between parameters and options is too subtle for this guide.) In this case, we're setting allowing a generous gas limit and extra-data field size and otherwise making everything zero. This is fine for most private chains. 86 | 87 | ``` 88 | "accounts": { 89 | "0000000000000000000000000000000000000001": { "wei": "1", "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } }, 90 | "0000000000000000000000000000000000000002": { "wei": "1", "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } } }, 91 | "0000000000000000000000000000000000000003": { "wei": "1", "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } }, 92 | "0000000000000000000000000000000000000004": { "wei": "1", "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } } } 93 | }, 94 | ``` 95 | 96 | This defines any accounts that are pre-specified in the genesis block. You can specify the balance, nonce, code and storage of each of the accounts. You can also use the powerful precompiled contract system to place precompiled contracts in each of the accounts together with gas-cost rules. 97 | 98 | In this case we're placing a token value in each of the pre-compiled contracts accounts, standard practice to avoid the first transactor getting stung for using them. We're also setting them up similarly to the public network, with each of the four algorithms in the first four slots together with the gas costs from the public network. 99 | 100 | Further precompiled contract algorithms can be added through creating and linking a library using the macro `ETH_REGISTER_PRECOMPILED`. For example, to create an algorithm which placed a simple byte-wise XOR checksum of the input into the output: 101 | 102 | ``` 103 | ETH_REGISTER_PRECOMPILED(xorchecksum)(bytesConstRef _in, bytesRef _out) 104 | { 105 | // No point doing any computation if there's nowhere to place the result. 106 | if (_out.size() >= 1) 107 | { 108 | // XOR every byte in the input together into the accumulator acc. 109 | byte acc = 0; 110 | for (unsigned i = 0; i < _in.size(); ++i) 111 | acc ^= _in[i]; 112 | // Place the result into the output. 113 | _out[0] = acc; 114 | } 115 | } 116 | ``` 117 | 118 | With this defined, you would be at liberty to name a contract precompiled with: 119 | 120 | ``` 121 | "precompiled": { 122 | "name": "xorchecksum", 123 | "linear": { "base": 1, "word": 1 } 124 | } 125 | ``` 126 | 127 | You can select the costs (1 gas plus 1 gas for each 32-byte word in the input) as you choose. 128 | 129 | 130 | ``` 131 | "network": { 132 | "nodes": [ 133 | "enode://f12709ce6a10fdc76cea6129c6e85e44225d4539ac1e5b26d2cb73f436b9f34c2a1a623ea14a39893b10df2cdc4560e16f9db0aada9ac06b20bc4c5e5dd894c8@127.0.0.1:40401", 134 | "enode://9bd11ae2cdbdd670dcbd34fa04ff71d840a9fb658d166f4d58192ec8f3d23c07cda490e717d7707e37a4e193ee6cdc8d1ee45320badf3b5476d7a356e6ff9de5@0.0.0.0:0" 135 | ] 136 | } 137 | ``` 138 | 139 | Finally we set up the network. In this case we define which node IDs are allowed to connect (and be connected to) and give some IPs/ports for them. Note even if the IPs/ports are not known, it is important that all node IDs on the private network are listed. Listing IDs with an invalid IP/port, as in the second entry, is fine. 140 | 141 | # Setting up a PoA Private Network 142 | 143 | To set up your PoA private network, first determine the network ID of each node which will be sitting on it. Author a JSON file similar to that above but with the `network.nodes` array populated with those IDs (with, wherever possible, the right IPs/ports as this will make bootstrapping easier). 144 | 145 | Finding the node ID is easy with `flu`: when it is run simply look out for a line beginning: 146 | 147 | ``` 148 | Node ID: enode://... 149 | ``` 150 | 151 | Determine, of those nodes, which will be able to sign new blocks. For each of them make sure you have at least one of the keys listed in your JSON file's `options.authorities` section. 152 | 153 | Running the `flu` client on a fresh machine (or with a fresh `--path` directory) will result in a keystore with a single, freshly generated, account key. 154 | 155 | You can find out what it is by looking for a line beginning: 156 | 157 | ``` 158 | Created key: 0x... 159 | ``` 160 | 161 | The client (perhaps on later invocations) can use this account to sign blocks if it is included in the `options.authorities` list. 162 | 163 | You may author the rest of the JSON file as you choose, perhaps altering the `extraData` genesis field to customise the chain and avoid it being confused with other, older or newer chains. 164 | 165 | When ready, you can start one or more nodes with this file (let's assume it is called `myconfig.json` and that you've copied it into each machine's `~` path: 166 | 167 | ``` 168 | $ flu console --config ~/myconfig.json 169 | ``` 170 | 171 | The `console` specifies that we want to have a Javascript console for interacting with our node (omit it for non-interactive mode) and the `--config` specifies our JSON configuration file. 172 | 173 | To begin sealing, use `web3.admin.eth.setMining(true)` at the console. All of the rest of the JS API is available for you. 174 | 175 | There are a number of options to help you configure things to your particular situation: 176 | 177 | - `--path` Alter the path of the blockchain/state databases and the keys/secrets database. Defaults to `~/.fluidity`. 178 | - `--master` Specify the password which is used to encrypt/decrypt the keys database and the default secret. 179 | - `--client-name` Specify this particular node's name. 180 | - `--public-ip` Specify the public IP of this node (i.e. the one that we advertise). 181 | - `--listen-ip` Specify the IP that we are actually listening on (e.g. the local adaptor IP). 182 | - `--listen-port` Specify the port which we should listen on. 183 | - `--start-sealing` Start sealing blocks immediately. 184 | - `--jsonrpc` Enable JSON-RPC server on port 8545. 185 | - `--jsonrpc-port` Enable JSON-RPC server on the given port. 186 | - `--jsonrpc-cors-domain` Configure the JSON-RPC server's CORS domain. 187 | 188 | By enabling the JSON-RPC server you can use e.g. `ethconsole` to connect to and interact with the private chain. 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /project_editor.md: -------------------------------------------------------------------------------- 1 | # Project Editor 2 | 3 | You can use projects to manage the creation and testing of a dapp. The project will contain data related to both backend and frontend as well as the data related to your scenarios (blockchain interaction) for debugging and testing. The related files will be created and saved automatically in the project directory. 4 | 5 | ## Creating a new project 6 | 7 | The development of a dapp start with the creation of a new project. 8 | Create a new project in the “edit” menu. Enter the project name, e.g. "Ratings" and select a path for the project file. 9 | 10 | ## Editing backend contract file 11 | 12 | By default, a new project contains a contract “Contract” for backend development on the blockchain using the Solidity language and the “index.html” for the frontend. Check the Solidity tutorial for references. 13 | 14 | Edit the empty default contract “Contract”, e.g. 15 | 16 | ``` 17 | contract Rating { 18 | 19 | function setRating(bytes32 _key, uint256 _value) { 20 | 21 | ratings[_key] = _value; 22 | 23 | } 24 | mapping (bytes32 => uint256) public ratings; 25 | }``` 26 | 27 | Check the Solidity tutorial for help getting started with the solidity programming language. 28 | 29 | Save changes 30 | 31 | ### Editing frontend html files 32 | 33 | Select default index.html file and enter the following code 34 | ``` 35 | 36 | 37 | 38 | 51 | 52 | 53 |

Ratings

54 |
55 | Store: 56 | 57 | 58 | 59 |
60 |
61 | Query: 62 | 63 |
64 |
65 | 66 | 67 | ``` 68 | 69 | Then it is possible to add many contract files as well as many HTML, JavaScript, css files 70 | 71 | 72 | -------------------------------------------------------------------------------- /scenarios_editor.md: -------------------------------------------------------------------------------- 1 | # Scenarios Editor 2 | 3 | Scenarios can be used to test and debug contracts. 4 | 5 | A scenario is effectively a local blockchain where blocks can be mined without PoW – otherwise testing would be quite slow ;). 6 | 7 | A scenario consists of a sequence of transactions. Usually, a scenario would start with the contract creation scenarios of the dapp. In addition, further transactions can be added to test and debug the dapp. Scenarios can be modified, i.e. transactions can be removed. Note that a scenario needs to be rebuilt for modifications to become effective. Further testing can be done using local JS calls via the JS API. 8 | 9 | In case it’s not open, access the scenario and debugger pane by pressing F7 or Windows > Show right or the debug button in the upper right corner of the main window. 10 | 11 | ### Creating and setting up a new scenario 12 | 13 | When you launch Mix for the first time, an empty scenario, i.e. not containing any transactions, will be created. 14 | Add an account named “MyAccount” and set it’s initial balance to 1 ether. Click OK. 15 | Rename the scenario to “Deploy”. 16 | 17 | ###Modifying initial ether balance of an account 18 | 19 | Actually, we want to do a lot of tests 20 | Edit the Genesis block parameters and set your initial account balance to 1000 ether. 21 | Rebuild the scenario for the change to become effective. 22 | 23 | ###Rebuilding a scenario 24 | 25 | Each time a transaction is modified or an account added, the scenario has to be rebuilt for modifications to become effective. 26 | Note that if a scenario is rebuilt the web frontend (local storage) may also need to be reset (this is not done automatically be Mix). 27 | 28 | ###Creating a transaction 29 | Let’s get some ether sent to Bob. 30 | Create another account named “Bob” with zero ether balance. 31 | Create a new transaction in the scenario pane. Click “Add Tx…” and send 300 ether to Bob. 32 | Add a block. 33 | 34 | 35 | ###Altering and reusing scenarios 36 | Create a new scenario or start from a scenario with several transactions that you duplicate first 37 | 38 | Rename the scenario 39 | 40 | Modify scenario by specifying transactions that shall be removed 41 | 42 | Rebuild the scenario 43 | 44 | ###Display calls 45 | 46 | A contract call is a function invokation. This is not a transaction as a contract call cannot change the state. 47 | A contract call is not part of the blockchain but for practical and ux design reason, it is convenient to display calls at the same functional level as a transaction. The JS icon warn you that this is not a transaction but a call. 48 | To show/hide call, click on the menu Scenario -> Display calls. 49 | 50 | 51 | -------------------------------------------------------------------------------- /state_mix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/guide/10ec02f43966effec6980965640e741e877f6fe7/state_mix.png -------------------------------------------------------------------------------- /state_viewer.md: -------------------------------------------------------------------------------- 1 | # State Viewer 2 | 3 | This panel is located below the block chain panel, in the scenario view. 4 | Once the blockchain has been run, this panel shows the state of the blockchain. 5 | 6 | By state we mean all accounts balance (including contract and normal account), and the storage (global variable of all deployed contract). 7 | The content of this panel is not static, it depends on the selected transaction on the blockchain panel. 8 | The state shown here is the state resulting of the execution of the selected transaction. 9 | 10 | ![](state_mix.png) 11 | 12 | In that case, 2 contracts are deployed, the selected transaction (deployment of testCtr) is the last one. so the state view shows the storage of both TestCtr and BasicContract. 13 | -------------------------------------------------------------------------------- /styles/website.css: -------------------------------------------------------------------------------- 1 | /* CSS for website */ 2 | -------------------------------------------------------------------------------- /transaction_debugger.md: -------------------------------------------------------------------------------- 1 | # Transaction debugger 2 | 3 | Mix supports both Solidity and assembly level contract code debugging. You can toggle between the two modes to retrieve the relevant information you need. 4 | At any execution point the following information is available: 5 | 6 | VM stack – See Yellow Paper for VM instruction description 7 | 8 | Call stack – Grows when contract is calling into another contract. Double click a stack frame to view the machine state in that frame 9 | 10 | Storage – Storage data associated with the contract 11 | 12 | Memory – Machine memory allocated up to this execution point 13 | 14 | Call data – Transaction or call parameters 15 | 16 | ##Accessing the debug mode 17 | When transaction details are expanded, you can switch to the debugger view by clicking on the "Debug Transaction" button 18 | 19 | ##Toggling between debug modes and stepping through transactions 20 | This opens the Solidity debugging mode. Switch between Solidity and EVM debugging mode using the Menu button (Debug -> Show VM code) 21 | 22 | - Step through a transaction in solidity debugging mode 23 | 24 | - Step through a transaction in EVM debugging mode 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /transaction_explorer.md: -------------------------------------------------------------------------------- 1 | # Transaction Explorer 2 | 3 | Using the transaction pane 4 | 5 | The transaction pane enables you to explore transactions receipts, including 6 | 7 | Input parameters 8 | Return parameters 9 | As well as Event logs 10 | To display the transaction explorer, click on the down triangle icon which is on the right of each transaction, this will expand transaction details: 11 | 12 | ![](mix_bc.png) 13 | 14 | 15 | 16 | Then you can either copy the content of this transaction in the clipboard, Edit the current transaction (you will have to rerun the blockchain then), or debug the transaction. -------------------------------------------------------------------------------- /whisper.md: -------------------------------------------------------------------------------- 1 | # The Whisper Specific Commands 2 | 3 | Whisper is a hybrid DHT/point-to-point communications system. It allows for transient publication and subscription of messages using a novel topic-based routing system. It gives exceptional levels of privacy, and can be configured to provide a privacy/efficiency tradeoff per application. 4 | 5 | Here follows a few gotchas in the present whisper API on the `eth` interactive console. It will be updated shortly. 6 | 7 | Points to note: 8 | - All API for whisper is contained in the `web3.shh` object. Type it in the interactive console to get a list of all functions and variables provided. 9 | - Topic values are user-readable strings and as such should be given as plain text. E.g., topic `"zxcv"` in the console corresponds directly to the topic `"zxcv"`. 10 | - Payload should be in JSONRPC standard data representation (i.e. hexadecimal encoding). E.g., text `"zxcv"` must be represented as `"0x847a786376"`. This can be done through usage of the `web3.fromAscii` function. 11 | - The function `web3.shh.request()` returns the request object instead of sending it to the core (except for some complicated functions). E.g. `web3.shh.post.request({topcis: ["0xC0FFEE"]})` 12 | - When sending/posting a message, don't omit the `ttl` parameter, because default value is zero, and therefore the message will immediately expire, before being sent. 13 | - The functions `filter.get()` and `web3.shh.getMessages()` should return the same messages, but in a different format. 14 | 15 | ### Examples of usage 16 | 17 | ```javascript 18 | var f = web3.shh.filter({topics: ["qwerty"]}) 19 | f.get() 20 | web3.shh.getMessages("qwerty") 21 | web3.shh.post({topics: ["qwerty"], payload: "0x847a786376", ttl: "0x1E", workToProve: "0x9" }) 22 | ``` --------------------------------------------------------------------------------