You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should define some set of "well-known" scripts which user could use to transfer assets between their accounts. Two of the simplest such scripts could be:
Pay to account ID (P2ID).
Pay to account ID with recall (P2IDR).
These scripts are described in detail below.
Pay to account ID
This script can be used when a note is intended to deposit all of its assets into a specific account. The pseudocode for this script looks as follows:
begin
assert(account.get_id() == note.inputs[0])
for a in note.assets
account.receive_asset(a)
end
end
The script assumes that a note comes with a single input which contains ID of the recipient's account.
Pay to account ID with recall
This script can be used when a note is intended to deposit all of its assets into a specific account within some period. If this time expires, another user (presumably the send of the note) will be able to claim all of the note's assets. The pseudocode for this script looks as follows:
begin
if chain.get_block_height() > note.inputs[0]
assert(account.get_id() == note.inputs[1] || account.get_id() == note.inputs[2])
else
assert(account.get_id() == note.inputs[1])
end
for a in note.assets
account.receive_asset(a)
end
end
The script assumes that a note comes with the following inputs:
input[0] contains block height after which the note can be reclaimed by the sender.
input[1] contains the recipient's account ID.
input[2] contains the sender's account ID.
Required procedures
These scripts require the following kernel procedures to exist:
Procedure
Description
Context
get account ID
Returns ID of the account in the current transaction.
account, note
get note assets
Returns all assets in the current note.
note
get note inputs
Returns all inputs for the current note
note
get block height
Returns current block height for the transaction.
note, account
They also assume that the recipient's and sender's accounts expose receive_assets procedure which can be used to deposit a single asset into the account's vault.
The text was updated successfully, but these errors were encountered:
We should define some set of "well-known" scripts which user could use to transfer assets between their accounts. Two of the simplest such scripts could be:
P2ID
).P2IDR
).These scripts are described in detail below.
Pay to account ID
This script can be used when a note is intended to deposit all of its assets into a specific account. The pseudocode for this script looks as follows:
The script assumes that a note comes with a single input which contains ID of the recipient's account.
Pay to account ID with recall
This script can be used when a note is intended to deposit all of its assets into a specific account within some period. If this time expires, another user (presumably the send of the note) will be able to claim all of the note's assets. The pseudocode for this script looks as follows:
The script assumes that a note comes with the following inputs:
input[0]
contains block height after which the note can be reclaimed by the sender.input[1]
contains the recipient's account ID.input[2]
contains the sender's account ID.Required procedures
These scripts require the following kernel procedures to exist:
They also assume that the recipient's and sender's accounts expose
receive_assets
procedure which can be used to deposit a single asset into the account's vault.The text was updated successfully, but these errors were encountered: