Developing and learning about Bitcoin applications has become a lot easier with the 21 Bitcoin Computer. The device comes installed with a Python 3 library which provides functionality for working with major Bitcoin data structures.

Since the library is not yet available for use outside of the device, testing and running code needs to happen inside of it. Unless you’re proficient with a terminal text editor, it becomes really cumbersome to code. Personally I’m more productive working with Atom from my Mac.

The following are some simple and quick techniques you can use to setup remote development and improve your workflow.

File Sharing

Note: Windows and Linux users might want to look into samba, it takes a few more steps but it will do the job.

Install netatalk on your 21 Bitcoin Computer:

sudo apt-get install netatalk

Setup a connection from your Mac terminal:

open afp://YOUR_21_DEVICE_IP

At the prompt, use your user credentials (same as ssh).

You should now see a finder window open at the user’s home directory. Any file you write to that directory gets synced automatically to the device.

Watch Changes

Install nodejs (>=4.x) and npm on your 21 Bitcoin Computer:

Note: Thanks to @mxschumacher for the tip!

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -

sudo apt-get install -y nodejs

Symlink node:

sudo ln -s /usr/bin/nodejs /usr/bin/node

Install nodemon:

npm install -g nodemon

Execute script with nodemon:

nodemon --exec "python3" /path/to/your/script.py

Nodemon will now watch for any changes to files with the .py extension and automatically reload the entry script.

Conclusion

I hope these techniques will help you getting setup and productive. If you have any tips or suggestions leave a comment.

Happy coding!