CN113220697A - Storage method, equipment and storage medium for decentralized exchange - Google Patents

Storage method, equipment and storage medium for decentralized exchange Download PDF

Info

Publication number
CN113220697A
CN113220697A CN202110627643.9A CN202110627643A CN113220697A CN 113220697 A CN113220697 A CN 113220697A CN 202110627643 A CN202110627643 A CN 202110627643A CN 113220697 A CN113220697 A CN 113220697A
Authority
CN
China
Prior art keywords
transaction
account
tree
pair
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110627643.9A
Other languages
Chinese (zh)
Inventor
俞铠俊
王志文
吴思进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202110627643.9A priority Critical patent/CN113220697A/en
Publication of CN113220697A publication Critical patent/CN113220697A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention belongs to the technical field of computers, and particularly relates to a storage method, equipment and a storage medium for a decentralized exchange. The invention provides a storage method for a decentralized trading exchange, which is suitable for an AMM decentralized trading exchange of a block chain, wherein trading data is stored through a tree structure, the tree structure comprises a state tree, the state tree is used for storing account state information and trading pair information, the state tree comprises an account branch tree and a trading pair branch tree, leaf nodes of the account branch tree correspond to user accounts one by one, and leaf nodes of the trading pair branch tree correspond to trading pair accounts one by one; the method comprises the following steps: acquiring related transactions by using the block link points; and after the transaction is executed, acquiring the account and the transaction pair involved in the transaction, and updating the account state and the transaction pair state according to the transaction content. The method can better maintain the transaction pair data, does not need conversion, and can be directly adapted to the AMM exchange.

Description

Storage method, equipment and storage medium for decentralized exchange
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a storage method, equipment and a storage medium for a decentralized exchange.
Background
The most prominent essential feature of blockchains is decentralization. At present, two decentralization exchange schemes exist on a block chain, one scheme is to provide liquidity in the form of an order book, and represents the exchanges such as Newdex, IDEX, DDEX, Radar Relay, EtherDelta and the like; one is to provide liquidity by way of an automated market (AMM) represented by Uniswap, Bancor, etc.
The order book contains a list of orders, called bids (bid), and orders, called ask (ask), called ask. The order book lists the number of tokens to be bid or ask at each price point. The highest bid (buy one) and lowest ask (sell one) are referred to as buy and sell one (top of the book). They mark the market mood as well as the bid and offer prices needed to obtain the order. The difference between the highest bid price and the lowest ask price is the spread (spread). For an exchange in order book mode, its scope of applicability is a well-liquidated market. The traditional stock market and the centralized digital currency trading market adopt the order book mode. However, for a less mobile market, many problems arise with the exchange in order book mode. At the time of trading, an order is completed only if the bid and ask match, and the market will not be able to trade if the market highest bid is still below the lowest ask. Therefore, for the market with insufficient liquidity, the order book trading scheme has the problem that the trading success rate is low when the spread price is too large.
The automatic marketing scheme does not adopt an order book mode, but adopts a coin exchange algorithm, namely, the exchange between two or more coins is realized according to a certain rule or exchange rate. The essence of the automated market (AMM) is a commodity exchange or coin exchange, the transaction mode gives the user great freedom, the user can randomly select the coin types existing in two exchange exchanges to exchange the coins based on certain rules, this also makes the AMM exchanges on the market today increasingly subject to user concentration, where the AMM exchanges are traded in pairs, specifically, when initiating transaction in AMM exchange, the existing Token assets of users need to be selected to exchange with the target Token assets which the users need to exchange, the algorithm of the exchange is to automatically convert according to consensus, therefore, the state data of the AMM exchange needs to be maintained for transaction pairs in addition to the original account state, and the current states of the transaction pairs displayed by many AMM exchanges are all application-level transitions, and the bottom layer still uses the traditional state tree to store the state data.
Disclosure of Invention
In order to solve the problems that the state tree in the prior art cannot be directly applied to the AMM decentralized exchange, conversion is needed, and the complexity of the system is increased, the invention provides a storage method, equipment and a storage medium for the decentralized exchange, and the method, the equipment and the storage medium are applicable to the AMM exchange.
The invention aims to:
the method can better maintain the transaction pair data, does not need conversion, and can be directly adapted to the AMM exchange.
In order to achieve the purpose, the invention adopts the following technical scheme.
In a first aspect, a storage method for a decentralized exchange is provided,
the AMM decentralized trading exchange is applicable to a blockchain, and stores trading data through a tree structure, wherein the tree structure comprises a state tree, the state tree is used for storing account state information and trading pair information, the state tree comprises an account branch tree and a trading pair branch tree, leaf nodes of the account branch tree correspond to user accounts one by one, and leaf nodes of the trading pair branch tree correspond to trading pair accounts one by one; the method comprises the following steps:
acquiring related transactions by using the block link points;
and after the transaction is executed, acquiring the account and the transaction pair involved in the transaction, and updating the account state and the transaction pair state according to the transaction content.
Preferably, the state tree is a multi-way tree.
Preferably, the state tree is stored under a chain.
Preferably, the account status information includes status data of each type of Token in the corresponding account, and the transaction pair status information includes status data of two types of Token corresponding to the transaction pair.
Preferably, when the transaction is a transfer transaction, the account information related to the transaction and the type information of the Token involved in the transaction are acquired, the account status information of the account related to the transaction in the status tree is updated, and specifically, the status data of the Token involved in the transaction is updated.
Preferably, when the transaction is a transaction with increased liquidity, the account information, the transaction pair information and the Token type information related to the transaction are acquired, the account state information of the account related to the transaction and the transaction pair information related to the transaction in the state tree are updated, and specifically, the account related to the transaction and the Token type state information related to the transaction in the transaction pair are updated.
In a second aspect, a computer device is provided, comprising one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of the first aspects as described above.
In a third aspect, there is provided a storage medium storing a computer program which, when executed by a processor, performs the method of any one of the first aspects described above.
The invention has the beneficial effects that:
1) transaction pair data can be maintained well, conversion is not needed, and the method can be directly adapted to an AMM exchange;
2) the state tree is stored under the chain, and the data synchronization and consistency under the chain are maintained through zero knowledge proof.
Drawings
FIG. 1 is a diagram illustrating a structure of a state tree according to embodiment 1 of the present invention;
FIG. 2 is a diagram illustrating status of status tree transfers in embodiment 1 of the present invention;
FIG. 3 is a diagram showing states of a state tree for enhancing mobile transactions according to embodiment 1 of the present invention;
fig. 4 is a schematic structural diagram of a computer device provided in embodiment 2.
Detailed Description
The invention is described in further detail below with reference to specific embodiments and the attached drawing figures. Those skilled in the art will be able to implement the invention based on these teachings. Moreover, the embodiments of the present invention described in the following description are generally only some embodiments of the present invention, and not all embodiments. Therefore, all other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative effort shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "thickness", "upper", "lower", "horizontal", "top", "bottom", "inner", "outer", "circumferential", and the like, indicate orientations and positional relationships based on those shown in the drawings, and are used merely for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., and "several" means one or more unless specifically limited otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; may be mechanically coupled, may be electrically coupled or may be in communication with each other; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
Unless otherwise specified, the raw materials used in the examples of the present invention are all commercially available or available to those skilled in the art; unless otherwise specified, the methods used in the examples of the present invention are all those known to those skilled in the art.
Example 1
A storage method for a decentralized exchange is suitable for an AMM decentralized exchange of a block chain, transaction data are stored through a tree structure, the tree structure comprises a state tree, as shown in figure 1, the state tree is used for storing account state information and transaction pair information, the state tree comprises an account branch tree and a transaction pair branch tree, leaf nodes of the account branch tree correspond to user accounts one by one, and leaf nodes of the transaction pair branch tree correspond to transaction pair accounts one by one; the method comprises the following steps:
acquiring related transactions by using the block link points;
and after the transaction is executed, acquiring the account and the transaction pair involved in the transaction, and updating the account state and the transaction pair state according to the transaction content.
Specifically, the state tree is a multi-way tree.
In particular, the state tree is stored under the chain.
Further, the account status information includes status data of each type of Token in the corresponding account, and the transaction pair status information includes status data of two types of Token corresponding to the transaction pair.
Further, as shown in fig. 2, when the transaction is a transfer transaction, the account information related to the transaction and the Token type information related to the transaction are obtained, the account status information related to the account related to the transaction in the status tree is updated, and in particular, the status data of the Token related to the transaction is updated.
Further, as shown in fig. 3, when the transaction is a transaction with increased liquidity, the account information, the transaction pair information and the Token type information related to the transaction are obtained, the account state information of the account related to the transaction and the transaction pair information related to the transaction in the state tree are updated, and specifically, the account related to the transaction and the Token type state information related to the transaction in the transaction pair are updated.
At present, the prior art cannot meet the storage scheme of a decentralized exchange based on AMM under a chain, and needs to maintain a state tree to finish zksnarks certification for maintaining data synchronization and consistency under the chain; meanwhile, the AMM is used as a decentralized exchange, so that an Account model is not a traditional Account model, a storage space of Token pair transaction pair state data needs to be maintained on the basis of the Account model, the storage space needs to be embodied in a state tree, the state tree is divided into an Account branch tree and a transaction pair branch tree, the whole state tree is of a multi-branch tree structure, the Account branch tree is similar to the traditional Account model, an MPT (multi-spanning tree) structure can be preferably adopted to store the data, the transaction pair branch tree is arranged to maintain the state data of the Token pair transaction pair from the bottom layer, an application layer is not needed to convert the two types of Token data into the transaction pair data, the data can be stored and read more quickly during transaction, and the whole transaction processing capacity of the system is improved.
Example 2
A computer device, the device comprising: one or more processors; memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to perform the method of embodiment 1.
A storage medium storing a computer program which, when executed by a processor, implements the method as described in embodiment 1 above.
Fig. 4 is a schematic structural diagram of a computer device provided in this embodiment.
As shown in fig. 4, as another aspect, the present application also provides a computer apparatus 500 including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the apparatus 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication via a network such as the internet, and the processing driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments disclosed in the present application, the method described in the above embodiment 1 may be implemented as a computer software program. For example, embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method described in any of the embodiments above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described herein.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (8)

1. The storage method for the decentralized trading exchange is applicable to the AMM decentralized trading exchange of a block chain, and is characterized in that trading data are stored through a tree structure, the tree structure comprises a state tree, the state tree is used for storing account state information and trading pair state information, the state tree comprises an account branch tree and a trading pair branch tree, leaf nodes of the account branch tree correspond to user accounts one by one, and leaf nodes of the trading pair branch tree correspond to trading pair accounts one by one; the method comprises the following steps:
acquiring related transactions by using the block link points;
and after the transaction is executed, acquiring the account and the transaction pair involved in the transaction, and updating the account state and the transaction pair state according to the transaction content.
2. The storage method for a decentralized exchange according to claim 1, wherein said state tree is a multi-way tree.
3. The storage method for a decentralized exchange according to claim 1, wherein said state tree is stored under a chain.
4. The method of claim 3, wherein the account status information includes status data for each type of Token in the account, and the transaction pair status information includes status data for two types of tokens for the transaction pair.
5. The storage method for the decentralized exchange according to claim 1, wherein when the transaction is a transfer transaction, the account information related to the transaction and the Token type information related to the transaction are obtained, and the account status information of the account related to the transaction in the status tree, in particular, the status information of the Token related to the transaction is updated.
6. The storage method for the decentralized trading exchange according to claim 1, wherein when the trade is the trade with increased liquidity, the account information, the trade pair information and the Token type information related to the trade are acquired, the account state information of the account related to the trade and the trade pair information related to the trade in the state tree are updated, and in particular, the account related to the trade and the Token type state information related to the trade in the trade pair are updated.
7. A computer device, characterized by one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-6.
8. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-6.
CN202110627643.9A 2021-06-04 2021-06-04 Storage method, equipment and storage medium for decentralized exchange Pending CN113220697A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110627643.9A CN113220697A (en) 2021-06-04 2021-06-04 Storage method, equipment and storage medium for decentralized exchange

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110627643.9A CN113220697A (en) 2021-06-04 2021-06-04 Storage method, equipment and storage medium for decentralized exchange

Publications (1)

Publication Number Publication Date
CN113220697A true CN113220697A (en) 2021-08-06

Family

ID=77082929

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110627643.9A Pending CN113220697A (en) 2021-06-04 2021-06-04 Storage method, equipment and storage medium for decentralized exchange

Country Status (1)

Country Link
CN (1) CN113220697A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112884575A (en) * 2020-10-18 2021-06-01 张大成 Contract transaction system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112884575A (en) * 2020-10-18 2021-06-01 张大成 Contract transaction system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
金色财经: "ZeroSwap:基于ZK-Rollup的DEX", 《HTTPS://CJ.SINA.COM.CN/ARTICLES/VIEW/6311913111/178382697020010SRW》 *

Similar Documents

Publication Publication Date Title
Duffie et al. Risk and valuation of collateralized debt obligations
US7062459B1 (en) Digital computer system and methods for managing a synthetic index fund
US6012046A (en) Crossing network utilizing satisfaction density profile with price discovery features
US7406443B1 (en) Method and system for multi-dimensional trading
US6098051A (en) Crossing network utilizing satisfaction density profile
US20190108588A1 (en) Computer-implemented methods and computer systems for an electronic financial platform
Wang Automated market makers for decentralized finance (defi)
Hakenes et al. Exploiting the financial wisdom of the crowd--Crowdfunding as a tool to aggregate vague information
WO2002001473A1 (en) Securities trade state tracking method and apparatus
US20080065522A1 (en) Low volatility asset allocation strategy for income and method
US11972485B2 (en) Computer implemented method for compiling a portfolio of assets
WO2010132840A1 (en) Systems, methods and computer program products for routing electronic trade orders for execution
US20080091622A1 (en) Index and Fund Based on Investment Time Horizon
Liu et al. Trade, finance and international currency
Lee et al. Screening, market signalling, and capital structure theory
JP2018067184A (en) Service provision system for providing service in cooperation with financial asset management system
US20140279351A1 (en) Repo etf system, and method
CN113220697A (en) Storage method, equipment and storage medium for decentralized exchange
Schmitz Carl Menger’s ‘Money’and the current neoclassical models of money
CN113220696A (en) Storage method, equipment and storage medium for decentralized exchange
Mahoney Market microstructure and market efficiency
CN113283889B (en) Decentralized exchange system, trading method, equipment and storage medium
CN113901112A (en) Data processing method and device, computer equipment and storage medium
US20140330693A1 (en) Systems and methods for auctioning asset backed securities
JP2024041602A (en) Information processing device, information processing method and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210806