Call Stateful Contracts Consecutively via GUI
sCrypt IDE v0.5.5 allows a user to deploy a stateful contract and repeatedly call its methods in a GUI, extending our previous feature. We use an example contract AdvancedCounter to illustrate the workflow.
AdvancedCounter contains a counter, which is increased by one every time increment() is called. We initialize it to be 0 and locks 10000 satoshis into the contract. After hitting Deploy, it should be deployed.
In the Call panel, there is an additional section Outputs (Optional) and Transaction Settings, besides section Public Function Arguments introduced last time. It allows customizing outputs, which is necessary in many stateful contracts. We support three types of outputs currently:
- Stateful Output: State is the serialized state in ASM format.
- P2PKH Output: Address is a regular bitcoin address, which defaults to address derived from user’s private key.
- OpReturn Output: OpReturn is data payload in ASM format.
Notice arguments amount and changeSats equate to Amount in outputs: 8000 (output 1) + 1000 (output 2)+ 1000 (fee)= 10000 (UTXO total). Also, we specify SigHashType to be ANYONECANPAY | ALL¹ in the dropdown menu. After all fields are filled, we click the Call button and succeed.
Since this is a stateful contract, we can call increment() again and again². Each call generates a transaction as listed under transactions.
 FORKID is included in all SigHashType implicitly.
 Currently, only one input is allowed when unlocking a stateful contract.