This repository enables developers to instantiate a browser based IDE and runs the required EOSIO blockchain components (nodeos, keosd, cleos) in a personal cloud instance. All custom code created by the developer is securely managed on the developer's personal GitHub account. Zero installation is required on the user's machine. User's can simply point their browser to the provided URL below and begin compiling the provided example smart contract (C++) and the associated front-end decentralized application (EOSJS), deploy the application on the blockchain, and experience the application in under a few minutes.
This EOSIO Web IDE is a combination of open source and commercial projects including Gitpod.io (theia-ide.org), Docker, EOSIO, EOSIO.CDT, EOSJS, and other required components. These are combined in a convenient manner so that new EOSIO developers can get their development environment set up in just a few minutes.
-
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)
The following instructions assume that the Web IDE was started successfully (see Setup).
To open a terminal, use the Terminal drop-down menu in the IDE user interface.
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
.
Run this in a terminal:
cleos create account eosio talk EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos set code talk talk.wasm
cleos set abi talk talk.abi
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
Run this in a terminal:
cleos get table talk '' message
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)
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.
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