Amendment Idea: On-Chain Multisign #385
mvadari
started this conversation in
XLS Ideas (pre standard proposal)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
On-Chain Multisign
Abstract
The XRP Ledger already supports multisigning. However, it's rather difficult to use, and impossible to use in a completely decentralized manner in the current implementation. This is because the multi-signers need to have some method of off-chain coordination in order to construct their multi-signed transaction.
The same is true for multi-account Batch transactions, and other co-signed transactions like loan creation/sponsored fees and reserves.
There is a need for on-chain multisign. Some example usecases are:
1. Overview
This spec proposes:
TransactionSavedledger objectTransactionSavetransactionTransactionSavedCanceltransactionIt will require an amendment, tentatively titled
OnChainMultisign.1.1. Background: Multisigned/Co-signed Transactions
Note: some of these are still in the spec phase and there is no timeline for them to be developed.
1.2. Example Flows
1.2.1. Multi-Signing
Sigmund and Sigourney are siblings who co-own a house. They hate each other and do not want to communicate, but they have to pay the bills somehow. So they set up an XRP Ledger account to manage the finances of this house. They do not want to do any off-chain communication.
TransactionSavetransaction with that transaction included.TransactionSavetransaction.TransactionSavetransaction.1.2.2.
BatchSpec: XLS-56
Alice and Bob want to execute a trustless token swap. Alice has 100 USD and Bob has 100 XRP that they want to trade trustlessly.
Batchtransaction for the proposed token swap. The two inner transactions are basic payments:TransactionSavetransaction.TransactionSavedledger object and signs it as aBatchSigner.TransactionSavetransaction.TransactionSavetransaction.Paymenttransaction himself.1.2.3.
LoanSetSpec: XLS-66
Broderick the loan broker and Boromir the borrower want to create a loan from Broderick's vault to Boromir.
LoanSettransaction, filling out all the relevant fields.TransactionSavetransaction.TransactionSavedledger object and signs it as aCounterparty.TransactionSavetransaction.TransactionSavetransaction.1.2.4. Sponsoring Fees and Reserves
Spec: XLS-68
The sponsor, Spencer, wants to pay the transaction fee and/or reserve for the sponsee Alice's transaction.
TransactionSavetransaction.TransactionSavedledger object and signs it as aSponsor.TransactionSavetransaction.TransactionSavetransaction.2. On-Ledger Object:
TransactionSaved2.1. Fields
LedgerIndexstringHash256LedgerEntryTypeTransactionSavedstringUInt16TransactionSaved).OwnerstringAccountIDSignerListIDstringUInt32SignerListIDused for the transaction, if using multi-sign. This field doesn't serve much of a purpose right now, but enables future-proofing if anything like XLS-49 is implemented.TransactionobjectSTTxAuthAccountsarraySTArrayExpirationnumberUInt32OwnerNodestringUInt64PreviousTxnIDstringHash256PreviousTxnLgrSeqnumberUInt322.1.1.
TransactionThe
Transactionmust be unsigned, but all other relevant fields must be included.2.1.2.
AuthAccountsThis field is an array of objects with the following fields:
AccountstringAccountIDFlagsnumberUInt322.1.2.1. Flags
The
Flagsfield indicates what type of signer this is.aafAccountSigner0x00000001Accountsubmitting the transaction is the account sending the transaction.aafMultiSignSigner0x00000002Accountsubmitting the transaction is a multi-signer.aafSponsorSigner0x00000004Accountsubmitting the transaction is the sponsor for that transaction.aafLoanCounterpartySigner0x00000008Accountsubmitting the transaction is the loan counterparty for that transaction.2.2. Object ID
The key of the
TransactionSavedobject is the result ofSHA512-Halfof the following values concatenated in order:TransactionSavedspace key (defined during implementation)2.3. Ownership
This ledger object is owned by
Owner, who also bears the reserve for this object.2.4. Reserve
This object charges 1 reserve.
2.5. Deletion
This object is a deletion blocker.
Two possible expirations:
ExpirationfieldLastLedgerSequencein the transaction itselfBefore the transaction is expired, it may only be deleted by the
Account(orDelegate) in the transaction. After, it may be deleted by anyone.2.6. Invariant Checks
Transactionmust be minimally valid (it must pass preflight checks)Expirationmust be in the futureTransaction.LastLedgerSequencemust be in the future, if it is providedSignerListIDmust be0, if included (only for multisign)2.7. RPC Name
The
snake_caseform of the ledger object name issaved_txn.3. Transaction:
TransactionSaveThis transaction either creates a new
TransactionSavedor updates an existing one (with the same transaction hash).3.1. Fields
TransactionTypestringUInt16TransactionSave).AccountstringAccountIDTransactionobjectSTTxExpirationnumberUInt323.1.1.
AccountAny account can submit a
TransactionSavetransaction, as long as they are allowed to have their signature in that sub-transaction. However, this account will have to pay the reserve for the createdTransactionSavedledger object, if one is created.3.1.2.
TransactionThe
Transactionmust be unsigned, but all other relevant fields must be included.3.1.3.
ExpirationThis is the time that the multisig should expire.
3.2. Flags
The flags will be mostly used to indicate who is signing the transaction.
tfTransferReserve0x00010000Ownershould shift to thetx.Accountfrom the currentTransactionSaved.Owner. This flag is only valid if there is already aTransactionSavedobject.tfAccountSigner0x00020000Accountsubmitting the transaction is the account sending the transaction.tfMultiSignSigner0x00040000Accountsubmitting the transaction is a multi-signer.tfSponsorSigner0x00080000Accountsubmitting the transaction is the sponsor for that transaction.tfLoanCounterpartySigner0x00100000Accountsubmitting the transaction is the loan counterparty for that transaction.3.3. Failure Conditions
RegularKey).TransactionSavedobject.Transactionalready has all the required signatures.Loanfield in XLS-66)ExpirationorTransaction.LastLedgerSequencehas passed alreadyFlags) is invalid in some way (e.g.tfLoanCounterpartySigneris enabled but it is not aLoanSettransaction, ortfSponsorSigneris enabled but the signer is not the sponsor)3.4. State Changes
If the
TransactionSavedobject doesn't already exist for this transaction:TransactionSavedledger object is created. The sender of the firstTransactionSavetransaction bears the reserve.If the transaction is "finished" (i.e. has all the necessary "signatures"):
TransactionSavedledger object is deleted.Batchinner transactions).If neither above case is true:
TransactionSavedledger object is updated to include the new signer's information.tx.Expirationis earlier than the current expiration on the object (or if a current expiration doesn't exist), that field will also be updated to the provided value.tfTransferReserveis enabled on the transaction, theOwnerwill be updated to betx.Account.If the signer list has changed since the last
TransactionSavetransaction was submitted:4. Transaction:
TransactionSavedCancelThere may be times when a
TransactionSavedobject needs to be deleted - perhaps the transaction was incorrectly formatted, or there were multiple transactions up for debate amongst the signers, or the expiration has passed. There may also be times when an account wants to revoke its signature.There are two scenarios where this transaction may be sent:
TransactionSavedledger object may submit this transaction at any time, if they want the reserve back. If this happens, ???TransactionSavedledger object after theTransaction.LastLedgerSequenceledger index or theExpirationhas passed.4.1. Fields
TransactionTypestringUInt16TransactionSave).AccountstringAccountIDTransactionSavedobject.FlagsnumberUInt32TransactionSavedIDstringHash256TransactionSavedobject to delete.4.2. Flags
tfDeleteSignature0x00010000AuthAccountsinstead.4.3. Failure Conditions
TransactionSavedobject doesn't exist.Before the
TransactionSaved.Expiration/TransactionSaved.Transaction.LastLedgerSequencehas passed:tx.Accountis not any of [TransactionSaved.Transaction.Account,TransactionSaved.Transaction.Delegate,TransactionSaved.Owner] or a signer on the transaction4.4. State Changes
The
TransactionSavedobject is deleted.5. All Transactions
No change to functionality, only behavior.
If a transaction is submitted that has an existing
TransactionSaveobject associated with it, it will be deleted.6. Examples
7. Security
Signers are checked for validity. Also, the transaction is still submitted as it would be normally so it goes through the normal checks.
n+1: Open Questions
TransactionSavesince it submits a transaction? Or is the n transactions that were gathered enough?TransactionSaveor should there be a separateSendtransaction?Appendix
Appendix A: FAQ
A.1: What happens if the signer list changes part-way through collecting all the signatures?
The first time a
TransactionSavetransaction is submitted after the change in signatures for that account, the list of "signatures" stored in theTransactionSavedledger object will be updated to reflect the changes.A.2: How does sequence number coordination work?
Sequence numbers still have to be ordered properly. Every time a
TransactionSavetransaction is checked, the sequence number is checked for validity (it will only be checked to ensure it is not a past sequence number, as you may have several queued up). If the sequence number has passed, then the object is deleted, as it is no longer valid. This is because the transactions have to be signed with a given sequence number.This process can be greatly simplified with the use of a ticket.
A.3: How can this work in conjunction with XLS-49?
The
SignerListIDis specified in the ledger object, to future-proof the design. If and when XLS-49 is implemented, aSignerListIDfield can be added to the transaction as well. If it is omitted in the transaction, it is assumed to be equal to0, the global signer list value.This field is needed in case of the edge case where an account is listed on both the global signer list and a permission-specific list.
Noting an edge case for the future in the event that this amendment is implemented: what if an account submits the same transaction but with a different
SignerListID?Beta Was this translation helpful? Give feedback.
All reactions