Before you begin
Before you begin,please make sure that you have installed the Linux system. The installation of the Linux system will not be repeated here.
BFS Developer Basic Tutorial (Beta)
1. BFS Overview
What is BFS?
BFS, the full name is Bioforest Chain System, Bioforest is the full name of Biology Forest, and BFS means the Biological Chain Forest system. It is a self-developed, domestically-made, and controllable underlying technology of the blockchain by Instinct Lab, breaking the constraint
Application example
This article uses a simple development example of the exchange withdrawal function, including the preparation of the development environment and the deployment of BFMeta, so that developers can easily master how to develop their own DApp on the BFMeta network.
Development Preparation
The development example in this article uses
Command line tool
Get help information for command line tools
Enter the command "bcf /?" or "bcf /help" to get the BCF command line help description (under Linux, "bcf -h" or "bcf
"--help" is "bcf /?" or "bcf /help", the following uses Windows as an example), the detailed command list
openBrl
1. Description
Used to open an application.
2. Method
openBrl(brl: string): PromiseLike<BFS.Channel.Port | undefined>;
Parameter Description
-brl: application open path
Return Value: Port used for duplex communication between two applications
import "@bfs/bfchain-runtime-typings";
const bfs = bfsprocess.import("bfs");
(async (
@bfs/lib-webview-activity
1. Description
Used to build
2. Method
createAcivity(activityName: string, ActivityCtor: AC = (DomActivity as unknown) as AC) is used to create a page instance
Parameter Description
activityName: page name
ActivityCtor: page constructor
Return Value: Port for duplex communication
3. WebViewAcivity class
Method
op
BFS-TUI Data Transfer Protocol [BTP]
1. Basic description
The role of the agreement
It is used by BFS to tell TUI how to display content, and TUI to tell BFS what instructions to execute.
Message description
character set:
utf8
Basic format
dataHeader-dataBody-dataEnd
dataHeader header information
dataBody data body
dataEnd data end information
Description of interface parameters and return parameters
The full name of the interface is the function name of the interface, which is also the full name of the command line call
The interface is abbreviated as the abbreviated name when calling the command line.
The callable method refers to the method in which the interface allows to be called
Basic interface
1. Get the BFMeta version number
The full name of the interface: nodeVersion
Interface abbreviation: v
Callable methods: Http, Websocket, command line
Calling method: get
Interface url address: /api/basic/nodeVersion
Request parameters: none
Return parameters:
interface NodeVersion {
/**whether succeed */
success: boolean;
result:
Event class interface
1. Transfer event
1.1 Create transfer event
Introduction
The most basic on-chain equity transfer, which Enables an asset to be transferred directly from address A to address B.
The asset type is assetType, the quantity is amount, and the minimum unit is 1. 1BFM = 100000000
The full name of the interface: trTransferAsset
Int