Amendment Idea: On-Chain Multisign #385
mvadari
started this conversation in
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:
TransactionSaved
ledger objectTransactionSave
transactionTransactionSavedCancel
transactionIt 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.
TransactionSave
transaction with that transaction included.TransactionSave
transaction.TransactionSave
transaction.1.2.2.
Batch
Spec: 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.
Batch
transaction for the proposed token swap. The two inner transactions are basic payments:TransactionSave
transaction.TransactionSaved
ledger object and signs it as aBatchSigner
.TransactionSave
transaction.TransactionSave
transaction.Payment
transaction himself.1.2.3.
LoanSet
Spec: XLS-66
Broderick the loan broker and Boromir the borrower want to create a loan from Broderick's vault to Boromir.
LoanSet
transaction, filling out all the relevant fields.TransactionSave
transaction.TransactionSaved
ledger object and signs it as aCounterparty
.TransactionSave
transaction.TransactionSave
transaction.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.
TransactionSave
transaction.TransactionSaved
ledger object and signs it as aSponsor
.TransactionSave
transaction.TransactionSave
transaction.2. On-Ledger Object:
TransactionSaved
2.1. Fields
LedgerIndex
string
Hash256
LedgerEntryType
TransactionSaved
string
UInt16
TransactionSaved
).Owner
string
AccountID
SignerListID
string
UInt32
SignerListID
used 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.Transaction
object
STTx
AuthAccounts
array
STArray
Expiration
number
UInt32
OwnerNode
string
UInt64
PreviousTxnID
string
Hash256
PreviousTxnLgrSeq
number
UInt32
2.1.1.
Transaction
The
Transaction
must be unsigned, but all other relevant fields must be included.2.1.2.
AuthAccounts
This field is an array of objects with the following fields:
Account
string
AccountID
Flags
number
UInt32
2.1.2.1. Flags
The
Flags
field indicates what type of signer this is.aafAccountSigner
0x00000001
Account
submitting the transaction is the account sending the transaction.aafMultiSignSigner
0x00000002
Account
submitting the transaction is a multi-signer.aafSponsorSigner
0x00000004
Account
submitting the transaction is the sponsor for that transaction.aafLoanCounterpartySigner
0x00000008
Account
submitting the transaction is the loan counterparty for that transaction.2.2. Object ID
The key of the
TransactionSaved
object is the result ofSHA512-Half
of the following values concatenated in order:TransactionSaved
space 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:
Expiration
fieldLastLedgerSequence
in 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
Transaction
must be minimally valid (it must pass preflight checks)Expiration
must be in the futureTransaction.LastLedgerSequence
must be in the future, if it is providedSignerListID
must be0
, if included (only for multisign)2.7. RPC Name
The
snake_case
form of the ledger object name issaved_txn
.3. Transaction:
TransactionSave
This transaction either creates a new
TransactionSaved
or updates an existing one (with the same transaction hash).3.1. Fields
TransactionType
string
UInt16
TransactionSave
).Account
string
AccountID
Transaction
object
STTx
Expiration
number
UInt32
3.1.1.
Account
Any account can submit a
TransactionSave
transaction, 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 createdTransactionSaved
ledger object, if one is created.3.1.2.
Transaction
The
Transaction
must be unsigned, but all other relevant fields must be included.3.1.3.
Expiration
This is the time that the multisig should expire.
3.2. Flags
The flags will be mostly used to indicate who is signing the transaction.
tfTransferReserve
0x00010000
Owner
should shift to thetx.Account
from the currentTransactionSaved.Owner
. This flag is only valid if there is already aTransactionSaved
object.tfAccountSigner
0x00020000
Account
submitting the transaction is the account sending the transaction.tfMultiSignSigner
0x00040000
Account
submitting the transaction is a multi-signer.tfSponsorSigner
0x00080000
Account
submitting the transaction is the sponsor for that transaction.tfLoanCounterpartySigner
0x00100000
Account
submitting the transaction is the loan counterparty for that transaction.3.3. Failure Conditions
RegularKey
).TransactionSaved
object.Transaction
already has all the required signatures.Loan
field in XLS-66)Expiration
orTransaction.LastLedgerSequence
has passed alreadyFlags
) is invalid in some way (e.g.tfLoanCounterpartySigner
is enabled but it is not aLoanSet
transaction, ortfSponsorSigner
is enabled but the signer is not the sponsor)3.4. State Changes
If the
TransactionSaved
object doesn't already exist for this transaction:TransactionSaved
ledger object is created. The sender of the firstTransactionSave
transaction bears the reserve.If the transaction is "finished" (i.e. has all the necessary "signatures"):
TransactionSaved
ledger object is deleted.Batch
inner transactions).If neither above case is true:
TransactionSaved
ledger object is updated to include the new signer's information.tx.Expiration
is 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.tfTransferReserve
is enabled on the transaction, theOwner
will be updated to betx.Account
.If the signer list has changed since the last
TransactionSave
transaction was submitted:4. Transaction:
TransactionSavedCancel
There may be times when a
TransactionSaved
object 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:
TransactionSaved
ledger object may submit this transaction at any time, if they want the reserve back. If this happens, ???TransactionSaved
ledger object after theTransaction.LastLedgerSequence
ledger index or theExpiration
has passed.4.1. Fields
TransactionType
string
UInt16
TransactionSave
).Account
string
AccountID
TransactionSaved
object.Flags
number
UInt32
TransactionSavedID
string
Hash256
TransactionSaved
object to delete.4.2. Flags
tfDeleteSignature
0x00010000
AuthAccounts
instead.4.3. Failure Conditions
TransactionSaved
object doesn't exist.Before the
TransactionSaved.Expiration
/TransactionSaved.Transaction.LastLedgerSequence
has passed:tx.Account
is not any of [TransactionSaved.Transaction.Account
,TransactionSaved.Transaction.Delegate
,TransactionSaved.Owner
] or a signer on the transaction4.4. State Changes
The
TransactionSaved
object is deleted.5. All Transactions
No change to functionality, only behavior.
If a transaction is submitted that has an existing
TransactionSave
object 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
TransactionSave
since it submits a transaction? Or is the n transactions that were gathered enough?TransactionSave
or should there be a separateSend
transaction?Appendix
Appendix A: FAQ
A.1: What happens if the signer list changes part-way through collecting all the signatures?
The first time a
TransactionSave
transaction is submitted after the change in signatures for that account, the list of "signatures" stored in theTransactionSaved
ledger 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
TransactionSave
transaction 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
SignerListID
is specified in the ledger object, to future-proof the design. If and when XLS-49 is implemented, aSignerListID
field 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