Newsgroups: eff.mail.cypherpunks
Subject: Magic Money 1.1/AutoClient
Date: 31 May 1994 02:59:26 -0400


Magic Money V1.1 with AutoClient and MultiServer Capability Uploaded to, should be available soon. Read README.MPJ in /mpj This is the automatic client I described a couple of weeks ago.

This is a new version of Magic Money. It is compatible with V1.0 in both directions. The major improvements are:

The keyid is appended to the end of the coin file with a new packet type number preceding it. These coin files will be accepted by the V1.0 client. V1.0 coin files will also be accepted by the V1.1 clients. See the README10.DOC file for more general instructions about how to use Magic Money. This file concentrates on the changes.

The Automatic Client performs the same functions as the manual client, except that it has no user interface. It is designed to be controlled by software (PERL scripts or C programs). The program is controlled by command-line arguments and information piped into stdin. All output is written to files or sent to stdout. Compiling AC.C with MM.C and the appropriate PGPTools files produces the Automatic Client. If you are using a PC, it is worthwhile to get the 8086.ASM file from PGP2.3a and use it. Define MSDOS, SMALL_MEM, DYN_ALLOC, and UPTON for the MS/DOS version with 8086.ASM. These defines work for both the normal and automatic clients.

Automatic Client Commands

The automatic client accepts one option, and zero, one, or two filenames. If run with no options or filenames, it will print a help screen.

ac -[option] [inputfile] [outputfile]

Error codes (from MM.H) These are returned by exit(code) when the program ends. A 0 is good, anything else is bad. The only errors that are not included here are out-of-memory and missing rand.dat file. These will still print English messages, however, if the system is correctly set up, they should not happen.

#define MMAC_OK 0 /* Normal exit */ #define MMACERROR_BADCOMMAND 1 /* Bad command */

#define MMACERROR_NOFILE 2        /* File not found or inaccessible */
#define MMACERROR_NODATA 3        /* Data such as a key not found */
#define MMACERROR_BADSIG 4        /* Coin/file has bad signature */
#define MMACERROR_BADEXP 5        /* Coin has unknown exponent */
#define MMACERROR_NOCOIN 6        /* Tried to use nonexistent coin */
#define MMACERROR_NOPROTO 7       /* No protocoin in file */

Using the Automatic Client

Ok, that's great, but how do I use it? For an automatic service, you want to receive coins, process them, get the response back from the server, and then perform some service. You may optionally want to send some coins back to the person. So first, when a message comes in, you have to decrypt it or dearmor it or uudecode it, or whatever is necessary to get a binary coins.dat file. Then run -l [file] to check its value. If you get a value and not an error, figure out what denominations you want. -d will list all possible denominations. Now run -p [file] [output file] and send it your list of denominations. Record the transaction id output from the client, along with whatever information you need to keep about the service the customer wants. Mail the output file off to the server, and go on to the next problem.

When the message comes back from the server (-k [file] and compare with -k to verify it is encrypted for your client) run -s [file] on it to deposit the coins in your allcoins.dat file. The output from the client gives you the transaction id, value, and any message. Use the transaction id to look up the information you recorded earlier, and deliver the service to the customer. The value can be verified if you want, and the message should probably be saved in a file for later reading. You can check each new message against the last one and only save it if it has changed.

Occasionally run a -x to see if you have any old coins. If so, figure out what denominations you want to trade them for, and run -x [file] to exchange them. You can probably do this part by hand, since coin expirations are pretty rare.

To pay out money, do a -l to find the denominations to extract, then do a -w to withdraw them into a coins.dat file.

Handling Multiple Servers

You can run a service that accepts coins from multiple servers. To do this, you have to keep a separate client directory for each server. When a coin file comes in, run -k [file] to determine which server it is for. Using the server id as the directory name would make life much simpler. Then CD into that directory and process the coins from there. If you get coins from a 1.0 client (which has no server id), you will have to go into each directory in turn and try a -l [file] on the coins. You will get an error return on each one until you find the right directory. If messages are coming back from multiple servers, using -k [file] on the incoming message will tell you which client's key it is encrypted with. Running -k will tell you the key of that client (on the second line).

Ideas for Automated Magic Money Applications

Currency Exchange - Accept one currency and return another, skimming off a profit. Find the correct exchange rates where the same amount of each currency is coming in and going out.

Pay-For-Use System - Accept Magic Money to pay for remote access to a machine, use of a MUD, remailer, news posting service, etc.

Gambling - Accept bets on sports, the stock market, horses, etc.

This is the MGMNY11A release. That means it might have bugs. If you find any, please post them on or These are also good places to announce your service, or to contact me.

Pr0duct Cypher

"One line of code is worth a thousand rants."

-----BEGIN PGP SIGNATURE----- Version: 2.3a

iQCVAgUBLerF1MGoFIWXVYodAQFtVAQAn7HOBDX4bg6MZv6uAgr3KhDfpTsAF1Te i8C9WjWGgPlqv6wJz+uACBo9dKnT5oP3u7foz3rB7GRp8UHHGBs2u8TjvTeedrQ4 wUit6Bb3LcmwRPjQ8MfLK3cam8EeNsy9Hn9hqw9fm7xs4jwgaqsZU8dslthSEdh4 lab6JYE0vWM=