Transfers view
UTXO view
Obyte.org
Unit Legend
- not on main chain, not stable
- main chain, not stable
- bad unit
- not on main chain, stable/confirmed/final
- main chain, stable/confirmed/final
- not on main chain, selected
- main chain, selected
Close
Close
Unit ID
+1vk1XPIrRtl49nhCbI4jPCTzTLD36u+HTJgDt83Z6E=
Received
05.09.2019 10:49:51
Confirmation delay (full node)
3 minutes 37 seconds
Confirmation delay (light node)
7 minutes 38 seconds
Authors
DPYEPM34AUBLZFLCJKKGSJ3R34373IUA
Children
/KCYppAUmUT2Myx+dQawrRT1uOe436fGlNAvtbPQ+4I=
Parents
Pkdasl/IAHbA28q4vgeXsMlkGFVQN5ZpKIM6u2NKMFQ=
Messages
Definition
Address:
5NPALPV5OKDVNSDG6YHCDE6JLGC4HAIP
Definition:
[ "autonomous agent", { "init": "{ $close_timeout = 300; $addressA = '2QHG44PZLJWD2H7C5ZIWH4NZZVB6QCC7'; $addressB = 'X55IWSNMHNDUIYKICDW3EOYAWHRUKANP'; $bFromA = (trigger.address == $addressA); $bFromB = (trigger.address == $addressB); $bFromParties = ($bFromA OR $bFromB); if ($bFromParties) $party = $bFromA ? 'A' : 'B'; }", "messages": { "cases": [ { "if": "{ $bFromParties AND trigger.output[[asset=base]] >= 1e5 }", "messages": [ { "app": "state", "state": "{ if (var['close_initiated_by']) bounce('already closing'); if (!var['period']) var['period'] = 1; $key = 'balagnce' || $party; var[$key] += trigger.output[[asset=base]]; response[$key] = var[$key]; }" } ] }, { "if": "{ $bFromParties AND trigger.data.close AND !var['close_initiated_by'] }", "messages": [ { "app": "state", "state": "{ $transferredFromMe = trigger.data.transferredFromMe otherwise 0; if ($transferredFromMe < 0) bounce('bad amount spent by me: ' || $transferredFromMe); if (trigger.data.sentByPeer){ if (trigger.data.sentByPeer.signed_message.channel != this_address) bounce('signed for another channel'); if (trigger.data.sentByPeer.signed_message.period != var['period']) bounce('signed for a different period of this channel'); if (!is_valid_signed_package(trigger.data.sentByPeer, $bFromB ? $addressA : $addressB)) bounce('invalid signature by peer'); $transferredFromPeer = trigger.data.sentByPeer.signed_message.amount_spent; if ($transferredFromPeer < 0) bounce('bad amount spent by peer: ' || $transferredFromPeer); } else $transferredFromPeer = 0; var['spentByA'] = $bFromA ? $transferredFromMe : $transferredFromPeer; var['spentByB'] = $bFromB ? $transferredFromMe : $transferredFromPeer; $finalBalanceA = var['balanceA'] - var['spentByA'] + var['spentByB']; $finalBalanceB = var['balanceB'] - var['spentByB'] + var['spentByA']; if ($finalBalanceA < 0 OR $finalBalanceB < 0) bounce('one of the balances would become negative'); var['close_initiated_by'] = $party; var['close_start_ts'] = timestamp; response['close_start_ts'] = timestamp; response['finalBalanceA'] = $finalBalanceA; response['finalBalanceB'] = $finalBalanceB; }" } ] }, { "if": "{ trigger.data.confirm AND var['close_initiated_by'] }", "init": "{ if (!($bFromParties AND var['close_initiated_by'] != $party OR timestamp > var['close_start_ts'] + $close_timeout)) bounce('too early'); $finalBalanceA = var['balanceA'] - var['spentByA'] + var['spentByB']; $finalBalanceB = var['balanceB'] - var['spentByB'] + var['spentByA']; }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addressA}", "amount": "{ $finalBalanceA < $finalBalanceB ? $finalBalanceA : '' }" }, { "address": "{$addressB}", "amount": "{ $finalBalanceA >= $finalBalanceB ? $finalBalanceB : '' }" } ] } }, { "app": "state", "state": "{ var['period'] += 1; var['close_initiated_by'] = false; var['close_start_ts'] = false; var['balanceA'] = false; var['balanceB'] = false; var['spentByA'] = false; var['spentByB'] = false; }" } ] }, { "if": "{ trigger.data.fraud_proof AND var['close_initiated_by'] AND trigger.data.sentByPeer }", "init": "{ $bInitiatedByA = (var['close_initiated_by'] == 'A'); if (trigger.data.sentByPeer.signed_message.channel != this_address) bounce('signed for another channel'); if (trigger.data.sentByPeer.signed_message.period != var['period']) bounce('signed for a different period of this channel'); if (!is_valid_signed_package(trigger.data.sentByPeer, $bInitiatedByA ? $addressA : $addressB)) bounce('invalid signature by peer'); $transferredFromPeer = trigger.data.sentByPeer.signed_message.amount_spent; if ($transferredFromPeer < 0) bounce('bad amount spent by peer: ' || $transferredFromPeer); $transferredFromPeerAsClaimedByPeer = var['spentBy' || ($bInitiatedByA ? 'A' : 'B')]; if ($transferredFromPeer <= $transferredFromPeerAsClaimedByPeer) bounce("the peer didn't lie in his favor"); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}" } ] } }, { "app": "state", "state": "{ var['period'] += 1; var['close_initiated_by'] = false; var['close_start_ts'] = false; var['balanceA'] = false; var['balanceB'] = false; var['spentByA'] = false; var['spentByB'] = false; }" } ] } ] } } ]
Witnesses
2FF7PSL7FYXVU5UIQHCVDTTPUOOG75GX
2GPBEZTAXKWEXMWCTGZALIZDNWS5B3V7
4H2AMKF6YO2IWJ5MYWJS3N7Y2YU2T4Z5
DFVODTYGTS3ILVOQ5MFKJIERH6LGKELP
ERMF7V2RLCPABMX5AMNGUQBAH4CD5TK4
F4KHJUCLJKY4JV7M5F754LAJX4EB7M4N
IOF6PTBDTLSTBS5NWHUSD7I2NHK3BQ2T
O4K4QILG6VPGTYLRAI2RGYRFJZ7N2Q2O
OPNUXBRSSQQGHKQNEPD2GLWQYEUY5XLD
PA4QK46276MJJD5DBOLIBMYKNNXMUVDP
RJDYXC4YQ4AZKFYTJVCR5GQJF5J6KPRI
WELOXP3EOA75JWNO6S5ZJHOO3EYFKPIR
Technical information
Fees:
4,830
bytes
(353 headers, 4477 payload)
Level:
1046959
Witnessed level:
1046952
Last ball unit:
pL8NGvY+gD+IcPayPq75JqOh4TA6hJ+4ngeUCDliGXQ=
Main chain index:
1045732
Latest included mc index:
1045731
Status:
stable/confirmed/final