Client-side scripting

From Open Transactions
Jump to navigation Jump to search

The ot script interpreter ("ot") has access to the entire OT Client API, including the low-level and high-level APIs. In fact, the opentxs command-line tool itself is written in ot script, just like any other script.

To make your own OT script, create a text file, and chmod u+x filename in order to be able to run it as an executable. Then put this shebang at the top of the file: #!/usr/bin/env ot

Now you can run that file like any other executable, just type: ./filename and the script will execute as an OT client, with full access to the OT API.

OT is easy! Even a trained monkey can write OT-based scripts and client applications! If you want to see how the high-level API is used, check out the code for the opentxs CLI tool for example functions demonstrating all of the OT functionality. (In fact, you can actually CALL all those functions from your own OT scripts.)

See also: Smart contracts