Developing dApps on the EOS blockchain using EOSJS and scatter
Since I've been delving intoEOS dApp development, I've read some great articles.。 It's here., I've summarized all the knowledge I've gained from doing some research。 In this article., I will explain how to use theEOSJS harmonyscatter。 I assume that you are interested in smart contract (computing) and how to get it inEOS Deploying them on the blockchain has a basic understanding, Because I will skip that section in this article。
What are we building?
We are building a simple todo dApp. We will write smart contracts for CRUD (Create, Read, Update and Delete) operations and will use EOSJS and scatter to interact with the deployed contracts. CRUD operations include creating, completing, deleting, and getting to-do items. We will use Jungle Testnet to deploy our smart contracts.
essential knowledge
EOS
EOSJS
Scatter
Scatter Settings
Scatter For signing transactions for the blockchain, and provide personal information to the application without revealing the key。 To setScatter purses, Stay tuned for this video。 (located) at Scatter Settings in, Must be added to the networkJungle testnet, It contains the following details:
After adding the network configuration, now import your private key into the wallet by entering the Key Pair section and then clicking New. Complete the key information according to the form shown below.
You should now add the logo using the key pair. If it doesn't work, go to the "Identity" section and add or edit an existing identity. In the Identity section, select Network, then Key Pair, which will ask you to add the account associated with that key on the chain network. You should add accounts with active permissions.
Your scatter is all set up and ready to use in our dApp.
smart contract (computing)
To deploy the todo smart contract, follow this article to deploy it to Jungle Testnet. Make sure you can interact with Testnet from the command line mentioned in the article.
Interacting with Testnet
I'm using ReactJS as the front end part. The complete logic and flow is located in a single file called index.jsx in the src folder. The following objects are configured.
Interaction with scatter.
Now, in this object, we have two references to EOSClient and scatter, which we will use to interact with the EOS blockchain and wallet, respectively.
I am adding a function to the code to get the stored data (all todos) using EOSClient, you can check the rest of the functions in.
To get the account, use the scatter object of.
That'll be OK.
conclude
One of the biggest advantages is that you don't have to maintain a wallet on the machine, scatter manages everything for us. There are other ways to host wallets, but scatter is accountable to the end user and developers don't need to deal with any private information. Code Location.https://github.com/eosasia/eos-todo
Sharing an interactive online programming hands-on, EOS smart contract and DApp development primer on.
This course helps you get a quick introduction to EOS blockchain decentralized application development, covering core knowledge points such as EOS toolchain, accounts and wallets, issuing tokens, smart contract development and deployment, using code to interact with smart contracts, and finally a comprehensive application of each knowledge point to complete the development of a sticky note DApp.