Getting Started
Installing the CashScript compiler
npm install -g cashcInstalling the JavaScript SDK
npm install cashscriptWriting your first smart contract
pragma cashscript ^0.7.0;
contract TransferWithTimeout(pubkey sender, pubkey recipient, int timeout) {
// Allow the recipient to claim their received money
function transfer(sig recipientSig) {
require(checkSig(recipientSig, recipient));
}
// Allow the sender to reclaim their sent money after the timeout is reached
function timeout(sig senderSig) {
require(checkSig(senderSig, sender));
require(tx.time >= timeout);
}
}Integrating into JavaScript
Last updated