Atomic Transfers in Sandbox

Hello Algorand community,
I was playing around with the Sandbox and I noticed that I cannot easily create atomic transfers.

$ ./sandbox goal clerk send -f FHVO53QM54RDNTEMEVOZM5LXSTOAYQDN4UI5GCNPM236AXFW7AQAD35SQQ -t KV72DRDRENU6BIS7ZCPA4YW6JAOIZ46KRRQSU6RJY7JUVA3Z4FD45Z2QMM -a 5000 -o 1.tx -w MyWallet
Please enter the password for wallet 'MyWallet': 
open 1.tx: permission denied

I then looked at the code and I guess it is a file system permission thing since we are operating in /opt/algorand/node/goal within the container.

I then ran

$ ./sandbox goal clerk send -f FHVO53QM54RDNTEMEVOZM5LXSTOAYQDN4UI5GCNPM236AXFW7AQAD35SQQ -t KV72DRDRENU6BIS7ZCPA4YW6JAOIZ46KRRQSU6RJY7JUVA3Z4FD45Z2QMM -a 5000 -o /opt/algorand/node/data/1.tx -w MyWallet

which did work. Is that the intended place to store that?

Furthermore, there is no great way to concatenate the multiple output files. How would I do that without running the docker command?

Thanks for your help!

1 Like

Hi @sabinebertram,

I am not sure what is the best way to solve the permission issue.

Regarding concatenation of files, Algorand transaction files can be concatenated together using cat.

This does not however create an atomic transfer.
If you want to create an atomic transfer, you need to “group” the transactions: see https://developer.algorand.org/docs/atomic-transfers#step-2
Grouping the transactions adds a special field in each of the transaction to ensure they can only be committed together (and in order) to the blockchain.

Hi @sabinebertram. Txn files are typically written into the node directory, not node/data however I see that running /sandbox goal clerk send -f newAcct1 -t newAcct2 -a 5000 -o /opt/algorand/node/3.tx -w sandboxWallet1 returns the same permissions error you stated above.
Another way to do this is to enter the container with ./sandbox enter and create txn files inside of the container using goal ./goal clerk send -f newAcct1 -t newAcct2 -a 5000 -o 1.tx -d data -w sandboxWallet1 This method works fine and from there you can go ahead and concatenate and group transactions the way Fabrice has described above.

Please create an issue in the repo so we can improve sandbox https://github.com/algorand/sandbox/issues

Maybe the sandbox could always set the working directory to the data directory with -w, that way you could concatenate files together on the host machine. Could you try adding -w /opt/algorand/node/data to the goal command on line 310 of the sandbox script and see if that works?

I think this works, I just pushed a change to the sandbox and now you can work with the transactions on your local machine:

$ ./sandbox goal clerk send -f newAcct1 -t newAcct2 -a 5000 -o 3.tx
$ ls data/*tx
data/3.tx
2 Likes

Hi everyone,

I am wondering how to concatenate the transactions the best way (using goal). If I create the transactions the usual way then try to cat I get the error: " cat: txn1.txn: No such file or directory "

Following Will’s solution above, I can enter the container, concatenate the transactions there and then exit and proceed as usual. This works fine. Is there a way to do this without entering the container? I am sure it is just an issue with the path to storage of the transactions I am creating, but I don’t know how to access the correct directory.

Any advice would be much appreciated, thank you.