zl程序教程

您现在的位置是:首页 >  系统

当前栏目

阐述BNB代币分红模式系统开发技术理论讲解方案

系统模式 方案 讲解 理论 开发技术 代币 阐述
2023-06-13 09:15:01 时间

DApp是通过智能合约构建起来的——智能合约质押挖矿分红系统开发智能合约指的是在区块链上以确定性运行的编码逻辑的程序,目前看到的大多数dApp都是由多个智能合约构建而成的,形成了一个个具有特定用例的应用程序。

DApp所需的四个最基本的功能:

1、结算:Essentially, it is a sub ledger in the whole blockchain ledger. They are composed of some smart contracts, which are used to allocate asset ownership and define how stored assets interact in the dApp.

2、计算:It contains smart contracts with program logic. To process these logic, it must be executed before the final state change is generated.

3、存储:In order to facilitate users to interact with dApp in their web browsers, it needs to choose a storage solution suitable for them to host the user interface (UI).

4、资金:They usually own native digital assets and/or digital assets deposited by other users as part of their services.

def xml_parse(xml_str):

    class EchoTarget(object):

        def __init__(self):
            self.data_list = []
            self.data_dict = {}
            self.tag = ''
            self.value = ''
            self.attr = ''

        def start(self, tag, attrib):
            # start 在元素打开时触发。数据和元素的子元素仍不可用。
            self.tag = tag
            if dict(attrib):
                self.attr = dict(attrib)
            # print("start %s %r" % (tag, dict(attrib)))

        def end(self, tag):
            # end 在元素关闭时触发。所有元素的子节点,包括文本节点,现在都是可用的。
            if self.value:
                self.data_list.append(dict(
                    key=self.tag,
                    value=self.value,
                    attr=self.attr
                ))
            # print("end %s" % tag)

        def data(self, dt):
            # data 触发文本子节点并访问该文本。
            if isinstance(dt, str):
                if dt.strip():
                    self.value = dt
            # print("data %r" % dt)

        def comment(self, text):
            print("comment %s" % text)

        def close(self):
            # close 在解析完成后触发。
            return self.data_list

    # 解析xml字符串
    parser = etree.XMLParser(target=EchoTarget())
    return etree.XML(xml_str, parser)

1、首先创建包文件夹 如:mapclient

2、在包文件夹(mapclient)的同级目录下,创建setup.py 文件

3、内容如下:

from distutils.core import setup

# py_modules 中,多个py文件,按着这个形式继续添加到列表中
# py_modules 中,是我当前包文件夹(mapclient)中的两个py文件constants.py 与 maptools.py

setup(name="压缩包名字", version="版本号", author="作者", py_modules=["mapclient.constants", "mapclient.maptools"])

4、构建模块:python3 setup.py build,在包文件夹(mapclient)的同级目录下会生成build目录

5、生成发布压缩包:python3 setup.py sdist, 在包文件夹(mapclient)的同级目录下会生成dist目录,并存发布的放压缩包

6、解压压缩包

7、进入,执行 python3 setup.py install, 安装到pyhon3中。