The first known smart contract was a vending machine for holy water. It was designed by Heron of Alexandria because people were taking holy water from the temples without paying. (Why would anyone steal holy water?)
The vending machine was a coin-operated urn. A coin was dropped through a slot at the top, landing on a small plate attached to a lever. The weight of the coin depressed the lever, lifting a stopper to release the holy water. After the lever tilted, the coin would slide off the plate and the weight of the stopper would pull the lever back to the original position and close the valve.
The Ancient Greeks also invented Gordian knots — maybe used to secure their contracts.
Old World, High Tech –Smithsonian