How to Dapp
We’ll show you how to build your first decentralized application, or Dapps in this document. We’ll also guide you through Dapp development process instructions.
Dapp Development Process Instructions
Any Dapp on public blockchain from frontend to smart contracts, has mian steps as we show in figure 1.
The decentralized network we use in this document is Startcoin. Key components that have been used in figure 1:
Frontend user interface
SDK tools are used to interact with the Starcoin blockchain
Browser extension Starmask is an alternative way to interact with the Starcoin blockchain
Nodes on Starcoin blockchain
Smart contracts on Starcoin blockchain
Some programming tools we used in key components we mentioned in figure1 are shown in figure2:
First, We will explain some concepts that developers may concern, Then we will cover more details about each programming tool.
- Practical Dapp: You will get intuitive knowledge of what a decentralized application is. For a front-end developer, this will be a good choice to explore Dapp.
- StarMask API: In some Dapp development scenarios, such as digital signatures, the Starmask API will be called to complete interactions with users and blockchain. StarMask is a software cryptocurrency wallet used to interact with the Starcoin blockchain.
- SDK is one way to interact with Starcoin blockchain. Developers can choose one SDK which suits your needs. SDKs for Starcoin are:
- JS SDK
- Java SDK
- Python SDK
- Go SDK
- Dart SDK
- RPC API and Starcoin Nodes : You can access all services and interfaces of Nodes via RPC interface, it’s the fastest way to interact with Starcoin for developers or SDK.
- Smart Contracts: Move is used to implement and deploy smart contracts on Starcoin, all users on Starcoin can reuse these smart contracts.
Next, we’ll explore further about each concept we have learned in figure 2. If there is a certain part that you're interested in, you can skip to it.
It’s an easy decentralized application, it’s designed for you to get started. You will get a quick feel of what Dapp is and how it interacts with Starcoin. For a developer, you can build your own Dapp or check the code structure through viewing its source code.
- Test Dapp Link: https://starmask-test-dapp.starcoin.org/
- Github Link: https://github.com/starcoinorg/starmask-test-dapp
Starmask is not only used to manage your digital assets, but another way to interact with Starcoin blockchain. Here is one example, users create digital signature for each transaction in Dapp, then submit this transaction to Txpool which in remote nodes.
- Installation Link: https://github.com/starcoinorg/starmask-extension/blob/main/docs/en/how-to-install.md
- User Guides Link:https://github.com/starcoinorg/starmask-extension/blob/main/docs/en/how-to-use.md
Another way to interact with Starcoin is SDK. Starcoin now supports multi-language SDKs. SDK provides a programming interaction with nodes on Starcoin.
- JS SDK
- Source Code Link: https://github.com/starcoinorg/starcoin.js
- Java SDK
- Developer Documentation Link: https://github.com/starcoinorg/starcoin-java#readme
- Source Code Link: https://github.com/starcoinorg/starcoin-java
- Python SDK
- Developer Documentation Link: https://starcoin-sdk-python.readthedocs.io
- Source Code Link: https://github.com/starcoinorg/starcoin-sdk-python
- Go SDK
- Developer Documentation Link: https://github.com/starcoinorg/starcoin-go/blob/main/README.md
- Source Code Link: https://github.com/starcoinorg/starcoin-go
- Dart SDK
- Source Code Link: https://github.com/starcoinorg/starcoin.dart
Starcoin Nodes and RPC API
You can interact with Starcoin nodes using StarMask or SDK on Starcoin blockchain. The stability of nodes is essential to add Dapp transactions on Starcoin blockchain. Starcoin nodes include necessary APIs which you’ll use on Starcoin blockchain.
- Networks Starcoin has appropriate networks to satisfy the needs in various stages of development. We have five networks: Dev, Test, Halley, Proxima,Barnard,Main.
- Dev: It’s used for local Dapp development
- Test: It’s used for unit and integrated test
- Halley: Always use the latest version of Stdlib, Genesis Block will be reset immediately and data will be cleaned up whenever there is a update for Stdlib
- Proxima: It’s used to run tests before Dapp launch, data will be cleaned up periodically
- Barnard: It’s also used to run tests before Dapp launch, but it’s different from Proxima, we do not remove data, it’s your responsibility to ensure smart contracts are still compatible.
- Main: Main Starcoin network
- Nodes Installation Methods To install on Windows,Mac, and Linux, download pre-compiled binary from downloads pages.
- Run Starcoin The approach is a little bit different due to different node installation methods.
- Run inside Docker container, Guides
- Pre-compiled binary, Guides
You need to change the
-nparameter to use different networks.
- Console Starcoin console is a command line interface for running Starcoin nodes. You can view nodes’ state using a simple command.Guides
- Command Line Document Starcoin has lots of commands, some useful commands are:
- account: account-related command
- chain: chain-related command
- node: node-related command
- state: state-related command Check here to view more commands.
- RPC Protocol You also can connect to Starcoin nodes via the RPC interface. It’s a great programming way to access nodes on a chain, SDK is one example. Check RPC protocol document to get more information.
- More about Starcoin If you are a developer and want to get more details about Starcoin. We recommend you check these links:
- Key concept: https://starcoin.org/zh/developer/key_concepts/
- Source code: https://github.com/starcoinorg/starcoin
Currently, Starcoin is the first one public blockchain that can run Move smart contracts.
- Move Book.
- Starcoin IDE: https://marketplace.visualstudio.com/items?itemName=starcoinorg.starcoin-ide
- Move-Package-Manager: It’s a lightweight tool to test, deploy Move smart contracts.Download
- Test You can test your Move smart contracts with different test types.
- Functional Test: To run a functional test, make sure to initialize Starcoin first.
- Compile and Deploy There are multiple ways to compile and deploy Move smart contracts on Starcoin blockchain. Make sure that you have chosen appropriate networks!
- Console: Guides
- Starmask-test-dapp: Contract blob hex functionality. Guides
- Move-Package-Manager: Guides
- More example about Move
Stdlib and Protocols
Starcoin has been created using Move language, it also has Stdlib features. Please check our [source code]
Starcoin has defined variety protocols in Stdlib, some protocols will be shown in figure 3.
- DAO protocolDAO protocol is a basic protocol in Stdlib, you can govern blockchain well via DAO protocol. Here is a governable contract upgrade example.
- NFT Protocol
- NFT protocol introduction
- Source Code
Other Develop Tools
- Official website Visit our website to get more information, such as white paper, developer documents and tools, toolchain,latest news about Starcoin.
- Faucet You will need STC(native cryptocurrency of this platform) when you run tests, such as paying gas fees. As a developer, you can apply for STC in Barnad network.
- Barnad: https://faucet.starcoin.org
Explorer Explorer is a complementary tool to chain. We suggest that you use stcscan as blockchain explorer.
Voting DappVoting Dapp is another developer tool,it’s used to manage Starcoin blockchain. A developer can create a proposal, we will take a public,equal and formal vote in our community on the Voting Dapp. Your proposal will be approved with more votes in favour.
Starcoin logos and icons