译文/Translated:
EOSIO Quickstart Web IDE 让开发人员在数分钟内开始构建全堆栈EOSIO应用。
获得Gitpod.io以及Docker助力,它为开发人员提供个人单点EOSIO区块链,用以进行开发和测试,并且无需经过高级的本地环境设置。它也包括一项具备智能合约和网页前端的示例应用,该应用已经连接至区块链。开发人员还可以直接使用cleos以及eosio.cdt等EOSIO工具。该项目并不需要在用户设备上进行安装。所有代码都储存在开发人员个人的GitHub账户中,并在其间进行管理,出现的的任何更改将自行进行保存。
我们构建这一项目至始至终秉承着简单和简易的原则。新手开发人员可能用它进行尝试或学习EOSIO,同时它也适合高级开发人员和团队使用。它在使用者没有完全控制其工作系统的环境中尤其有用(例如大学、银行、政府机构等),也适用于计算机规格低于要求配置时在本地运行EOSIO。
我们希望这个项目能对您有用,同时欢迎您在为该项目的进一步改进提供宝贵意见。
设置
- 将库分叉到您的个人GitHub帐户,以便您可以将工作保存到个人的Github帐户中
- 将浏览器指向以下位置
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.abi
及talk.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
查看前端去中心化网络app(EOSJS):
React WebApp的源代码位于IDE的。要预览此WebApp,请在终端中运行以下内容:
gp preview $(gp url 8000)
单元测试的源代码位于IDE的 tests
目录。要构建测试,请在终端中运行以下内容:
./build-tests
这将生成tester
二进制文件,可以在终端中运行,以开启世纪的单元测试:
./tester
该单元测试创建了 talk_tests
测试套件,并验证以下语句是否正确运行:
- 创建用户账户
talk
。
在
talk
沙河中下载
talk
智能合约
。
创建用户账户
john
和 jane
。
通过执行以下内容,测试发布操作:
将发布动作从
talk
推到
john
,消息
“post1”
被标识为
1
,并发给消息
0
(
noone
发送)。这会将消息
1
从
john
发布给对话中的
noone
。
将发布动作从
talk
推到
jane
,消息
“post2”
被标识为
2
,并发给消息
0
(
noone
发送)。这会将消息
2
从
jane
发布给对话中的
noone
。
将发布动作从
talk
推送到
john
,消息“
post3
:
reply
”被标记为
3
,并发送给消息
2
(由
jane
所发送)。此操作在对话中发布了从
john
回复给
jane
的消息
3
。
若消息发送给不存在的消息
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
贡献
贡献指南
行动准则
许可证
重要通知
查看许可证,了解版权和许可证条款。
期间提供的全部库及其他材料都受此重要通知中条款的约束,您必须自行熟悉此间条款。该通知包含与我们软件、出版物、商标、第三方资源以及前瞻性声明相关的信息、限制和制约内容。通过访问我们任意库及其他资料,您接收并同意此声明条款。
原文/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
- Fork this repo to your personal GitHub account so that you can save your work into your personal Github account.
- 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:
- Create user account
talk
. - Load the
talk
smart contract in thetalk
account sandbox. - Create user accounts
john
andjane
. - Test the
post
action by performing the following:- Push the
post
action fromtalk
tojohn
with message “post 1
” identified as1
and addressed to message0
(sent by noone).
This posts the message1
fromjohn
to noone in the chat. - Push the
post
action fromtalk
tojane
with message “post 2
” identified as2
and addressed to message0
(sent by noone).
This posts the message2
fromjane
to noone in the chat. - Push the
post
action fromtalk
tojohn
with message “post 3: reply
” identified as3
and addressed to message2
(sent byjane
).
This posts the reply message3
fromjohn
tojane
in the chat.
- Push the
- 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
License
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: