Quant 백서

Quant

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 7쪽 중 6쪽

distributed atomic transaction, on whether to commit or abort (roll back) the transaction [37]. In other terms, 2PC ensures either all the databases are updated or none of them, so that the databases remain synchronised. The algorithm is even able to achieve its goal, in many cases, of temporary system failure (involving either process, network node, communication, etc. failures). All computer nodes in the network interested in the transaction (in our example in Fig. 22, Node1 and Node2) need to express a commit or an abort to a coordinator, according to a time scheme. If the coordinator receives all commits from the nodes, it will validate the transaction, otherwise it will abort it. It’s called a two-phase commit, because a commit can be reached after two phases. In the first one (voting phase) all nodes express their intention to commit or abort. In the second phase (commit phase) the coordinator will commit the transaction only if there’s no abort or error messages. The problem here with cross-ledger transactions is we need to distribute the coordinator’s job. In the proposed scheme (Fig. 23) the role of the coordinator is made by the two entities (two clients, or client and server) that exchange an asset. They start the interaction posting a “ready” message that acts like a commit request on all blockchains involved. When they succeed to add a “ready” message on all the chains, they then confirm and commit the transaction on the chain where the transfer started. All messages “ready” have a hash pointer to the proposed message to prove the user’s intentions. The final commit message contains all the hash pointers of the “ready” messages. This simple scheme locks the coin until a successful transfer. One could build more complicated models only including the ability to abort in some of the involved blockchain (e.g. the one where the transaction has been proposed). Page of 3848 ! Fig. 22: Two phase commit scheme. ! Fig. 23: Two phase commit scheme on two ledgers. On rare occasions, the application may write a transaction to one of the blockchains involved and this transaction may be invalidated by the consensus mechanism by performing a fork. The ordering solution shown in Fig. 24 solves this issue by appending the last known Verification Block, common across the blockchains involved in the forked chain. The application then scans back across the blockchain re- appending any transactions invalidated by the fork. Both the standard ordering method, and the cross- ledger fork issue, are shown in the diagram of Fig. 24. We have named this solution as the Verification Block. Fig. 24: Verification Block Process. Page of 3948 2.4 Application Layer In this section, we’ll explore the Application Layer: the upper part of our reference architecture. In this domain, there are several isolated applications that have their business logic independent from the lower component. Applications have the chance to communicate with each other by putting messages on the Messaging Layer. If these messages are compliant with the filtering rules of the other application, they can Page of 4048 flow through the Filtering and Ordering Layer to the Application Layer. Applications also have the chance to implement communication mechanisms not using this scheme. This scheme allows anonymous users to send a message to the application if it’s compliant with its business logic. 2.4.1 Overledger Applications In the previous sections, we explored from a theoretic point of view, how to build an Overledger architecture by adding messages as meta information on different ledgers, giving them an order and making them part of a more complex application business logic. In this section we’ll describe the steps to perform a basic transaction, i.e. append a message in Overledger. We can start by providing a clear and formal description of what Overledger is, what its building blocks are, and how it can be used via the Blockchain Programming Interface (BPI). Overledger definition. Overledger can be described as a sorted list of messages which satisfy a set of unambiguous properties. A set of properties define the valid format of a message, how to build the fingerprint and other requirements dependant on the methods required. A transaction must contain the fingerprint of a valid message to be considered part of an Overledger application. The list of these messages defines what we call the Messaging Layer of Overledger. Another set of rules determines how to sort the valid messages in a sorted list we called the Ordering and Filtering Layer. A system using Overledger reacts to this sequence and can change its state. Any change in one of these sets of rules results in a different list of messages, or a different permutation. More systems, with different control logic, can share the same Overledger if they respect the same rules. Blockchain Programming Interface (BPI). Multi-ledger applications wanting to use Overledger will need to define two sets of (mandatory and optional) rules. These rules determine how a wire protocol will interact with the Overledger system and with other users/applications. A non-exhaustive list of rules includes: ●Accept messages that can be validated by specific schema; ●Accept messages only if they respect certain pattern sequences (e.g. in a 2PC we want to receive the “propose” message before the “ready” message); ●Accept messages only if their fingerprint (hash) has been appended on a particular set of ledgers; ●Accept messages only if their fingerprint has specific source and recipe addresses; and ●Accept messages only if their fingerprint is spending at least a certain amount of cryptocurrency. An application can define more complex messages, it can use any combination of them (e.g. different messages can have different validation schema, different rules on the transactions hosting their fingerprint). The rules can also involve other information, for example, the script or the contract they contain. In this respect, this schema is similar to the one used by systems which expose APIs. In fact, those systems, at the application level, publish a file and a library to interact with the system as it is an Abstract Data Type (ADT). Likewise, our set of rules describe how to interact with Overledger. We assume the approach is the same, having the API on the Application Layer and rules on the Messaging Layer, and are technology independent. We call our approach, BPI (Blockchain programming interface). A BPI is essentially a marked-up text that defines the specific Overledger rules an application must follow in order to add messages, or to read the output of a write, to the ledgers in question. The BPI should be automatically read by the clients that implement the required methods according to their technology. We’re now creating an Overledger Software Development Kit (SDK): a set of software development tools Page of 4148 that will allow applications to define the rules (BPI) without the need to address the low-level details regarding transactions and messages. Through the SDK, we’ll also enable additional methods, where appropriate, to interface with other lower level functions of the ledgers in question. After the final overview of Overledger, and the introduction to the Overledger BPI, we provide a simple example of a typical transaction journey. We describe the steps to be followed in order to append a valid message on Overledger. In this example, if a user (client) wants to append a specific message, it should follow the following rules: 1.The client reads the requirements for the message it wants to append; 2.The client builds a valid message M1 and calculates its fingerprint H1; 3.The client builds a valid transaction T1(inserting the fingerprint) and proposes it to the systems in charge of proposing transactions; 4.T1 is appended on a ledger accepted by the BPI; and 5.The client sends the complete message to the application and the transaction T1 that contains its fingerprint. Note that the rules in this example are interchangeable. 2.4.2 Application level responsibility In Sections 2.1 and 2.2 we discussed the different roles of the Messaging Layer and the Filtering and Ordering Layer. We explained those are logical layers, but we didn’t explain who’s in charge of implementing those features. Filtering messages requires a deep knowledge of all the different blockchains included in the Overledger application. For this reason, it would be convenient to build open source libraries helping the application developer to use a high-level function to interact with blockchains. Let’s take an example of a write operation for a client sending a message to a particular application (app_id=1): import bitcoin as btc import ethereum as eth import json import hashlib import requests # Message definition# jstring = {'app_id'=1, message'='Hello world', 'client'=1} msg = json.dumps(jstring, sort_keys=True) hash_function = hashlib.sha256() hash_function.update(msg) hash_message = hash_function.digest() r = requests.post(server_address, json=msg) Page of 4248 eth.add_msg_out_of_the_chain(hash_message) btc.add_msg_out_of_the_chain(hash_message) btc.add_msg_out_of_the_chain(hash_message, mode='OP_RETURN') In this example, the code takes all the responsibilities for all layers. The first lines are both related to messaging and filtering: the definition of a particular message format, the values of the particular message instance, the chosen hash function and the method of how the message is added to the ledger. The last two lines of code show the Bitcoin chain can allow a different way to add information to its ledger. In the last line, the optional parameter mode specifies which one must be used rather than the default option. This performs the post-operation send of the entire message through the network. OP_RETURN is a script opcode used to mark a Bitcoin transaction output as invalid. Since any outputs with OP_RETURN are provably un-spendable, OP_RETURN can be used for digital asset proof-of- ownership and other transaction-based business logics. The server is responsible for checking if the message is valid and, in this case, if the hash of that message is on the blockchains of interest, with the proper transaction parameters (addresses and coins). To check if the message is in the chain, the application needs to perform a scan of the newer blocks and react, when it finds the message. This can lead to solutions that need a timeout and complex protocol. If the server finds the hash message, it can react, because in the JSON file there’s all the information of the receiver. In this case, there’s the field “client” in the message equal to one. That number can refer to a client address or to a set of configurations, to allow the server to reply to it with this schema, adding messages on blockchains. Another design solution can assign the responsibility to check the hash to the client, that can scan the interested ledgers, until it finds the transaction and can prove by providing the transaction’s hash pointer (e.g. Merkle tree proof) to the server. In this case, the server can quickly check the lowest details and doesn’t need to pull all the interested chains to scan. In this last example, we introduce, in the import statement, a library “quant”, that takes the responsibility for tasks of the Filtering and Order Layer. The application loads the configuration file that can be hosted on the local storage, or can be downloaded every time, to guarantee consistency between the application upgrade and the client application. In this case, the developer needs to only focus on the business logic of the client. import quant.app_builder as q app = new q.client_application() #in conf.txt there are all the information #about the Filtering Layer app.set_configuration(./conf.txt) jstring = {'app_id'=1, message'='Hello world'} msg = json.dumps(jstring) app.sendmessage(msg) Page of 4348 3. Use Cases There are many uses for Overledger produced applications, all of which are far too numerous to list in this paper, but as an example, we’ve included one of the simplest. 3.1 CQRS-ES and Overledger Command Query Responsibility Segregation. CQRS (Command Query Responsibility Segregation) is an architecture pattern introduced by Greg Young [27]. This pattern uses different models for writing and reading the model. The writing model should manage the command operations that, following the CQS (Command Query Separation) vocabulary, can update the model and must not return a value. The reading operations should handle the query operations that mustn’t change the system state (no side-effects). In some domains this pattern can be useful for breaking down the complexity of a system, especially where reading operations and writing operations have different time scales. Fig. 25: CQRS Architecture Schema for Overledger. Overledger can be a good fit for this pattern implementation (see Fig. 25). We can use two or more different blockchains, some for appending commands and others for querying the status. This can be useful, not only because the application may have a different scale for reading and writing, but because different blockchains have different levels of security and different throughput. For example, it could make sense to use a faster blockchain to collect the commands, and a more secure (and probably lower speed) blockchain to store the valid transaction in the application logic; or use a different blockchain to show different types of aggregation according to the client’s needs (this blockchain could only store the client state or Verification Blocks). Overledger Event Sourcing (OES) is a pattern that builds the status of the system scanning all events that have changed it. When a new event happens, rather than updating the state of the system, events sourcing architecture appends it to the event stream. The state is calculating by replaying all the events. Since appending events is a single operation, OES is inherently atomic. The way the state is calculated has Page of 4448 many similarities with blockchain technology. In Fig. 26 events are appended to one blockchain and different domains of the applications retrieve those event data for different reasons. For example, one domain can be interested in storing data for ETL, one for optimising searches, and another for processing the event and streaming the output to another blockchain. ! Fig. 26: CQRS Architecture Schema for Overledger. The similarities between this pattern and the mode of operation of the blockchain makes its integration with Overledger natural. In the literature CQRS and Event Sourcing (ES) are often combined and used together (CQRS-ES), noting this is still applicable with Overledger. Communications. While email, in its current state, is a very effective medium, it does, however, have one flaw. The receiver of the email can refute the delivery of the communication. Even where controls, such as delivery/read receipts, are requested, these can be ignored by the recipient. Now if we were to use Overledger as a simple messaging solution we could produce the process flow in Figure 27. Page of 4548 4. Conclusion In the above paper, we propose the design of a new operating system able to increase interoperability between different DLT technologies. The Overledger operating system proposes an approach both to order and to manage the blockchain blocks forming part of the Overledger application. It does this so as to eliminate double spending problems, while maintaining the ability to react to situations where the DLT may become subject to a fork, as a result of not being part of the accepted consensus. We solve the above challenges by introducing both the BPI (Blockchain Programming Interface), and the Verification Block, as described above. These solutions, when coupled with a 2-Phase-Commit, can facilitate cross- ledger transactions, both at a transactional and a Messaging Layer. Finally, the paper describes that by leveraging features within the underlying functionality of the DLT's, these can be utilised to impose a CQRS architecture pattern. This can then be held and managed externally to interface not only across DLTs, but also to integrate with legacy systems and external data sources. Message Send Message Response Fig. 27: Simple Overledger Message Flow. ! Page of 4648 Bibliography 1.Satoshi Nakamoto. Bitcoin: A peer-to-peer electronic cash system. 2008. 2.Tomaso Aste, Paolo Tasca, and Tiziana Di Matteo. "Blockchain Technologies: The Foreseeable Impact on Society and Industry." Computer 50.9 (2017): 18-28. 3.Paolo Tasca, Digital Currencies: Principles, Trends, Opportunities, and Risks (September 7, 2015). Available at SSRN: https://ssrn.com/abstract=2657598 4.Birkhoff, Garrett. Lattice Theory. 25 (3rd Revised ed.). American Mathematical Society. 1940. 5.Luke Dashjr Mark Friedenbach Gregory Maxwell Andrew Miller Andrew Poelstra Jorge Timn Adam Back, Matt Corallo and Pieter Wuille. Enabling blockchain innovations with pegged sidechains. 2012. 6.Edward Felten Andrew Miller Steven Goldfeder Arvind Narayanan, Joseph Bonneau. Bitcoin and cryptocurrency technologies. 2015. 7.Ryan Shea Michael J. Freedman Princeton University Jude Nelson, Muneeb Ali and Blockstack Labs. Extending existing blockchains with virtualchain. 2017. 8.Jae Kwon and Ethan Buchman. Cosmos. a network of distributed ledgers. 9.Marshall Pease Leslie Lamport, Robert Shostak. The byzantine generals problem. 1982. 10.Jude Nelson Muneeb Ali, Ryan Shea and Michael J. Freedman. Blockstack: A new internet for decentralised applications. 2017. 11.Barbara Liskov Miguel Castro. Practical byzantine fault tolerance,laboratory for computer science, massachusetts institute of technology. 1999. 12.Pierre Karpman Ange Albertini Marc Stevens, Elie Bursztein and Yarik Markov. Aion: The third-generation blockchain network. 2017. 13.Pierre Karpman Ange Albertini Marc Stevens, Elie Bursztein and Yarik Markov. The first collision for full sha-1. 2017. 14.The Digital Asset Platform. Non-technical white paper. 2016.
 Manny Trillo. 15.Stefan Thomas and Evan Schwartz. A protocol for interledger payments. 2016. 16.Gavin Wood. Polkadot: Vision for a heterogeneous multi-chain framework. 2016. 17.Gavin Wood. Ethereum: A secure decentralised generalised transaction ledger. Yellow Paper. 18.Jae Kwon. Tendermint: Consensus without mining. 2014. 19.Matthew, Spoke and Nuco Engineering Team, Aion: The third-generation blockchain network, 2017 20.Paolo Tasca, Shaowen Liu, and Adam Hayes. The evolution of the bitcoin economy: extracting and analyzing the network of payment relationships. Forthcoming Journal of Risk Finance, 2018. 21.Aliprantis, Charalambos D; Burkinshaw, Owen. Principles of real analysis (Third ed.). Academic. 1998. 22.Campbell PJ. The origin of “Zorn's Lemma”. Historia Mathematica. 1978 Feb 1;5(1):77-89. 23.Bitcoin Wiki. 2018. OP_RETURN. [ONLINE] Available at https://en.bitcoin.it/wiki/OP_RETURN. [Accessed 13 January 2018]. 24.Ethereum Github. 2018. Ethereum Development Tutorial. [ONLINE] Available at https://github.com/ ethereum/wiki/wiki/Ethereum-Development-Tutorial. [Accessed 29 January 2018] 25.Ripple. 2018. Transactions Format. [ONLINE] Available at https://ripple.com/build/transactions/. [Accessed 29 January 2018]. 26.Davey, B.A.; Priestley, H. A., Introduction to Lattices and Order (2nd ed.), Cambridge University Press, 2002. 27.CQRS. 2018. Welcome to CQRS Info. [ONLINE] Available at https://cqrs.wordpress.com/2010/09/08/ welcome-to-cqrs-info/. [Accessed 29 January 2018] 28.Even, Shimon, Graph Algorithms (2nd ed.), Cambridge University Press, pp. 46–48, 2011. 29.Paolo Tasca, Thayabaran Thanabalasingham, Claudio J. Tessone. Taxonom
프로젝트로 돌아가기