Release Notes

v0.4.3

cashc compiler

  • ๐ŸŽ Add compiler optimisations.

v0.4.2

  • Re-add README files to NPM that were accidentally removed in the v0.4.0 release.

v0.4.1

cashc compiler

  • ๐ŸŽ Add optimisations to bitwise operators.
  • ๐Ÿš New CLI arguments.
    • Add --opcount|-c flag that displays the number of opcodes in the compiled bytecode.
    • Add --size|-s flag that displays the size in bytes of the compiled bytecode.
  • ๐Ÿ”ฃ Add trailing comma support.

CashScript SDK

  • ๐Ÿ“› Rename Sig to SignatureTemplate to better convey its meaning.
    • Sig still exists for backward compatibility, but is deprecated and will be removed in a later release.

https://twitter.com/RoscoKalis/status/1267440143624884227

v0.4.0

cashc compiler

  • โœจ Add .reverse() member function to bytes and string types.
  • โœจ Add bitwise operators &, ^, |.
  • โœจ Allow casting int to variable size bytes based on size parameter.
  • ๐Ÿ’ฅ BREAKING: Casting from int to unbounded bytes type now does not perform OP_NUM2BIN. Instead it is a purely semantic cast to signal that an integer value should be treated as a bytes value.
  • ๐Ÿ‡ Compiler optimisations.
    • Use NUMEQUALVERIFY for the final function in a contract.
    • Only drop the final VERIFY if the remaining stack size is less than 5.
    • Pre-calculate OutputNullData argument size.
  • ๐Ÿ› Fix a bug where return type of sha1 was incorrectly marked as bytes32.
  • ๐Ÿ› Data.decodeBool only treated numerical zero as false, now any zero-representation is considered false (e.g. 0x0000, -0, ...).

CashScript SDK

  • โœจ Add ability to provide hardcoded inputs to the transaction rather than use CashScript's coin selection.
  • ๐Ÿ’ฅ BREAKING: Refactor the transaction flow to a fluent API
    • Remove the TxOptions argument and other arguments to the Transaction send() function.
    • Instead these parameters are passed in through fluent functions from(), to(), withOpReturn(), withAge(), withTime(), withHardcodedFee(), withFeePerByte() and withMinChange().
    • After specifying at least one output with either to() or withOpReturn()the transaction is ready. From here the transaction can be sent to the network with the send() function, the transaction hex can be returned with the build() function, or the meep debugging command can be returned with the meep() function.
  • ๐Ÿ’ฅ Remove Contract.fromCashFile() and Contract.fromArtifact() which were deprecated in favour or Contract.compile() and Contract.import() in v0.2.2.

Migration

This update contains several breaking changes. See the migration notes for a full migration guide.


https://twitter.com/RoscoKalis/status/1264921879346917376

v0.3.3

cashc compiler

  • ๐Ÿ› Fix bug where variables could not reliably be used inside OutputNullData instantiation.

https://twitter.com/RoscoKalis/status/1224389493769342979

v0.3.2

cashc compiler

  • โœจ Add OutputNullData(bytes[] chunks), an output type to enforce OP_RETURN outputs.
  • ๐Ÿš CLI improvements
    • The --output|-o flag is now optional, if it is omitted or manually set to -, the artifact will be written to stdout rather than a file.
    • Add --asm|-A flag that outputs only Script in ASM format instead of a full JSON artifact.
    • Add --hex|-h flag that outputs only Script in hex format instead of a full JSON artifact.
    • Add --args|-a flag that allows you to specify constructor arguments that are added to the generated bytecode.
      • โš ๏ธ The CLI does not perform type checking on these arguments, so it is recommended to use the CashScript SDK for type safety.
  • ๐Ÿ› Fix a compilation bug that allowed compilation of "unverified covenants" (#56).
  • ๐Ÿ› Fix a compilation bug that allowed compilation of OutputP2PKH(...) without new keyword (#57).

CashScript SDK

  • ๐ŸŒ Browser support! You can now use CashScript inside web projects. Filesystem-based functionality such as compilation from file are not supported due to the nature of web, so CashScript files have to be read in a different way (e.g. Fetch API) and then passed into the CashScript SDK.
  • ๐Ÿ‘› Add minChange to transaction options. If this minChange is not reached, the change will be added to the transaction fee instead.

https://twitter.com/RoscoKalis/status/1223280232343515136

v0.3.1

cashc compiler

  • โš ๏ธ Add warnings when a contract exceeds 201 opcodes or 520 bytes.
  • ๐Ÿ› Fix a bug where an incorrect number of items were dropped from the stack after execution of a branch.

CashScript SDK

  • โœจ Improve error handling.
    • Further specified FailedTransactionError into FailedRequireError, FailedSigCheckError, FailedTimeCheckError and a general fallback FailedTransactionError.
    • Add Reason enum with all possible reasons for a Script failure - can be used to catch specific errors.
  • ๐Ÿ” Add instance.opcount and instance.bytesize fields to all contract instances.
  • ๐Ÿ› Fix a bug where the size of a preimage was not accounted for in fee calculation for covenants.

https://twitter.com/RoscoKalis/status/1217101473743544320

v0.3.0

cashc compiler

  • โœจ Covenants abstraction! All individual preimage fields can be accessed without manual decoding, passing, and verification.
    • Available fields: tx.version, tx.hashPrevouts, tx.hashSequence, tx.outpoint, tx.bytecode, tx.value, tx.sequence, tx.hashOutputs, tx.locktime, tx.hashtype.
    • When any of these fields is used inside a function, this function is marked covenant: true, and requires a preimage as parameter (automatically passed by CashScript SDK).
    • The correct fields are efficiently cut out of the preimage and made available.
    • The first occurrence of require(checkSig(sig, pubkey)); is identified, and preimage verification is inserted using the same sig/pubkey. Important: if you have multiple checkSig statements, keep in mind that the first will be used for verification.
    • Automatically cuts off VarInt from scriptCode, so tx.bytecode contains the actual contract bytecode.
  • โœจ Output instantiation! Automatically construct output formats for covenant transactions.
    • new OutputP2PKH(bytes8 amount, bytes20 pkh)
    • new OutputP2SH(bytes8 amount, bytes20 scriptHash)
  • ๐Ÿ› Fix bug with invalid output when the final statement in a contract is an if-statement.

CashScript SDK

  • โœจ Add fee option to TransactionOptions. This allows you to specify a hardcoded fee for your transaction.
  • โœจ Automatically pass in sighash preimage into covenant functions. Important: uses the hashtype of the first signature in the parameters for generation of this preimage.
  • ๐Ÿ’ซ Better fee estimation for transactions with many inputs.

https://twitter.com/RoscoKalis/status/1204765863062188033

v0.2.3

cashc compiler

  • ๐Ÿ› Fix a bug where unequal bytes types (e.g. bytes3 & bytes8) could not be concatenated together, as they were considered different types.

https://twitter.com/RoscoKalis/status/1202220857566908416

v0.2.2

CashScript SDK

  • ๐Ÿ› Remove minimaldata encoding in OP_RETURN outputs that caused incompatibility with SLP.
  • ๐Ÿ“› Renamed Contract.fromCashFile to Contract.compile.
    • The new function allows to pass in a path to a .cash file, or a string of the contract source code.
    • Contract.fromCashFile still exists for backward compatibility, but is deprecated and will be removed in a later release.
  • ๐Ÿ“› Renamed Contract.fromArtifact to Contract.import.
    • The new function allows to pass in a path to a .json artifact file, or a JSON object of the artifact.
    • Contract.fromArtifact still exists for backward compatibility, but is deprecated and will be removed in a later release.
  • ๐Ÿ› ๏ธ instance.export's file argument is now optional.
    • If it is provided, the artifact is written to the file, if not, it is returned as an object.

https://twitter.com/RoscoKalis/status/1192900277105389568

v0.2.1

cashc compiler

  • โœจ Support bytes types with bounded size, e.g. bytes1, bytes13, bytes32.
  • ๐Ÿ› Fix bug in bytecode optimisation

CashScript SDK

  • โœจ Support bytes types with bounded size, e.g. bytes1, bytes13, bytes32.
  • ๐Ÿฆ Automatically output meep command on failed transaction error.
  • ๐Ÿ”จ Make the hashtype parameter in signature placeholders optional.

https://twitter.com/RoscoKalis/status/1186554051720167424

v0.2.0

cashc compiler

  • ๐ŸŽ Implement compiler optimisations
    • For the final use of a variable, it is retrieved with OP_ROLL rather than OP_PICK. This removes the need to clean the stack at the end of a contract.
    • Final OP_VERIFY OP_TRUE is removed as there is an implicit OP_VERIFY at the end of a Script.
    • OP_VERIFY is merged with preceding opcode where applicable.
    • Shallow OP_PICK and OP_ROLL are replaced by hardcoded opcodes (e.g. OP_SWAP, OP_DUP).
    • Several other bytecode optimisations.
  • โœจ Add pragma keyword to specify intended compiler version.
    • Example: pragma cashscript ^0.2.0;
    • Contract fails to compile when compiler version does not satisfy constraints.
  • ๐Ÿšจ Add CashProof for all individual bytecode optimisations and for example contracts from 0.1.2 to 0.2.0.
  • ๐Ÿ› Add "default case" for function selection that fixes a vulnerability where people could spend funds by not calling any function.
  • โฌ†๏ธ Update dependencies.

CashScript SDK

  • โฌ†๏ธ Update cashc and other dependencies.

https://twitter.com/RoscoKalis/status/1178843657069154305

v0.1.2

CashScript SDK

  • โœจ Add support for OP_RETURN outputs.
  • ๐Ÿ› Improved error handling.
  • ๐Ÿ› Poll for transaction details to make sure it's available.
  • ๐Ÿ”ฅ Enable optional mainnet - NOT RECOMMENDED
  • ๐Ÿ”จ UTXO selection refactor
  • ๐Ÿšจ Improve Transaction testing

https://twitter.com/RoscoKalis/status/1174910060691984385

v0.1.1

CashScript SDK

  • ๐Ÿ› Bug fixes with incorrect parameter encoding for string/bool/int types.

v0.1.0

  • ๐ŸŽ‰ Initial release.