This folder contains a number of example CashScript contracts to show off its functionality and usage. The .cash files contain example contracts, and the .ts/.js files contain example usage of the CashScript SDK with these contracts.
The "Hello World" of cash contracts is defining the P2PKH pattern inside a cash contract, which can be found under p2pkh.cash. Its usage can be found under p2pkh.ts.
To run the examples, clone this repository and navigate to the examples/ directory. Since the examples depend on the SDK, be sure to run yarn inside the examples/ directory, which installs all required packages.
git clone git@github.com:CashScript/cashscript.git
cd cashscript/examples
yarnAll .ts files can then be executed with tsx.
npm install -g tsx
tsx p2pkh.tsAll .js files can be executed with node.
node p2pkh.js