Curso Introducción a Ethereum para desarrolladores
1. Introducción
2. Clientes
- Arquitectura
- [Geth](#)
- Instalación
- Inicialización de parámetros
- Creación de una blockchain privada
- Comienzos con la blockchain pública
- testRPC
3. [Web3](web3.html)
3. [Solidity](solidity.html#2)
4. Ejemplos Smart Contracts
-Token
-DAO
-Crowdfunding
5. Ejercicio con Token
-
Clientes oficiales
-
Clientes no oficiales:
- Parity: Cliente escrito por ethcore
- Ethereumj: Cliente en Java
- Ruby-Ethereum: Cliente de Ruby -Etc..
Diferentes implementaciones puede dar lugar a problemas
- Cliente más popular
- Compatibilidad multiplaforma
- Linea de sub-comandos
- Un servidor en JSON-RPC
- Una consola integrada (Web3.js)
El cliente de Ethereum es válido tanto para la red principal (Main net), como para diferentes implementaciónes (Ropsten, Private chain...)
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install ethereum
Con solo esto, ya somos capaces de interactuar con Ethereum!
La ejecución de Geth admite numerosos "flags", algunos de los más importantes:
| Flag | Descripción | Por defecto |
|---|---|---|
--networkid |
Selecciona el id de blockchain sobre la que se ejecutará | 0 (main net) |
--rpc |
Permiso a la interfaz RPC | true |
--rpcapi |
APIs abiertas vía RPC | web3 |
--rpcport |
Puerto de acceso a RPC | 8545 |
--rpccorsdomain |
Dominios de acceso a RPC | localhost |
--port |
Puerto de conexión para otros nodos | 30303 |
{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0x8000000",
"difficulty": "0x400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
}
}$ geth init genesis.json$ geth --networkid 03032017 --rpccorsdomain "*" --datadir "/home/satoshi/chain" --port "30303" "db,eth,net,web3"
En otra terminal
$ geth attach$ geth
$ geth attach#TestRPC
- Incluso las blockchain privadas son demasiado lentas/ineficientes a la hora de desarrollar
- testRPC es una Librería en JS que simula un nodo completo de una blockchain privada, o una blockchain real a partir de determinado punto
- Para el desarrollo de aplicaciones del curso, se utilizará esta librería.
Ejemplo
$ testrpc#TestRPC
Options (From the Docs):
-aor--accounts: Specify the number of accounts to generate at startup.-bor--blocktime: Specify blocktime in seconds for automatic mining. Default is 0 and no auto-mining.-dor--deterministic: Generate deterministic addresses based on a pre-defined mnemonic.-mor--mnemonic: Use a specific HD wallet mnemonic to generate initial addresses.-por--port: Port number to listen on. Defaults to 8545.-hor--hostname: Hostname to listen on. Defaults to Node'sserver.listen()default.-sor--seed: Use arbitrary data to generate the HD wallet mnemonic to be used.-gor--gasPrice: Use a custom Gas Price (defaults to 20000000000)-lor--gasLimit: Use a custom Gas Limit (defaults to 0x47E7C4)-for--fork: Fork from another currently running Ethereum client at a given block. Input should be the HTTP location and port of the other client, e.g.http://localhost:8545. You can optionally specify the block to fork from using an@sign:http://localhost:8545@1599200.
#Ejemplo: Fork de blockchain para development
####Ejecutar:
$ geth --networkid.... Port, ? rcpport? $ testrpc -p 8545Links a las presentaciones:
- Introducción a Ethereum
- [Introducción a Web3] (http://buendiadas.github.io/web3.html)
- [Introducción a Solidity] (http://buendiadas.github.io/solidity.html)
