You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError('Either all UTXOs must have an individual unlocker speciifed, or no UTXOs must have an individual unlocker specified and a shared unlocker must be provided');
55
+
thrownewError('Either all UTXOs must have an individual unlocker specified, or no UTXOs must have an individual unlocker specified and a shared unlocker must be provided');
Copy file name to clipboardExpand all lines: website/docs/basics/about-bch.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ sidebar_label: About Bitcoin Cash
5
5
6
6
Bitcoin Cash (ticker BCH) is one of the biggest cryptocurrencies. Bitcoin Cash is a fork of Bitcoin started in 2017 because of differences in vision for the future of the Bitcoin project.
7
7
8
-
Bitcoin Cash shares many of the same fundamentals as Bitcoin (BTC) like the *Proof-of-Work* consensus alrgorithm and the *UTXO data-model*. However regarding smart contract programmability, Bitcoin Cash has significantly diverged from Bitcoin (BTC). We will first cover the UTXO data model and then delve into the smart contract capabilities of Bitcoin Cash.
8
+
Bitcoin Cash shares many of the same fundamentals as Bitcoin (BTC) like the *Proof-of-Work* consensus algorithm and the *UTXO data-model*. However regarding smart contract programmability, Bitcoin Cash has significantly diverged from Bitcoin (BTC). We will first cover the UTXO data model and then delve into the smart contract capabilities of Bitcoin Cash.
9
9
10
10
:::info
11
11
To learn more about the Bitcoin Basics refer to the book ['Mastering Bitcoin'](https://github.com/bitcoinbook/bitcoinbook). There is also a modified version for BCH specifically called ['Mastering Bitcoin Cash'](https://github.com/Bitcoin-com/mastering-bitcoin-cash).
@@ -31,4 +31,4 @@ The locking and unlocking scripts of regular transactions and smart contracts on
31
31
32
32
### CashScript
33
33
34
-
CashScript is a high-level programming language for smart contracts on Bitcoin Cash that offers a strong abstraction for a smoother development experience. The CashScript syntax is based on Ethereum's smart contract language Solidity, but its functionality is very different since smart contracts on Bitcoin Cash differ greatly from smart contracts on Ethereum.
34
+
CashScript is a high-level programming language for smart contracts on Bitcoin Cash that offers a strong abstraction for a smoother development experience. The CashScript syntax is based on Ethereum's smart contract language Solidity, but its functionality is very different since smart contracts on Bitcoin Cash differ greatly from smart contracts on Ethereum.
Copy file name to clipboardExpand all lines: website/docs/basics/getting-started.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ With the CashScript playground there's a nice integrated editor to get started,
20
20
21
21
To write CashScript smart contracts locally you use a code editor. For the best developer experience, we recommend to use VS Code with the CashScript extension. This way it will automatically recognize `.cash` files and offer highlighting and autocompletion.
Copy file name to clipboardExpand all lines: website/docs/guides/debugging.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,14 +26,14 @@ If a CashScript transaction is evaluated with `.debug()` or is sent to a network
26
26
```bash
27
27
HodlVault.cash:23 Require statement failed at input 0 in contract HodlVault.cash at line 23.
28
28
Failing statement: require(price >= priceTarget)
29
-
Bithauth IDE: [link]
29
+
Bitauth IDE: [link]
30
30
```
31
31
32
32
Read the error message to see which line in the CashScript contract causes the transaction validation to fail. Investigate whether the contract function invocation is the issue (on the TypeScript SDK side) or whether the issue is in the CashScript contract itself (so you'd need to update your contract and recompile the artifact). If it is not clear **why** the CashScript contract is failing on that line, then you can use the following two strategies: console logging & Bitauth IDE stack trace.
33
33
34
34
### Console Logging
35
35
36
-
To help with debugging you can add `console.log` statements to your CashScript contract file to log variables. This way you investigate whether the variables have the expected values when they get to the failing `require` statement in the CashScript file. After adding the `console.log` statements, recompile your contract so they are added to your contract's Artifact.
36
+
To help with debugging you can add `console.log` statements to your CashScript contract file to log variables. This way you investigate whether the variables have the expected values when they get to the failing `require` statement in the CashScript file. After adding the `console.log` statements, recompile your contract so they are added to your contract's Artifact.
37
37
38
38
### Bitauth IDE
39
39
@@ -50,7 +50,7 @@ const uri = await transaction.bitauthUri();
50
50
It is unsafe to debug transactions on mainnet as private keys will be exposed to BitAuth IDE and transmitted over the network.
51
51
:::
52
52
53
-
The Bithauth IDE will show you the two-way mapping between the CashScript contract code generated opcodes. Here is [a Bithauth IDE link][BitauthIDE] for the basic `TransferWithTimeout` contract as an example:
53
+
The Bitauth IDE will show you the two-way mapping between the CashScript contract code generated opcodes. Here is [a Bitauth IDE link][BitauthIDE] for the basic `TransferWithTimeout` contract as an example:
@@ -88,12 +88,12 @@ When a transaction gets rejected by a full node, it will return a cryptic error
88
88
mandatory-script-verify-flag-failed (Script failed an OP_VERIFY operation) (code 16)
89
89
```
90
90
91
-
Read the message carefully to investigate whether the issue is a failing script (failing OpCode) or whether a standardness rule like minimum-relay-fee is violated.
91
+
Read the message carefully to investigate whether the issue is a failing script (failing OpCode) or whether a standardness rule like minimum-relay-fee is violated.
92
92
If the cause is a failing OpCode, you can check the contract's Artifact to see how many appearances this OpCode has. Sometimes the OpCode only appears once or twice, indicating where the failing `require` statement is. Other times you might see 15 appearances of the OpCode leaving you to try the next strategies.
93
93
94
94
### Removing Contract Checks
95
95
96
-
If your contract fails, you can remove (or comment out) the lines that are the likely cause of the error. After recompiling to a new Artifact you can test whether the remaining subcontract works or fails with a different error. If this is the case, then you learned that there is an issue in the removed CashScript code block. In the worst case, when you have no indication from the failing opcode (previous strategy), then you will have to try to remove different parts of your contract and try different sub-contracts repeatedly.
96
+
If your contract fails, you can remove (or comment out) the lines that are the likely cause of the error. After recompiling to a new Artifact you can test whether the remaining subcontract works or fails with a different error. If this is the case, then you learned that there is an issue in the removed CashScript code block. In the worst case, when you have no indication from the failing opcode (previous strategy), then you will have to try to remove different parts of your contract and try different sub-contracts repeatedly.
97
97
98
98
To use this strategy effectively, the contract setup with funding should be automated as to avoid having to send testnet coins manually to each different subcontract. However inefficient, this strategy should always be able to get you to find the failing line in your CashScript contract. Then you can investigate whether the issue is the contract invocation or the `require` statement in the CashScript file.
With this workflow, you can make changes to the contract and the run the JavaScript program to
112
+
With this workflow, you can make changes to the contract and the run the JavaScript program to
113
113
get an accurate measure of how the bytesize of your contract changes with different optimizations.
114
114
115
115
## To optimize or not to optimize?
@@ -120,5 +120,5 @@ In the context of optimizing contract bytecode, there's an important remark to c
120
120
121
121
>We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
122
122
123
-
It's worth considering whether optimizing the redeem script is necessary at all. If the contract is accepted by the network, and there is no glaring inefficiency in the bytecode, perhaps the best optimization is to not to obsess prematurely about things like blocksize.
123
+
It's worth considering whether optimizing the redeem script is necessary at all. If the contract is accepted by the network, and there is no glaring inefficiency in the bytecode, perhaps the best optimization is to not to obsess prematurely about things like block size.
Copy file name to clipboardExpand all lines: website/docs/language/globals.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ int tx.locktime
71
71
Represents the `nLocktime` field of the transaction. This is similar to the [`tx.time`][tx.time] global variable but `tx.time` can only be used in `require` statements, not for variable declaration.
72
72
73
73
:::tip
74
-
The usecase for `tx.locktime` is to read the `nLocktime` value and add to the local state. Example usage for this is demonstrated in the [Sablier example](/docs/guides/covenants#keeping-local-state-in-nfts).
74
+
The use case for `tx.locktime` is to read the `nLocktime` value and add to the local state. Example usage for this is demonstrated in the [Sablier example](/docs/guides/covenants#keeping-local-state-in-nfts).
0 commit comments