MetaLeX continues to innovate in the realm of cybernetic law with the introduction of the "Ricardian Tripler," a new hybrid code/law primitive designed to facilitate the creation, signing, deployment and performance of secure, transparent, and automated agreements on Ethereum—simply by signing a blockchain transaction straight from your wallet.
Ricardian Triplers deploy legal contract/smart contract dyads to enable onchain signing, shared legal/tech parameters and smart-contract-mediated performance of legal obliagtions--essentially, they provide end-to-end onchain legal deal/transaction lifecycle management. Our first Ricardian Tripler is designed around our Cybernetic Token Exchange (CyTE) app for peer-to-peer OTC token swaps with legal agreements: https://app.metalex.tech/lexscrow.
Ricardian Triplers bypass the need for cumbersome, centralized legaltech solutions like ContractExpress for 'document generation' and DocuSign for graphical PDF signatures. Instead, Ricardian Triplers allow the entire legal agreement lifecycle (including persistent storage of the agreement’s authoritative record) to be managed onchain. This means, for example, that a BORG can easily enter into a legal grant agreement with a grant recipient directly on our app with nothing other than their crypto wallets. And unlike with centralized legaltech SaaS companies, there is no ongoing dependence on MetaLeX as a company beyond the mere convenience features offered by our web app.
More importantly, Ricardian Triplers deploy smart contracts that enforce the terms of a legal agreement in the same step that the agreement is signed. Because of this, the legal terms are guaranteed to match/mirror the smart contract parameters--a seamless pairing of legal agreements with smart contracts that can execute on the agreement's terms and conditions that can unlock a new wave of onchain dealmaking that combines the best features of TradFi and DeFi.
Understanding Ricardian Triples
The “Ricardian triple” is a term coined by Clack, Bakshi, and Braine as an extension of Ian Grigg's pioneering “Ricardian contract” concept to the on-chain smart contract environment. A Ricardian triple, in the smart-contract context, consists of three components:
Code: This is the smart contract itself—i.e., a specific executable bytecode deployed to a specific blockchain address. It automates the performance of certain parts of the underlying legal contract.
Legal Agreement Text: This is what is more typically thought of as a traditional legal contract. This should contain both: (a) an expression of the non-operational aspects of the legal agreement (e.g., subjective standards of performance measurement such as “commercially reasonable efforts” or “Material Adverse Effect”); and (b) some reference to the smart contract as the preferred (or exclusive) vehicle for performing some or all aspects of the legal agreement. Importantly, in the Ricardian Tripler, this is a form contract text—think of other classic form contracts like ‘The Y-Combinator SAFE’—that can be completely standard and never needs to change.
Parameters: Parameters represent the results of negotiations on the level of a concrete, binding agreement—they give content to the code and legal contract text’s otherwise empty variables. This is just like how in Y-Combinator’s SAFE, the “Purchase Price”, “Valuation Cap,” and party names need to be filled in by the parties to turn the text into an actual legal agreement, except if there were a Ricardian Tripler for a SAFE, then those same parameters would also feed into smart contract variables.
It’s important to note that Ricardian triples do not treat smart contracts as themselves being legal agreements—this is a common misconception. Rather, the smart contract component of a Ricardian triple is just a piece of autonomous, trust-minimized code that helps perform and enforce the related legal agreement expressed in the combination of legal prose with the selected parameters. The magic part is entering into the legal agreement solely onchain and automatically sharing parameters between both the legal contract text and the smart contract; in this way, the smart contract is guaranteed to match the legal agreement.
Example: Ricardian Tripler for LeXscroW Token OTC
Our first implementation of the Ricardian Tripler is designed to work with a double-token LeXscroW smart contract—enabling a cybernetic law approach to closing a peer-to-peer token OTC trade tied to a legal agreement. This involves a legal contract text agreeing to the token swap terms and a LeXscroW ‘double-token’ non-custodial smart contract where each party deposits the to-be-swapped tokens and which closes the trade automatically when the right conditions are satisfied. When a Tripler is simultaneously deployed with the corresponding LeXscroW, the LeXscroW’s execution is immutably contingent upon both parties signing the Tripler onchain. In other words, the escrowed token swap cannot occur unless both parties have signed the legal agreement. You can find this implemented in the MetaLeX Cybernetic Token Exchanger (CyTE) web app here: https://app.metalex.tech/lexscrow
Because the legal contract text and the smart contact share many of the same variables and parameters, this is a perfect fit for a Ricardian Tripler. In this case, the shared variables/parameters are:
The two parties’ respective blockchain addresses.
The addresses and amounts of the tokens being traded.
Expiration time (essentially the ‘long-stop date’ or ‘drop-dead date’ in the legal agreement).
Any encoded conditions to execution (essentially the closing conditions in the legal agreement).
The Ricardian Tripler enables the parties to simultaneously configure the legal contract text and the associated smart contract with all the same parameters, deploy the smart contract, sign the text, and enter into a legal agreement expressed by the combination of the text, smart contract, parameters, and signatures, all by signing from their blockchain wallets. Although this sounds complicated in theory, in reality, it is much simpler and faster than the contract process flow of traditional legal agreement signature tools like Docusign, which require customizing a legal text and obtaining graphical signatures to the text each time by switching back and forth between a web2 app and email. With a Ricardian Tripler, no graphical signatures or word-processing are required, and all the needed data is registered on-chain rather than relying on the centralized backend of a corporate service provider. And unlike those corporate solutions, the Ricardian tripler provides a trust-minimized performance guarantee through the associated LeXscroW smart contract that is deployed as part of the process of entering into the agreement via the Ricardian Tripler. Because the parameters for both the legal agreement and the smart contract in a single step, legalese and code are guaranteed to ‘mirror’ one another–reducing the chance of discrepancies from separating the law and code workstreams.
Let’s break down the specific smart contract architecture of a Ricardian Tripler in this context.
RicardianTriplerDoubleTokenLexscrow: Structuring Agreements
The RicardianTriplerDoubleTokenLexscrow smart contract represents the digital and legal agreement components of the Ricardian triple, customized to a token OTC swap use-case designed to work with LeXscroW. It encapsulates all necessary details in a structured format, serving as both a machine-readable contract and a reference to the human-readable legal document.
Key Features:
Legal Agreement URI: Contains the IPFS hash of the template legal prose—in this case, the official MetaLeX Double Token LeXscroW Agreement.
Parameters: Stores comprehensive information about the agreement, including party details, escrowed assets, legal terms, governing law, and dispute resolution method.
Versioning: Ensures compatibility and traceability by maintaining version control.
This contract serves as a detailed and immutable record of the agreement, ensuring that all terms are clearly defined and accessible.
Agreement Factory: Facilitating Agreement Lifecycle
The AgreementV1Factory contract manages the creation and confirmation of agreements, integrating the machine-readable contract with the human-readable document and digital signatures to form a Ricardian contract, as well as deploying the associated escrow smart contract that enforces the terms of the legal agreement.
Key Features:
Propose Agreement: Enables a party to propose a new escrow agreement using the proposeDoubleTokenLexscrowAgreement function, which deploys a RicardianTriplerDoubleTokenLexscrow contract.
Deploy and Propose Simultaneously: The deployLexscrowAndProposeDoubleTokenLexscrowAgreement function allows deploying a DoubleTokenLexscrow contract and proposing a new agreement in one transaction, ensuring the parameters are synchronized.
Confirm and Adopt Agreement: Allows the second party to confirm the agreement, recording its adoption in the registry via the confirmAndAdoptDoubleTokenLexscrowAgreement function and updating the LeXscroW’s tripler signature condition to execution.
Validate Account: Verifies that the parties have signed the agreement details using the validateAccount function, leveraging the isSignatureValid function from the SignatureValidator contract.
This factory contract streamlines the agreement process, ensuring that both parties can efficiently propose, confirm, and adopt agreements, embodying the Ricardian triple's principles.
Registry: Recording and Managing Agreements
The DoubleTokenLexscrowRegistry contract acts as the official ledger for all adoptions of the standard MetaLeX Double Token LeXscroW Agreement. It records the details of each adoption, manages the list of approved factories, and ensures that the entire process is overseen by an admin. This smart contract also ensures the integrity and authenticity of agreements by verifying that the relevant legal agreement has been signed by the parties, enabling compliance with various e-signature laws by creating a secure electronic record of the parties’ mutual assent.
Key Features:
Record Adoption: Logs the adoption of agreements by the involved parties using the recordAdoption function.
Enable/Disable Factories: Manages the list of approved factories using the enableFactory and disableFactory functions.
Admin Management: Provides mechanisms for changing the admin in a secure manner, with functions like updateAdmin and acceptAdminRole.
This registry ensures that all agreements are transparently recorded and managed, providing an authoritative source of truth. Because of the registry, all the agreements are onchain and hence public. This enables composability for third-party legaltech UIs as well as giving the parties assurance their agreement details are always available onchain (without reliance on MetaLeX as a vendor), though at the cost of privacy. We anticipate making more private arrangements available as the project evolves.
Signature Validator: Ensuring Legal Enforceability
The SignatureValidator contract verifies that the legal agreement has been cryptographically signed. .
Key Features:
Recover Signer: Recovers the address that created a given signature.
Validate EOA Signature: Checks if an Externally Owned Account (EOA) signed a specific hash.
Validate Contract Signature: Verifies if a contract signed a specific hash using ERC1271.
Is Signature Valid: Combines the above functionalities to validate signatures from both EOAs and contracts.
This validation process ensures that all parties involved in the agreement are authenticated.
How They Work Together:
Agreement Proposal: A party proposes a new agreement using the proposeDoubleTokenLexscrowAgreement function in the AgreementV1Factory contract. The proposed agreement is stored in a new RicardianTriplerDoubleTokenLexscrow contract, and the pending agreement is recorded in the AgreementV1Factory.
Agreement Confirmation: The other party confirms the proposed agreement using the confirmAndAdoptDoubleTokenLexscrowAgreement function in the AgreementV1Factory (which must use the same parameters as the function call in Step #1 as well as referencing the address of the party who called the function and the address of the LeXscroW contract that was created from that call). Upon confirmation, the agreement's adoption is recorded in the DoubleTokenLexscrowRegistry.
Signature Validation: The validateAccount function in the AgreementV1Factory can be used to verify that the parties involved have signed the agreement details. This leverages the isSignatureValid function from the SignatureValidator contract.
Registry Management: The DoubleTokenLexscrowRegistry contract ensures that only approved factories can record adoptions and that the lifecycle of these factories is managed by an admin. The admin cannot, nor can any other party, affect or delete agreements that have been recorded in the registry.
In summary, these contracts together provide a robust system for proposing, confirming, and recording double token escrow agreements, ensuring that all parties' signatures are validated and the process is properly managed and recorded in a registry.
Conclusion
The Ricardian Tripler represents a significant advancement in cybernetic law, separating the practice of law from third-party middlemen, combining advanced digital signature validation, structured agreement management, and transparent recording into a cohesive system. By leveraging the power of smart contracts, MetaLeX has created a new legal primitive that enhances trust, efficiency, and security in blockchain-based agreements, including immutably codifying the underlying deal’s execution on the mutual signature of the parties. This innovation not only simplifies the process of creating and managing legal agreements but also paves the way for more complex and automated legal frameworks in the future. By embodying the principles of Ricardian triples, the Ricardian Tripler offers a modern, blockchain-based solution that ensures legal agreements are both human-readable and machine-executable, with verifiable digital signatures confirming the parties' consent.
Links
MetaLeX Cybernetic Token Exchange App, using Ricardian Tripler: https://app.metalex.tech/lexscrow
Ricardian Tripler Code:
https://github.com/MetaLex-Tech/RicardianTriplerDoubleTokenLeXscroW/
Cybernetic Token Exchange Agreement:
https://ipfs.io/ipfs/bafybeiestvaq6yfz4kuskaywacoug4i75vfrsmpgq2fjbdhfv5g53emrlu
Credits
The concept of Ricardian Triples was pioneered by the work of @ian_fc and Clack/Bakshi/Braine.
The MetaLeX Ricardian Tripler was inspired in part by @RMacwha's and @lex_node's smart contract registry approach to the SEAL Org Whitehat Safe Harbor Agreement
The Ricardian Tripler for CyTEA and other applications was authored by