Does anyone know how pre-authorized transactions actually work in multisig?
Preauthorized transactions in Multisig
Yes.
@dzham: This is what I could understand:
- You build the transaction
- You add the hash of the transaction as a signer
But what happens next?
Can that transaction be submitted to the network? or is there anything else needed?
Furthermore, I don't get what is mentioned in the Stellar doc:
"Signers of this type are automatically removed from the account when a matching transaction is properly applied. In case of error, or when matching transaction is never submitted, the signer remains and must be manually removed using the Set Options operation.
This type of signer is especially useful in escrow accounts. You can pre-authorize two different transactions. Both could have the same sequence number but different destinations. This means that only one of them can be executed"
@dzham thanks. I have tried but somehow I am doing something wrong. Below are the steps I executed in the Laboratory:
Goal: Send a authorize payment from one account to another
Steps:
Operation 1: Payment Operation
Source account: GCJPJU6TQS36VGWAOVA6PHZF3ZE6MPPUJ63Q4HRNFSDLMFJVVIT4LDB7
Destination: GAC5XK7KMWV6S2RBHHMIY2JOFN36IJJWGZB4R5GI2WSFPUTU46HJAKLP
Amount : 1333 XLM
After building the this transaction I get its hash: a2b1113033c2d8e1ce8efeaee59aba48ae6d72fd336aa3b16a6749fcde33fa62
Operation 2: Set Options:
Signer Type: Pre-athorized Transaction Hash
values:
- Transaction hash: a2b1113033c2d8e1ce8efeaee59aba48ae6d72fd336aa3b16a6749fcde33fa62
- weight: 1
I then get the Tx envelope and submit it to horizon.
Then I get an error with a "tx_bad_auth" code. See here: https://screencast.com/t/V7TuIc0ZY3
Is there anything I am doing wrong here?
In your steps I'm failing to see at any point you signing the envelope transaction. I would assume you submited the transaction before signing it? Or maybe you signed it with an unauthorized signature?
@dzham : Thanks for the comments. Indeed, you had it correct regarding the sequence number. In my example above I had submitted only 1 transaction with a batch operation (operation 1 and 2). However, based on what you said I got it working by:
First submit the transaction with the set option operation in a normal way, with sequence number N
Then submit the payment operation with sequence number N+1
The catch is that you need to get the N and N+1 in advance . That means:
1. Preparing the pre-authorized transaction with sequence N+1.
2. Then create the Set Options transactions with sequence N and send it to the network
3. Send pre-authorized transaction
One thing that i noticed though is that is you set the weight of the authorized transaction in the Set Options operation to 1 and don't change the weight of the master key (which initially is 1). After sending the Set Options transaction the master key weight gets a value of 0. Is this normal?
yulemata One thing that i noticed though is that is you set the weight of the authorized transaction in the Set Options operation to 1 and don't change the weight of the master key (which initially is 1). After sending the Set Options transaction the master key weight gets a value of 0. Is this normal?
I don't think it is, it's not something I remember encountering.
Is there any plan to make a pool (or decentralized mechanism) for pre-authorized transaction ? also for smart contract related transactions ? and also recurring payment transactions ?
Hi, I'm working on recurring payments, see discussion here: https://galactictalk.org/d/1466-smart-stellar-timed-payments/12
I also will provide an updated version beginning next year, maybe earlier. If you have questions let me know.