Unit ID
hlaFzc487mdJVfTKGOvm7nLB528Ao4OxhxCu3ZejC3c=
Received
23.10.2019 07:07:31
Confirmation delay (full node)
3 minutes 34 seconds
Confirmation delay (light node)
6 minutes 41 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $provider = "HFNBIQTUNVMRM7PDP6NT2QRKLR62FOGR" ; $processor = "Z5OZYHRGUSNIHUVBQIAMV7XQNDZKPQKE" ; $fee = var[ "fee" ] otherwise 21000 ; // Obot by [email protected] // Get paid for doing complex computation on your computer or on your own, think Lambda function for Obyte // The perfect function is one that takes little input data or a link to a big data set, then do complex or private computation // real world examples are science data analysis like SETI or WCG // usage: // 1) function caller calls this AA with { "args" : '<value or json>' } and pays processing fee to get { "job" : <job number> } // 2) processor computes and send back to this AA { "job" : <job number> , "result" : <value or json> } // 3) provider only gets the processing fee when the result is sent back to caller by this AA // 4) result verification is up to the function caller, perhaps using simple technique like compare results from multiple Obots // setup: // set $provider address and fee above // the provider runs a headless wallet $processor address which listens for jobs from this AA // // For this array sorting Obot: // caller sends { "args" : "[ 3 , 4 , 1 , 2 ]" } with 21000 bytes and gets response { "job" : 1 } // wait for result { "job" : 1 , "result" : "[ 1 , 2 , 3 , 4 ]" } as a data payload ( trigger data for an AA ) // and as a response ( for another headless wallet ) $txfee = 1000 ; }", "messages": { "cases": [ { "if": "{ trigger.address == $provider AND trigger.data.fee }", "messages": [ { "app": "state", "state": "{ var[ "fee" ] = trigger.data.fee ; }" } ] }, { "if": "{ trigger.address == $processor AND trigger.data.job AND trigger.data.result }", "init": "{ $job = trigger.data.job || "" ; }", "messages": [ { "app": "data", "payload": { "job": "{ $job }", "result": "{ trigger.data.result }", "round": "{ var[ "round_" || $job ] }" } }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $provider }", "amount": "{ var[ $job ] }" }, { "address": "{ var[ "caller_" || $job ] }", "amount": "{ $txfee }" } ] } }, { "app": "state", "state": "{ if( ! var[ $job ] ) bounce( "there is no such job " || $job ) ; // clear job var[ $job ] = false ; var[ "caller_" || $job ] = false ; var[ "round_" || $job ] = false ; // duplicate payload as response response[ "job" ] = $job ; response[ "result" ] = trigger.data.result ; response[ "round" ] = var[ "round_" || $job ] ; }" } ] }, { "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $processor }", "amount": 10000 } ] } }, { "app": "state", "state": "{ if( trigger.output[[asset=base]] < $fee ) bounce( "a processor requires fee of " || $fee ) ; var[ "job" ] += 1 ; $newjob = var[ "job" ] || "" ; var[ $newjob ] = trigger.output[[asset=base]] - ( 3 * $txfee ) ; // save current fee var[ "caller_" || $newjob ] = trigger.address ; // store caller to send result later var[ "round_" || $newjob ] = trigger.data.round ; // store round from obotic // send job to listening Obot headless wallet response[ "job" ] = $newjob ; //response[ "args" ] = "[ 3 , 4 , 1 , 2 ]" ; // example response[ "args" ] = trigger.data.args ; // possible to have no args response[ "round" ] = trigger.data.round ; // obotic specific }" } ] } ] } } ]
Technical information
Fees:
3,699 bytes
(353 headers, 3346 payload)
Level:1116876
Witnessed level:1116869
Main chain index:1115635
Latest included mc index:1115634
Status:stable/confirmed/final