Atomic Transfers

Atomic Transfers
Atomic Transfers offer a Layer-1 secure way to simultaneously transfer a number of assets among a number of parties. Specifically, many transactions are grouped together and either all transactions are executed or none of them are. This feature can be used for use cases such as matching funding, debt settlement, decentralized exchanges, and complex trades.

Reply to this thread with questions and feedback related to this new functionality!

1 Like

Hi Liz, Couple of quick questions.

  1. Who pays for transaction gas when multiple transactions are combined?
  2. Will all of them have same transaction ID or seperate?
  3. How will this show in transaction explorer?

Thanks
Arun

Hi there,

  1. The individual transactions within the group each pay their respective fees (there is no gas in Algorand).
  2. They will each have separate transaction IDs, but each transaction will contain a field that references the group hash.

Here is an example of a group transaction where one account is sending 100 of asset ID 249 to the other account, and the other account is sending 1 algo in exchange. Note several things below. One is the fact that each transaction has its own fee paid for by the sender. Also note that each transaction has a grp field which indicates that it belongs to a group transaction (and would be invalid if sent alone).

liz@mac> goal clerk inspect group.sig
group.sig[0]
{
  "sig": "QZxImkmf15Jm4+crGqhlljKSW0I5OsyEsWesXOGS6CHe4AGncnhaODcn0+cz7BQxw+t75TLYwCDxgBA5OuG6AQ==",
  "txn": {
    "aamt": 100,
    "arcv": "VYAYCXHI2UUFKKXRSKTOYZQSEA7EPDAMHMXNOBKJC3B4TDB6Y6IBHSKCWA",
    "fee": 1000,
    "fv": 268144,
    "gh": "mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0=",
    "grp": "xuGTsu7LmUO9QkCNMBaBEGUCO5qls4oXMUGfDzVxeBY=",
    "lv": 269144,
    "note": "V1cWkBPWep0=",
    "snd": "HWYCB6YXZWPGXOJCXZQTK33BWLVBFQWVMDUWWKIHWNABAYLC3IKQ4SXRSQ",
    "type": "axfer",
    "xaid": 249
  }
}

group.sig[1]
{
  "sig": "88Y7nczINcpuDYen5fmA0fhe9WTJ4te8ph7+IZNsBoN8CZoKlCHsgpd0XcTdRvUG0Y+fVRL0+3+tXEhVx8FOAw==",
  "txn": {
    "amt": 1000000,
    "fee": 1000,
    "fv": 268149,
    "gen": "betanet-v1.0",
    "gh": "mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0=",
    "grp": "xuGTsu7LmUO9QkCNMBaBEGUCO5qls4oXMUGfDzVxeBY=",
    "lv": 269149,
    "note": "+nWiK9DdWo8=",
    "rcv": "HWYCB6YXZWPGXOJCXZQTK33BWLVBFQWVMDUWWKIHWNABAYLC3IKQ4SXRSQ",
    "snd": "VYAYCXHI2UUFKKXRSKTOYZQSEA7EPDAMHMXNOBKJC3B4TDB6Y6IBHSKCWA",
    "type": "pay"
  }
}

These transactions are already signed so I can submit them to the network with goal rawsend. You will notice two different transaction IDs are committed.


liz@mac> goal clerk rawsend -f group.sig 
Raw transaction ID JYUSFPWTVJECXZQV4JYVFOO6GATQ5CB467LLNNW5LFRW5X7AY2WQ issued
Raw transaction ID EMBPXE2KWDJUZVJV66USOQ6OJU7LA3CVDDSAFZTPTZCGZEEJAESQ issued
Transaction JYUSFPWTVJECXZQV4JYVFOO6GATQ5CB467LLNNW5LFRW5X7AY2WQ still pending as of round 268172
Transaction JYUSFPWTVJECXZQV4JYVFOO6GATQ5CB467LLNNW5LFRW5X7AY2WQ committed in round 268174
Transaction EMBPXE2KWDJUZVJV66USOQ6OJU7LA3CVDDSAFZTPTZCGZEEJAESQ committed in round 268174

If we take a look at the block they were committed in, you will see those two separate transactions with a shared group ID.
See screenshot below:

Hope this answers your questions!

2 Likes

Hi Liz, Thanks for the explanation. It is very clear now. I think ./goal clerk inspect was the command I was looking for to read the file.

Is the web transaction explorer available for BetaNet transactions? I was able to successfully run the node and send transactions. Wanted to know how I can see the block transactions.

No problem!

If you’re referring to algoexplorer, that is owned by a company called RandLabs and I believe they are working on support for BetaNet.

You can also use the REST API call to pull the block info in the meantime. The information will be returned as JSON like in the screenshot above.

1 Like