Basic interface

1. Get the Bfchain version number

-The full name of the interface: getBfchainVersion -Interface abbreviation: v -Callable methods: Http, Websocket, command line -Calling method: get -Interface url address: /api/basic/getBfchainVersion -Request parameters: none -Return parameters:

interface GetBfchainVersion {
    /**whether succeed */
    success: boolean;
    result: {
        /**The version number of the current node */
        version: string;
    };
}

2. Get the latest block of the local node

-The full name of the interface: getLastBlock -Interface abbreviation: glb -Callable methods: Http, Websocket, command line, Grpc -Calling method: get -Interface url address: /api/basic/getLastBlock -Request parameters: none -Return parameters:

interface GetLastBlock {
    /**whether succeed */
    success: boolean;
    result: {
        /**Block height */
        height: number;
        /**Block timestamp */
        timestamp: number;
        /**Block size */
        blockSize: number;
        /**Forger's public key */
        generatorPublicKey: string;
        /**Forger's security public key */
        generatorSecondPublicKey?: string;
        /**Forger's rights */
        generatorEquity: string;
        /**Number of block events */
        numberOfTransactions: number;
        /**Block event summary */
        payloadHash: string;
        /**Block event summary length */
        payloadLength: number;
        /**Previous block signature */
        previousBlockSignature: string;
        /**Total amount of assets incurred */
        totalAmount: string;
        /**Total handling fees incurred */
        totalFee: string;
        /**Block reward value */
        reward: string;
        /**Chain identifier of the block */
        magic: string;
        /**Block participation */
        blockParticipation: string;
        /**Block signature */
        signature: string;
        /**Block security signature */
        signSignature?: string;
        /**Block remarks information */
        remark: {
            [key: string]: string;
        };
        /**Block additional information */
        asset: any;
    };
}

3. Get the specified block

-The full name of the interface: getBlock -Interface abbreviation: gb -Callable methods: Http, Websocket, command line, Grpc -Calling method: post -Interface url address: /api/basic/getBlock -Request parameters:

interface GetBlock {
    /**Block signature */
    signature?: string;
    /**Block height */
    height?: number;
    /**View the first few pages (20 records per page) */
    page?: number;
}

-Return parameters:

interface GetBlock {
    /**whether succeed */
    success: boolean;
    result: {
        blocks: {
            /**Block version number */
            version: number;
            /**Block height */
            height: number;
            /**Block size */
            blockSize: number;
            /**Block timestamp */
            timestamp: number;
            /**Block signature */
            signature: string;
            /**Block security signature */
            signSignature?: string;
            /**Blacksmith gong'yao */
            generatorPublicKey: string;
            /**Forger's security public key */
            generatorSecondPublicKey?: string;
            /**Forger's rights */
            generatorEquity: string;
            /**Number of block events */
            numberOfTransactions: number;
            /**Block event summary */
            payloadHash: string;
            /**Block event summary length */
            payloadLength: number;
            /**Previous block signature */
            previousBlockSignature: string;
            /**Total amount of assets incurred */
            totalAmount: string;
            /**Total handling fees incurred */
            totalFee: string;
            /**Block reward value */
            reward: string;
            /**Chain identifier of the block */
            magic: string;
            /**Block participation */
            blockParticipation: string;
            /**Block remarks information */
            remark: {
                [key: string]: string;
            };
            /**Block additional information */
            asset: object;
            /**Block statistics */
            statisticInfo: {
                /**Total handling fee for events packaged by the block */
                totalFee: string;
                /**The total equity value of the event packaged by the block (without distinguishing the equity type) */
                totalAsset: string;
                /**The total main equity value of the event packaged by the block */
                totalChainAsset: string;
                /**The total number of accounts involved in the event packaged by the block */
                totalAccount: number;
                /**Statistic details of event equity type packaged by block, JSON object */
                assetStatisticHashMap: {
                    [index: number]: {
                        /**The chain network identification to which the rights and interests belong, composed of uppercase letters or numbers, 5 characters, and the last digit is the check digit */
                        magic: string;
                        /**Name of equity, composed of uppercase letters, 3-5 characters */
                        assetType: string;
                        /** Index of equity in the block */
                        index: number;
                        /**Statistics of event types of block packaging, JSON object */
                        typeStatisticHashMap: {
                            [baseType: number]: {
                                /**The total value of the change, the increase or decrease of an account will have an impact */
                                changeAmount: string;
                                /**The total number of changes, the increase or decrease of an account will have an impact */
                                changeCount: number;
                                /**Total asset migration */
                                moveAmount: string;
                                /**Unified number of transactions */
                                transactionCount: number;
                            };
                        };
                        /**Statistics of event equity type packaged by block, JSON object */
                        total: {
                            /**The total value of the change, the increase or decrease of an account will have an impact */
                            changeAmount: string;
                            /**The total number of changes, the increase or decrease of an account will have an impact */
                            changeCount: number;
                            /**Total asset migration */
                            moveAmount: string;
                            /**Unified number of transactions */
                            transactionCount: number;
                        };
                    };
                };
            };
            /**List of Forgers dropped */
            roundOfflineGeneratersHashMap: {
                /**
                 * Use comma separated addresses
                 * address,address */
                [roundOffset: string]: string;
            };
            /**Event */
            transactions: {
                transaction: TransactionJSON;
                /**The index of the event in the block */
                index: number;
                /**Block height */
                height: number;
                /**The amount of events in the event originating account */
                numberOfSenderTransactions: number;
                /**Information on changes in account equity involved in the event */
                transactionAssetChanges: {
                    /**account type */
                    accountType: number;
                    /** Index of equity in the block */
                    assetTypes: number;
                    /**The latest equity holdings of the account */
                    assetBalance: string;
                }[];
                /**The latest information about the rights and interests before the rights and interests are destroyed */
                assetPrealnum?: {
                    /**The number of remaining equity */
                    remainAssetPrealnum: string;
                    /**Number of frozen main equity */
                    frozenMainAssetPrealnum: string;
                };
                /** Signature of the block forger */
                signature: string;
                /**Security signature of the block forger */
                signSignature?: string;
            }[];
        }[];
        /**Total number of query conditions */
        count: number;
        /**Maximum page query */
        cmdLimitPerQuery: number;
    };
}

4. Get the specified event

-The full name of the interface: getTransactions -Interface abbreviation: gt -Callable methods: Http, Websocket, command line, Grpc -Calling method: post -Interface url address: /api/basic/getTransactions -Request parameters:

interface GetTransactions {
     /**Event id */
     signature?: string;
     /**The height of the block to which the event belongs */
     height?: number;
     /**The minimum height of the block to which the event belongs. It can be used with maxHeight to query a range of events */
     minHeight?: number;
     /**The highest height of the block to which the event belongs. It can be used with minHeight to query a range of events */
     maxHeight?: number;
     /**Event initiator */
     senderId?: string;
     /**Event receiver */
     recipientId?: string;
     /**Event type, if it is not passed in, the event type will not be filtered. For the event type, please refer to <event type> */
     type?: string[];
     /** The index value of the event, the event can be queried according to the index value of the event. The index value may be assetType or signature or username, etc. It is recommended to use it in parallel with other conditions for precise search. */
     storageValue?: string;
     /**View the first few pages (20 records per page) */
     page?: number;
}

-Return parameters:

interface GetTransactions {
    /**whether succeed */
    success: boolean;
    result: {
        trs: {
            /**The index of the event in the block */
            index: number;
            /**Signature of the block where the event is located */
            blockSignature: string;
            /**The height of the block where the event is located */
            height: number;
            /**The Nth event of the initiator */
            numberOfSenderTransactions: number;
            /**Information on changes in account equity involved in the event */
            transactionAssetChanges: {
                /**account type */
                accountType: number;
                /** Index of equity in the block */
                assetTypes: number;
                /**The latest equity holdings of the account */
                assetBalance: string;
            }[];
            /**The latest information about the rights and interests before the rights and interests are destroyed */
            assetPrealnum?: {
                /**The number of remaining equity */
                remainAssetPrealnum: string;
                /**Number of frozen main equity */
                frozenMainAssetPrealnum: string;
            };
            /** Signature of the block forger */
            signature: string;
            /**Security signature of the block forger */
            signSignature: string;
            /**Event body */
            transaction: BFChainCore.TransactionJSON;
            /**Store timestamp */
            dateCreated: number;
        }[];
        /**Total number of query conditions */
        count: number;
        /**Maximum page query */
        cmdLimitPerQuery: number;
    };
}

5. Get the last transaction of the account

-The full name of the interface: getAccountLastTransaction -Interface abbreviation: None -Callable methods: Http,Websocket -Calling method: post -Interface url address: /api/basic/getAccountLastTransaction -Description: This interface is used to obtain the approximate balance of the specified address. Take assetBalance as the balance according to the accountType of the return parameter transactionAssetChanges. -Request parameters:

interface GetAccountInfoAndAssets {
    /**Account address */
    address: string;
    /**Asset type */
    assetType: string;
}

-Return parameters:

interface GetAccountLastTransaction {
    /**whether succeed */
    success: boolean;
    result: {
        transactionInBlock?: BFChainCore.TransactionInBlockJSON;
        assetIndex?: { [assetType:string]: number };
        block?: BFChainCore.BlockJSON;
    }
}

6. Create an account

-The full name of the interface: createAccount -Interface abbreviation: ca -Callable methods: Http, Websocket, command line, Grpc -Calling method: post -Interface url address: /api/basic/createAccount -Request parameters:

interface CreateAccount {
    /**Account Key */
    secret: string;
}

-Return parameters:

interface CreateAccount {
    /**whether succeed */
    success: boolean;
    result: {
        /**Address */
        address: string;
        /**Public key */
        publicKey: string;
        /**Private key */
        secretKey: string;
    };
}

7. Get node status

-The full name of the interface: getBlockChainStatus -Interface abbreviation: gbc -Callable methods: Http, Websocket, command line, Grpc -Calling method: get -Interface url address: /api/basic/getBlockChainStatus -Request parameters: none -Return parameters:

interface GetBlockChainStatus {
    /**whether succeed */
    success: boolean;
    result: {
        /**Node running status: 0 offline, unavailable 1 Free state, free resources are available 2 Rebuilding the blockchain 3 Node consensus 4 Replaying the block 5 Forging the block 6 Rolling back the block */
        status: any;
        /**Current number of node connections */
        peers: number;
        /**Whether the current node has completed initializing data */
        isReady: boolean;
        /**Current timestamp of the node */
        serverTimestamp: number;
    };
}

8. Get the last transaction of the account according to the transaction type

-The full name of the interface: getAccountLastTypeTransaction -Interface abbreviation: galtt -Callable methods: Http, Websocket, command line -Calling method: post -Interface url address: /api/basic/getAccountLastTypeTransaction -Request parameters:

interface GetAccountLastTypeTransaction{
     /**Account address */
     address: string;
     /**Transaction event type */
     transactionType: string;
}

-Return parameters:


interface GetAccountLastTypeTransaction{
     /**whether succeed */
     success: boolean;
     result: {
         transactionInBlock?: BFChainCore.TransactionInBlockJSON;
     };
}