Unit ID
dsqi7plSQIiERU6hKm3TJci2e5DDSG+oBKpDTITszUc=
Received
22.08.2019 09:15:25
Confirmation delay (full node)
3 minutes 23 seconds
Confirmation delay (light node)
5 minutes 50 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $aa_name = "SAAFE"; // SAAFE, Safe Autonomous Agent Forwarding Estate $aa_owner = "O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ"; // could withdraw the dust is calculable. // Reconstitute the public key by concataining the 2 given parts $puk = (trigger.data.puk1 AND trigger.data.puk2)? trigger.data.puk1||trigger.data.puk2 : false; // Reconstitute the signature by concataining the 2 given parts $signature = (trigger.data.s1 AND trigger.data.s2)? trigger.data.s1||trigger.data.s2 : false; // asset $asset = trigger.data.asset otherwise trigger.output[[asset!=base]].asset otherwise "base"; $asset_nice_name = ($asset == 'base')? 'bytes' : $asset; $drawer = $puk||'_'||$asset; // short names for state var. $dr= "drawer_"||$drawer; $am = $dr||"_amount"; $as = $dr||"_asset"; $pu = $dr||"_private_user"; }", "messages": { "cases": [ { "if": "{ $puk AND !($signature or trigger.data.ad) }", "messages": [ { "app": "state", "state": "{ var[$am] += trigger.output[[asset=$asset]].amount; var[$as] = $asset; if (trigger.data.private) var[$pu] = trigger.address; response['message'] = var[$am]||' '||$asset_nice_name||' are safe under the puk '||$puk; }" } ] }, { "if": "{ $puk AND $signature AND trigger.data.ad }", "init": "{ // checking if (var[$pu] and var[$pu] != trigger.address) bounce ("Not allowed to withdraw from this private drawer!"); if (!var[$as]) bounce ("puk doesn\'t exists with asset!"||$asset_nice_name); if (var["last_s_"||$puk] == $signature) bounce ("Cannot use 2 times the same signature in a row!"); if (!is_valid_sig(trigger.data.ad, "-----BEGIN PUBLIC KEY-----"||$puk||"-----END PUBLIC KEY-----", $signature)) bounce ("Wrong signature!"); // balances $old_balance = var[$am]; $amount = trigger.data.am otherwise $old_balance; }", "messages": [ { "app": "payment", "payload": { "asset": "{$asset}", "outputs": [ { "address": "{trigger.data.ad}", "amount": "{$amount}" } ] } }, { "app": "state", "state": "{ $new_balance = $old_balance - $amount - 1000; response['message'] = $amount||' of the '||$old_balance||' '||$asset_nice_name||' withdrawn from '||$puk||' to '|| trigger.data.ad; if ($new_balance < 2000) var["drawer_"||$drawer] = false; else var["last_s_"||$puk] = $signature; }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce ("To store, set a 'puk1' and 'puk2' field to <the 2 half of the public key, for which you have the related private key> to safely store funds. To withdraw, set the same 'puk', as well as a 'ad' field to <the Obyte adresse where you want to receive the funds> and a 's1' and 's2' field to <the 2 half signature of a message containing the address 'a'>."); }" } ] } ] } } ]
Technical information
Fees:
3,190 bytes
(353 headers, 2837 payload)
Level:1017923
Witnessed level:1017914
Main chain index:1016738
Latest included mc index:1016737
Status:stable/confirmed/final