## Appendix A Assertion Tests  
```
Require: Totalamount < abalance
1: Shoppinglist = {...} > See Figure 1 for full list
2: Totalamount = Shopppinglist.amount
3: Netamount = Shoppinglist.netamount()
4: VAT = Shoppinglist.vatamount()
5: mcbalance = MegaCompany.getBalance()
6: abalance = Alice.getBalance()
7: vbalance = VATPayments.getBalance()
8: Inv = MegaCompany.issueOrder(Alice,Shoppinglist)
9: assert{> Assertion Test 10: Inv \(\in\) MegaCompany.getInvoices()
11: Inv \(\in\) Alice.getInvoices()
12: Inv < VATPayments.getInvoices()
13: Alice.payInvoice(Inv)
14: assert{> Assertion Test 2
15: MegaCompany.getState(Inv) == isPaid
16: Alice.getState(Inv) == isPaid
17: VATPayments.getState(Inv) == isPaid)
18: assert{> Assertion Test 3
19: MegaCompany.getAccountbalance(v) == mcbalance + Netamount
20: Alice.getAccountbalance() == abalance \(-\) Totalamount
21: VATPayments.getAccountbalance() == vbalance + VAT)
```  
**Algorithm A1** Pay invoice with sufficient funds ```
**Algorithm A2** Pay invoice with goods within the allowed goods list with tokens
``` Require: Totalamount > abatechbalance
1: Shoppinglist = {...} \(\triangleright\) See Figure A1 for full list
2: Totalamount = Shoppinglist.amount
3: Netamount = Shoppinglist.netamount()
4: VAT = Shoppinglist.netamount()
5: mcbamica = MegaCompany.getBalance()
6: atokenbalance = Alice.getTokenbalance()
7: vbalance = VATPayments.getBalance()
8: Inv = MegaCompany.issueOrder(Alice,Shoppinglist)
9: Alice.payInvoice(Inv)
10: assert[\(\triangleright\) Assertion Test 4
11: MegaCompany.getState(Inv)! = isPaid
12: Alice.getState(Inv)! = isPaid
13: VATPayments.getState(Inv)! = isPaid]
14: assert[\(\triangleright\) Assertion Test 5
15: MegaCompany.getAccountbalance(v) == mcbamica
16: Alice.getAccountbalance() == abalance
17: VATPayments.getAccountbalance() == valance ```
**Algorithm A3** Pay invoice with insufficient funds
``` Require: Totalamount < atokenbalance
1: Shoppinglist = {...} \(\triangleright\) See Figure A2 for full list
2: Totalamount = Shoppinglist.amount
3: Netamount = Shoppinglist.netamount()
4: VAT = Shoppinglist.vatamount()
5: mcbamica = MegaCompany.getBalance()
6: atokenbalance = Alice.getTokenbalance()
7: vbalance = VATPayments.getBalance()
8: Inv = MegaCompany.issueOrder(Alice,Shoppinglist)
9: Alice.payInvoicewithTokens(Inv)
10: assert[\(\triangleright\) Assertion Test 6
11: MegaCompany.getState(Inv) == isPaid
12: Alice.getState(Inv) == isPaid
13: VATPayments.getState(Inv) == isPaid]
14: assert[\(\triangleright\) Assertion Test 7
15: MegaCompany.getAccountbalance(v) == mcbamica + Netamount
16: Alice.getAccountableance() == atokenbalancebalance -- Totalamount
17: VATPayments.getAccountbalance() == vbalance + VAT ```
**Algorithm A4** Pay invoice with goods outside the allowed goods list with tokens
``` Require: Totalamount > atokenbalance
1: Shoppinglist = {...} \(\triangleright\) See Figure A1 for full list
2: Totalamount = Shoppinglist.amount
3: Netamount = Shoppinglist.netamount()
4: VAT = Shoppinglist.vatamount()
5: mcbamica = MegaCompany.getBalance()
6: atokenbalance = Alice.getTokenbalance()
7: vbalance = VATPayments.getBalance()
8: Inv = MegaCompany.issueOrder(Alice,Shoppinglist)
9: Alice.payInvoicewithTokens(Inv)
10: assert[\(\triangleright\) Assertion Test 8



## References

* [1] [PERSON] Bitcoin: A Peer-to-Peer Electronic Cash System. _SSRN_**2008**, 1-9. [CrossRef]
* [2] [PERSON] Cryptocurrency Value Formation: An Empirical Study Leading to a Cost of Production Model for Valuing Bitcoin. _Telemat. Inform._**2017**, 34, 1308-1321. [CrossRef]
* [3] [PERSON] Blockchain Technology: Transforming Libertarian Cryptocurrency Dreams to Finance and Banking Realities. _Computer_**2017**, 50, 38-49. [CrossRef]
* [4] [PERSON]; [PERSON]T. Negative Bubbles and Shocks in Cryptocurrency Markets. _Int. Rev. Financ. Anal._**2016**, 47, 343-352. [CrossRef]
* [5] [PERSON] Can Cryptocurrencies Fulfil the Functions of Money? _Q. Rev. Econ. Finance_**2018**, 70, 38-51. [CrossRef]
* [6] [PERSON] Virtual Currencies under EU Anti-Money Laundering Law. _Comput. Law Secur.