• General
  • Preauthorized transactions in Multisig

Does anyone know how pre-authorized transactions actually work in multisig?

9 days later

@dzham: This is what I could understand:

  1. You build the transaction
  2. 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"

    yulemata But what happens next?

    Can that transaction be submitted to the network? or is there anything else needed?

    Yes, it can be submitted to the network. No signatures needed, as it is already pre-authorized.

    @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?

        yulemata

        No idea. There's no magic here, the only thing you have to be careful about is to make sure that your sequence numbers are appropriate. I.e., the sequence number of the pre-authorized transactions needs to come after the transaction that adds it.

        sacarlson

        You don't need to sign anything when you submit the pre-authorized transaction.

        @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:

        1. First submit the transaction with the set option operation in a normal way, with sequence number N

        2. 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.

          9 months later

          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 ?