API Docs for:

make_torrent Module

Defined in: make_torrent.js:1

Make a torrent file that contains a thing.

This program follows up on the Distributed Thing Tracker proposal to use BitTorrent as a means to distribute things.

The process is quick and dirty, i.e. easy for me to code so you need to do all the work. In brief:

  • Create a thing.
  • Create a torrent file with the thing files.
  • Merge them with this program.
  • Seed your torrent.
  • Publish the magnet link generated by this program.

More slowly now.

You need to create a design and put its metadata in a JSON format. Making the actual design is beyond the scope of these instructions, but it would be something like creating an OpenSCAD or OpenJSCAD file. Once you have your design, you can create a JSON file with the metadata that describes it. You can start from this template, but the definitive source is the Thing Tracker Network.

   "title": "Mechanical Movement #27",
   "url": "http://garyhodgson.github.com/githubiverse-tst",
   "author": "Gary Hodgson",
   "license": "GPL3",
   "tags": ["mechanical movement", "fun"],
   "thumbnailURL": "https://github.com/garyhodgson/githubiverse-tst/raw/master/img/test-jig.jpg",
   "description": "An implementation of movement #27 from "501 Mechanical Movements" by Henry T. Brown.\\n\\nThis is still a work in progress."

Once you have a JSON file that has contents like the above and your design files you have a "thing" and can proceed to make a "distributed thing" out of it.

You will need a way to create a .torrent file, which means a capable torrent client. I suggest µTorrent. Do whatever is necessary with that tool to generate a .torrent file. I'll describe what I did. Push the nice friendly Get µTorrent button. Click the Free Download fine print link above the comparison chart. Save the uTorrent.exe file. Run the uTorrent.exe file by double clicking on it. This installs the µTorrent client (for me it was Version 3.3 Build 29342). I installed it in directory C:\Program Files (x86)\uTorrent and unchecked every option it offered except "Add an exception for µTorrent in Windows Firewall" but you can choose other options. The program starts up, or start it up by clicking on the installed uTorrent.exe (this one: C:\Program Files (x86)\uTorrent\uTorrent.exe). Create a new torrent. From the File menu, choose Create New Torrent..., or hot-key CTRL-N. Click the Add File button and select the design file (you could also add a directory of files if there were more than one). Remove all the tracker info from the Trackers text box. Add a comment in the Comment field if you want. Click the Create and save as... button and save the new .torrent file. Click Yes to the dialog box that is displayed with the text: "Please enter a valid tracker URL. Do you want to continue without having any trackers?"

You can check the contents of the .torrent file by uploading it to Tools4noobs Torrent decode.

The two pieces - the .json and the .torrent can now be merged by running this program. This program requires node.js, so you need to install it first. After that, you should have commands "node" and "npm" (the node package manager) available.

The program relies on two packages, namely bencode and sha1. You can install these locally (i.e. in the directory you're working in - the same one this file is in) with these commands:

  npm install bencode
  npm install sha1

Now you can make a "thing". The command line is:

  node make_torrent.js thing.json thing.torrent output.torrent


  • thing.json is the metadata file you created from the template
  • thing.torrent is the original torrent file created by your BitTorrent client
  • output.torrent is the file you want to create

Besides creating the output file, which is a modified torrent file containing the thing metadata, the program will also display a magnet link.

To seed your torrent, you need to put the file(s) that it comprises and the generated torrent file in the directory configured for torrent seeding (usually the same as the one for downloads), and then add the torrent as an initial seed in your client. For the µTorrent client this found of the File menu, Add Torrent... or CTRL-O. where you can select the generated torrent file. This is somewhat confusing because it requires the directory to save it - but apparently doesn't mind if this is the same directory.

Then you can send the magnet link to your geeky friends who can paste it into their BitTorrent client and torrent your thing. For the µTorrent client, that latter step is found on the File menu, Add Torrent from URL... or CTRL-U, where you can paste the magnet link and begin the torrent process.