Chain paddle PaddleDTX series - xdb source code analysis (1)

This article analyzes the xdb module code based on the chain paddle open source master branch. The latest commit is 4e59e197e7ca92e5560ebc0f945023eb500d238c

xdb is a decentralized storage system based on blockchain, which realizes functions such as file storage, file summary uploading, copy maintenance certificate, health status monitoring, and file migration. The xdb code structure is shown in the figure below:
insert image description here

blockchain module

The blockchain module realizes the interaction between xdb and the blockchain network. xdb temporarily supports Xuperchain (xchain) and Fabric, taking xchain as an example:
insert image description here

xchain.go implements xchain client initialization related functions

```go
type XChain struct {
    ContractName      string
    ContractAccount   string
    ChainName         string 
    Account           *account.Account
    XchainClient      *xchain.XuperClient
}

​// New creates a XChain client which is used for connecting and requesting blockchain
func New(conf *config.XchainConf) (*XChain, error) {
    if len(conf.Mnemonic) == 0 {
        return nil, errorx.New(errorx.ErrCodeConfig, "missing mnemonic")
    }
    ...
}

client module

The client module is the client tool of xdb, which can interact with xdb server through this module. For details, see client/http/http.go

cmd module

The cmd module is a command line tool of xdb, which supports the following functions through the client request server service:
insert image description here
For detailed usage, see cmd/client/README.md

Guess you like

Origin blog.csdn.net/weixin_40862140/article/details/126771680