2 Thresholds and recovery
source | link

You can do this, but you'll have to create one additional account that supports the process (you can merge it with your account later so it shouldn't be a big problem). Let's say the accounts are as follows:

  • D - your account (Derek)
  • U - user's account
  • S - support account

Then the process looks like this:

  1. You send 800 exampleAsset to U. They can spend it right away.
  2. You generate a new key pair (you control the keys) and create account S.
  3. From account S, you have to create a trust line to your exampleAsset.
  4. You send 200 exampleAsset to S (again, you control the keys so user can't spend the funds).
  5. Now, things start getting interesting:
    1. You create a transaction with the following parameters:
      • Sequence number = Current sequence + 2
      • minTime equal to the time when you want the funds to be released to U
      • Operations:
        • Payment: 200 exampleAsset to U
        • Change Trust: remove exampleAsset trust line
        • Account Merge: merge with D
    2. Then you calculate the hash of the transaction from the previous point and add it as a signer (Pre-authorized Transaction) of account S with weight equal 1 and change master weight to 0. This means that no other transaction will be allowed on this account ever - the network will only accept the transaction from the previous point.

After configuring the account S you can pubish the transaction from 5.1. When the time comes to release the funds anyone (you/your users/bot/other people) can submit this transaction to the network and release the funds.

There are two possible ways for the owner of account U to make this transaction fail - he/she can remove the trust line or their account. You may want to create another transaction: recovery transaction, that will set master weight back to 1 so you can move the funds back to yourself (D).

You can do this, but you'll have to create one additional account that supports the process (you can merge it with your account later so it shouldn't be a big problem). Let's say the accounts are as follows:

  • D - your account (Derek)
  • U - user's account
  • S - support account

Then the process looks like this:

  1. You send 800 exampleAsset to U. They can spend it right away.
  2. You generate a new key pair (you control the keys) and create account S.
  3. From account S, you have to create a trust line to your exampleAsset.
  4. You send 200 exampleAsset to S (again, you control the keys so user can't spend the funds).
  5. Now, things start getting interesting:
    1. You create a transaction with the following parameters:
      • Sequence number = Current sequence + 2
      • minTime equal to the time when you want the funds to be released to U
      • Operations:
        • Payment: 200 exampleAsset to U
        • Change Trust: remove exampleAsset trust line
        • Account Merge: merge with D
    2. Then you calculate the hash of the transaction from the previous point and add it as a signer (Pre-authorized Transaction) of account S. This means that no other transaction will be allowed on this account ever - the network will only accept the transaction from the previous point.

After configuring the account S you can pubish the transaction from 5.1. When the time comes to release the funds anyone (you/your users/bot/other people) can submit this transaction to the network and release the funds.

You can do this, but you'll have to create one additional account that supports the process (you can merge it with your account later so it shouldn't be a big problem). Let's say the accounts are as follows:

  • D - your account (Derek)
  • U - user's account
  • S - support account

Then the process looks like this:

  1. You send 800 exampleAsset to U. They can spend it right away.
  2. You generate a new key pair (you control the keys) and create account S.
  3. From account S, you have to create a trust line to your exampleAsset.
  4. You send 200 exampleAsset to S (again, you control the keys so user can't spend the funds).
  5. Now, things start getting interesting:
    1. You create a transaction with the following parameters:
      • Sequence number = Current sequence + 2
      • minTime equal to the time when you want the funds to be released to U
      • Operations:
        • Payment: 200 exampleAsset to U
        • Change Trust: remove exampleAsset trust line
        • Account Merge: merge with D
    2. Then you calculate the hash of the transaction from the previous point and add it as a signer (Pre-authorized Transaction) of account S with weight equal 1 and change master weight to 0. This means that no other transaction will be allowed on this account ever - the network will only accept the transaction from the previous point.

After configuring the account S you can pubish the transaction from 5.1. When the time comes to release the funds anyone (you/your users/bot/other people) can submit this transaction to the network and release the funds.

There are two possible ways for the owner of account U to make this transaction fail - he/she can remove the trust line or their account. You may want to create another transaction: recovery transaction, that will set master weight back to 1 so you can move the funds back to yourself (D).

1
source | link

You can do this, but you'll have to create one additional account that supports the process (you can merge it with your account later so it shouldn't be a big problem). Let's say the accounts are as follows:

  • D - your account (Derek)
  • U - user's account
  • S - support account

Then the process looks like this:

  1. You send 800 exampleAsset to U. They can spend it right away.
  2. You generate a new key pair (you control the keys) and create account S.
  3. From account S, you have to create a trust line to your exampleAsset.
  4. You send 200 exampleAsset to S (again, you control the keys so user can't spend the funds).
  5. Now, things start getting interesting:
    1. You create a transaction with the following parameters:
      • Sequence number = Current sequence + 2
      • minTime equal to the time when you want the funds to be released to U
      • Operations:
        • Payment: 200 exampleAsset to U
        • Change Trust: remove exampleAsset trust line
        • Account Merge: merge with D
    2. Then you calculate the hash of the transaction from the previous point and add it as a signer (Pre-authorized Transaction) of account S. This means that no other transaction will be allowed on this account ever - the network will only accept the transaction from the previous point.

After configuring the account S you can pubish the transaction from 5.1. When the time comes to release the funds anyone (you/your users/bot/other people) can submit this transaction to the network and release the funds.