.. _dapps: ******************************************************************************** Dapps ******************************************************************************** Dapp提供的服务,可以让用户和提供者直接交互(也可以说连接市场中的买家和卖家,文件存储服务中的存储者和拥有者),以太坊dapps通常通过提供基于HTML/JavaScript的网络应用程序,并通过JavaScript API与区块链进行通信,dapps通常都在区块链上存有自己的关联合约,这些合约实现了业务逻辑,并存储关键的一致性状态。请记住因为以太坊网络的计算是冗余的,所以通常花费的瓦斯量是远远高于私有链的,这也确保了去中心的应用开发者减少代码的计算量并尽量减少存储于区块链中的数据。 Dapp目录 ==================================== 以太坊的dapps被编集到如下的列表中,包含处于各个阶段的开发项目(概念、工作原型、运行中/已部署),如果你正在开发dapp,请考虑将在列表中加入你的入口: * `Ethercasts State of the Ðapps `_ 列表中提供的去中心化服务涵盖了金融,保险,预测市场,社交网络,分布式计算和存储,赌博,市场,物联网,治理,协作,开发和游戏等领域。 * `我们期待哪种类型的项目?`_ 将来,dapps很可能会被发布到dapps浏览器商店中。 Dapp浏览器 =========================== * `Mist `_ - 官方提供的图形界面dapp浏览器,由基金会开发,处于测试阶段,Mist作为钱包dapp也处于测试阶段 * `Status `_ - 移动版本以太坊浏览器 (测试阶段) * `MetaMask `_ - Aaron Kumavis Davis's in-browser GUI. `Epicenter Bitcoin interview on github `_ - supported by DEVgrants * `AlethZero `_ - C++ eth 图形界面客户端(终止)。 * `Supernova `_ - (终止). ******************************************************************************** 开发者工具 ******************************************************************************** Dapp开发需要了解Web3 Javascript API,JSON RPC API和Solidity编程语言。 .. note:: 有一系列可用的开发者工具罗列在下方,可以帮助你开发、测试、发布去中心化应用。 * `Web3 JavaScript API `__ - 当你想要和以太坊节点进行交互时,这个是最主要的JavaScript SDK。 * `JSON RPC API `__ - 这个是和节点交互的底层JSON RPC 2.0接口,它使用了Web3 JavaScript API。 * `Solidity Docs `__ - Solidity是以太坊开发智能合约的语言,被编译为以太坊虚拟机使用的字节码。 * `Solium `__ - 一个严格遵循官方 `Solidity风格规范 `__ 的语法检查器。 * :ref:`test-networks` - 一个帮助开发者开发、测试以太坊代码的网络,不需要花费主链上的真实以太币。 * :ref:`IDE-or-development-framework` - 协助你开发、调试、部署以太坊应用程序。 .. _IDE-or-development-framework: Dapp开发相关资源 ===================================================== * `Smart contracts ELI5 `_ * https://blog.slock.it/a-primer-to-the-decentralized-autonomous-organization-dao-69fb125bd3cd * `A 101 noob's intro to programming smart contracts `_ * `Standardised contract APIs listing `_ 示例 ---------------------- * `example use of pricefeed - web3 script printing all account balances `_ * `Example Ethereum contracts `_ https://dappsforbeginners.wordpress.com/tutorials/your-first-dapp/ https://github.com/ethereum/wiki/wiki/Dapp-Developer-Resources 教程 -------------- * `Dapp tutorials on ethereum.org `_ * `Dapps for beginners tutorial series `_ * `Eris' Solidity Tutorial Series `_ * `Tutorials on advanced Solidity `_ * http://ethereumj.io/blog/2015/09/09/friendly-ether-bot/ * https://github.com/ConsenSys/ether-pudding Mix图形界面IDE ================================================================================ Mix是官方出品的以太坊图形界面IDE,可以帮助开发者在以太坊区块链上开发、部署合约以及应用,它包含Solidity代码调试器(目前项目已经终止)。 集成开发环境和框架 ================================================================================ 下面是一些用来开发以太坊dapps的集成开发环境和框架。 * `Truffle `__ - Truffle is a development environment, testing framework and asset pipeline for Ethereum. * `Dapple `__ - Dapple is a tool for Solidity developers to help build and manage complex contract systems on Ethereum-like blockchains. * `Populus `__ - Populus is a Smart Contract development framework written in python. * `Eris-PM `__ - The Eris Package Manager deploys and tests smart contract systems on private and public chains. * `Embark `__ - Embark is a Ðapp development framework written in JavaScript. * `EtherScripter \(obsolete, discontinued\) `_ * `Resilience Raw Transaction Broadcaster `_ 以太坊命令行 ================================================================================ Command-line console for Ethereum nodes. `Ethconsole `_ connects to an Ethereum node running in the background (tested with eth and geth) via IPC and provides an interactive javascript console containing the web3 object with admin additions. Here you could find a list of available commands `ethereum node control commands `_ To use this console you would need to start a local ethereum node with ipc communication socket enabled (file ``geth.ipc`` in data directory). By default ipc socket should be located at you local home directory in .ethereum after you started a node. You could also set ``--test`` option to use specific node test commands. .. code:: Console > eth --test > ethconsole ipc://path/to/geth.ipc In the console you could then type .. code:: Console > web3.eth. (arguments, function(){}) Here the defenition of ``--test`` mode node commands: .. code:: Console > web3.test.addBlock("[RLP]", function(){}) - Add a block from a string containing its hex RLP > web3.test.rewindToBlock:("[int]", function(){}) - Reset the blockchain to specified block number > web3.test.mineBlocks:("[int]", function(){}) - Mine a certain amount of NoProof blocks into chain > web3.test.modifyTimestamp:("[int]", function(){}) - Set current block timestamp > web3.test.setChainParams:("[json]", function(){}) - Reset the blockchain with given node configuration file More information about node `configuration <../network/test-networks.html#custom-networks-eth>`_ file. 底层基础服务 ================================================= Whisper协议 -------------------------- .. * TODO - Add Whisper documentation here! .. `Whisper: the Multi DHT Messaging System with Routing Privacy. Vision & Roadmap.` - DEVCON-0 talk youtube video * `What is Whisper and what is it used for `_ - stackexchange Q&A * `Gavin Wood: Shh! Whisper `_ - DEVCON-1 talk youtube video * `Whisper overview and dream API usage `_ - * `ELI5 `_ Swarm服务 --------------------------- Swarm is a distributed storage platform and content distribution service, a native base layer service of the Ethereum web 3 stack. The primary objective of Swarm is to provide a sufficiently decentralized and redundant store of Ethereum's public record, in particular to store and distribute dapp code and data as well as block chain data. From an economic point of view, it allows participants to efficiently pool their storage and bandwidth resources in order to provide the aforementioned services to all participants. From the end user's perspective, Swarm is not that different from WWW, except that uploads are not to a specific server. The objective is to peer-to-peer storage and serving solution that is DDOS-resistant, zero-downtime, fault-tolerant and censorship-resistant as well as self-sustaining due to a built-in incentive system which uses peer to peer accounting and allows trading resources for payment. Swarm is designed to deeply integrate with the devp2p multiprotocol network layer of Ethereum as well as with the Ethereum blockchain for domain name resolution, service payments and content availability insurance. ÐΞVcon talks on swarm ^^^^^^^^^^^^^^^^^^^^^^^^^^ * `Viktor Trón, Daniel A. Nagy: Swarm `_ - Ethereum ÐΞVcon-1 talk on youtube * `Daniel A. Nagy: Keeping the Public Record Safe and Accessible `_ - Ethereum ÐΞVcon-0 talk on youtube Code and status ^^^^^^^^^^^^^^^^^^^^^^^^^^ * [source](https://github.com/ethereum/go-ethereum/tree/swarm) * [issues on github](https://github.com/ethereum/go-ethereum/labels/swarm) * [development roadmap]() * `ethersphere on twitter `_ * `swarm gitter room `_ * `swarm subreddit `_ Storage on and offchain * https://www.reddit.com/r/ethereum/comments/3hkv2f/eli5_storage_in_the_ethereum_blockchain/ * https://www.reddit.com/r/ethereum/comments/3npsoz/ethereum_ipfs_and_filecoin/ * `What is swarm and what is it used for? `_ - stackexchange Q&A Ethereum Alarm Clock -------------------------------------------------------------------------------- * **Author:** Piper Merriam * **Website:** `alarm_main_website`_. * **Documentation:** `alarm_documentation`_. A marketplace that facilitates scheduling transactions to occur at a later time. Serves a similar role to things like *crontab* in unix, or *setTimeout* in javascript. * `Decentralized cron service in Ethereum proposal `_ - by Peter Szilagyi Ethereum Computation Market -------------------------------------------------------------------------------- * **Author:** Piper Merriam * **Website:** `computation_market_main_website`_. * **Documentation:** `computation_market_documentation`_. A marketplace that facilitates verifiable execution of computations off-chain. Allows for very expernsive computations to be used within the EVM without having to actually pay the high gas costs of executing them on-chain. .. _alarm_main_website: http://www.ethereum-alarm-clock.com/ .. _alarm_documentation: http://docs.ethereum-alarm-clock.com/ .. _computation_market_main_website: http://www.ethereum-computation-market.com/ .. _computation_market_documentation: http://docs.ethereum-computation-market.com/ BTCRelay ------------------------------------------------- `BTCrelay `_ * `More information `_ (about ETH/BTC 2-way peg without modifying bitcoin code). * `BTCrelay audit `_ RANDAO ----------------------------------------- Random number * https://www.reddit.com/r/ethereum/comments/49yld7/eli5_how_does_a_service_like_szabodice_grab_a/ .. _the-EVM: 以太坊虚拟机 ================================================================================ The Ethereum Virtual Machine (EVM) is the runtime environment for smart contracts in Ethereum. It is not only sandboxed, but actually completely isolated, which means that code running inside the EVM has no access to network, filesystem, or other processes. Smart contracts even have limited access to other smart contracts. Contracts live on the blockchain in an Ethereum-specific binary format (EVM bytecode). However, contracts are typically written in an Ethereum high level language, compiled into byte code using an EVM compiler, and finally uploaded on the blockchain using an Ethereum client.