News.EOS.WiKi Bilingual News & Info Of EOS

去中心化应用使用的EOSIO Quickstart Web IDE/EOSIO Quickstart Web IDE for decentralized applications

译文/Translated:

EOSIO Quickstart Web IDE 让开发人员在数分钟内开始构建全堆栈EOSIO应用。

获得Gitpod.io以及Docker助力,它为开发人员提供个人单点EOSIO区块链,用以进行开发和测试,并且无需经过高级的本地环境设置。它也包括一项具备智能合约和网页前端的示例应用,该应用已经连接至区块链。开发人员还可以直接使用cleos以及eosio.cdt等EOSIO工具。该项目并不需要在用户设备上进行安装。所有代码都储存在开发人员个人的GitHub账户中,并在其间进行管理,出现的的任何更改将自行进行保存。

我们构建这一项目至始至终秉承着简单和简易的原则。新手开发人员可能用它进行尝试或学习EOSIO,同时它也适合高级开发人员和团队使用。它在使用者没有完全控制其工作系统的环境中尤其有用(例如大学、银行、政府机构等),也适用于计算机规格低于要求配置时在本地运行EOSIO。

我们希望这个项目能对您有用,同时欢迎您在为该项目的进一步改进提供宝贵意见。

设置

  1. 将库分叉到您的个人GitHub帐户,以便您可以将工作保存到个人的Github帐户中
  2. 将浏览器指向以下位置

URL https://gitpod.io/#https://github.com/your-github-account/eosio-web-ide以启动IDE。您将自动收到提示,创建一个Gitpod账户(所有类型的Gitpods账户都将有效,包括免费账户)。您还可以选择提供多个开发人员推送访问库的个人github分支的权限以与他们进行协作(一个开发人员在处理智能合约(C ++),而另一个开发人员在前端分散式应用程序(EOSJS)等)。每个共享分叉库访问权的此类开发人员都将获得自己的EOSIO区块链组件副本,以实现独立开发。

您可以尝试通过访问IDE:https://gitpod.io/#https://github.com/EOSIO/eosio-web-ide,以驱动系统(然而您并不能够在EOSIO/eosio-web-ide Github库中进行保存)

指南

以下指南假设Web IDE已经成功开启(查看设置)

打开一个终端

使用IDE用户界面中的终端(Terminal)下拉菜单打开终端。

构建简单的合约

简单智能合约的源代码在IDE的 contract/talk.cpp内。为编辑此合约,请在中断中运行以内内容:

eosio-cpp contract/talk.cpp

这将生成talk.abitalk.wasm

安装该合约

在终端中运行以下内容:

cleos create account eosio talk EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos set code talk talk.wasm
cleos set abi talk talk.abi

创建用户并使用该合约

在终端中运行以下内容:

cleos create account eosio bob EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos create account eosio jane EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos push action talk post '[1000, 0, bob, "This is a new post"]' -p bob
cleos push action talk post '[2000, 0, jane, "This is my first post"]' -p jane
cleos push action talk post '[1001, 2000, bob, "Replying to your post"]' -p bob

列出消息清单

在终端中运行以下内容:

cleos get table talk '' message

查看前端去中心化网络appEOSJS):

React WebApp的源代码位于IDE的。要预览此WebApp,请在终端中运行以下内容:

gp preview $(gp url 8000)

单元测试的源代码位于IDE的 tests目录。要构建测试,请在终端中运行以下内容:

./build-tests

这将生成tester二进制文件,可以在终端中运行,以开启世纪的单元测试:

./tester

该单元测试创建了 talk_tests测试套件,并验证以下语句是否正确运行:

  1. 创建用户账户talk
  2. talk沙河中下载talk智能合约
  3. 创建用户账户john 和 jane
  4. 通过执行以下内容,测试发布操作:
  5. 将发布动作从talk推到john,消息“post1”被标识为1,并发给消息0noone发送)。这会将消息1john发布给对话中的noone
  6. 将发布动作从talk推到jane,消息“post2”被标识为2,并发给消息0noone发送)。这会将消息2jane发布给对话中的noone
  7. 将发布动作从talk推送到john,消息“post3reply”被标记为3,并发送给消息2(由jane所发送)。此操作在对话中发布了从john回复给jane的消息3
  8. 若消息发送给不存在的消息id,则测试的发布操作失败。

重置链

按以下步骤删除已存在的链并创建另一个:

  • 切换至运行节点的终端
  • 按下ctrl+c,停止它
  • 运行以下内容
rm -rf ~/eosio/chain
nodeos --config-dir ~/eosio/chain/config --data-dir ~/eosio/chain/data -e -p eosio --plugin eosio::chain_api_plugin

请注意:如果网络应用当前处于开放状态,它将会引发以下类似错误。您可以忽略:

FC Exception encountered while processing chain.get_table_rows

贡献

贡献指南

行动准则

许可证

MIT

重要通知

查看许可证,了解版权和许可证条款。

期间提供的全部库及其他材料都受此重要通知中条款的约束,您必须自行熟悉此间条款。该通知包含与我们软件、出版物、商标、第三方资源以及前瞻性声明相关的信息、限制和制约内容。通过访问我们任意库及其他资料,您接收并同意此声明条款。

原文/Original:

EOSIO Quickstart Web IDE lets developers start building full-stack EOSIO applications in a matter of minutes.

Powered by Gitpod.io and Docker, it provides developers with a personal single-node EOSIO blockchain for development and testing purposes without a need of going through advanced local environment setup. It also includes an example application with a smart contract and web frontend, connected to the blockchain. Developers can also use EOSIO tools like cleos and eosio.cdt straight out of the box. This project requires zero installation on the user’s machine. All code is stored and managed on the developer’s personal GitHub account, with the changes saved automatically.

We built this project with ease of use and simplicity in mind. It can be used by new developers trying out or learning EOSIO, as well as advanced developers and teams. It is especially useful in the environments where users don’t have full control over the systems they work on (universities, banks, government organizations, etc.) or when they have lower-than-required computer specs to run EOSIO locally.

We hope you will find this project useful and welcome feedback on future improvements.

Setup

  1. Fork this repo to your personal GitHub account so that you can save your work into your personal Github account.
  2. Point your browser to the following URL https://gitpod.io/#https://github.com/your-github-account/eosio-web-ide to start the IDE. You will be automatically prompted to create a Gitpod account (all types of Gitpod accounts (including free) will work). You can also choose to provide multiple developers push access to your personal github fork of this repo to collaborate with them (one developer working on the smart contract (C++) while the other working on the front-end decentralized application (EOSJS), etc.). Each such developer sharing access to the forked repo will get their own copy of the EOSIO blockchain components to enable independent development.

You can test drive the system by accessing the IDE at https://gitpod.io/#https://github.com/EOSIO/eosio-web-ide (however you will not be able to save your work into the EOSIO/eosio-web-ide Github repository)

Instructions

The following instructions assume that the Web IDE was started successfully (see Setup).

Opening a terminal

To open a terminal, use the Terminal drop-down menu in the IDE user interface.

Building sample contract

The source code for the sample smartcontract is at contract/talk.cpp within the IDE. To compile the contract, run this in a terminal:

eosio-cpp contract/talk.cpp

This will produce talk.abi and talk.wasm.

Installing the contract

Run this in a terminal:

cleos create account eosio talk EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos set code talk talk.wasm
cleos set abi talk talk.abi

Creating users and using the contract

Run this in a terminal:

cleos create account eosio bob EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos create account eosio jane EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos push action talk post '[1000, 0, bob, "This is a new post"]' -p bob
cleos push action talk post '[2000, 0, jane, "This is my first post"]' -p jane
cleos push action talk post '[1001, 2000, bob, "Replying to your post"]' -p bob

Listing the messages

Run this in a terminal:

cleos get table talk '' message

Viewing the front-end decentralized web app (EOSJS):

The source code for the React WebApp is at webapp/src/index.tsx within the IDE. To preview the WebApp run this in a terminal:

gp preview $(gp url 8000)

Building and running the unit test

The source code for the unit test is at the tests directory within the IDE. To build the tests, run this in the terminal:

./build-tests

This will produce the tester binary, which can be run from the terminal to start the actual unit test:

./tester

The unit test creates the talk_tests test suite and verifies that the following statements are executed without error:

  1. Create user account talk.
  2. Load the talk smart contract in the talk account sandbox.
  3. Create user accounts john and jane.
  4. Test the post action by performing the following:
    1. Push the post action from talk to john with message “post 1” identified as 1 and addressed to message 0 (sent by noone).
      This posts the message 1 from john to noone in the chat.
    2. Push the post action from talk to jane with message “post 2” identified as 2 and addressed to message 0 (sent by noone).
      This posts the message 2 from jane to noone in the chat.
    3. Push the post action from talk to john with message “post 3: reply” identified as 3 and addressed to message 2 (sent by jane).
      This posts the reply message 3 from john to jane in the chat.
  5. Test failure of the post action if message is addressed to a non-existant message id.

Resetting the chain

To remove the existing chain and create another:

  • Switch to the terminal running nodeos
  • Press ctrl+c to stop it
  • Run the following
rm -rf ~/eosio/chain
nodeos --config-dir ~/eosio/chain/config --data-dir ~/eosio/chain/data -e -p eosio --plugin eosio::chain_api_plugin

Note: if the web app is currently open, then it will cause errors like the following. You may ignore them:

FC Exception encountered while processing chain.get_table_rows

Contributing

Contributing Guide

Code of Conduct

License

MIT

Important

See LICENSE for copyright and license terms.

All repositories and other materials are provided subject to the terms of this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.

原文链接/Original URL:

https://github.com/EOSIO/eosio-web-ide/blob/master/README.md

About the author

By user
News.EOS.WiKi Bilingual News & Info Of EOS

Recent Posts