├── .circleci
└── config.yml
├── .dockerignore
├── .gitignore
├── Dockerfile
├── README.md
├── counterfactual.bib
├── diagrams
├── README.md
├── assigning.svg
├── atomic.svg
├── commitwithdrawal-dispute.svg
├── initialization-dispute.svg
├── m1.svg
├── m2.svg
├── nonce-dependent-conditional-finalization.svg
├── oo.svg
├── small-tree.svg
├── tree.svg
├── update-dispute.svg
└── vector_nonce.svg
├── docker-compose.yml
├── main.tex
└── solidity-highlighting.tex
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | jobs:
3 | build:
4 |
5 | docker:
6 | - image: ivanpondal/alpine-latex:1.1.0
7 |
8 | working_directory: /workdir
9 |
10 | steps:
11 | - checkout
12 |
13 | - setup_remote_docker
14 |
15 | - run: apk update
16 | - run: apk --no-cache add perl wget py-pygments ca-certificates xz inkscape
17 | - run: tlmgr update --self
18 | - run: tlmgr install revtex4 inconsolata ulem
19 |
20 | - run:
21 | name: Building PDF
22 | command: |
23 | pdflatex -shell-escape main.tex
24 | bibtex main.aux
25 | pdflatex -shell-escape main.tex
26 | pdflatex -shell-escape main.tex
27 |
28 | - store_artifacts:
29 | path: main.pdf
30 | destination: artifact-file
31 |
32 | - store_artifacts:
33 | path: main.log
34 | destination: raw-test-output
35 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | *.pdf
2 | *.aux
3 | *.log
4 | *.out
5 | *.end
6 | *.bbl
7 | *.blg
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | main.pdf
2 | *.aux
3 | *.log
4 | *.out
5 | *.end
6 | *.bbl
7 | *.blg
8 | _minted-main/*
9 | svg-inkscape/*
10 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ivanpondal/alpine-latex:1.1.0
2 |
3 | RUN apk update
4 | RUN apk --no-cache add perl wget py-pygments xz inkscape
5 | RUN tlmgr update --self
6 | RUN tlmgr install revtex4 inconsolata minted ulem
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Generalized State Channels Paper
2 |
3 | [](https://circleci.com/gh/counterfactual/paper)
4 |
5 | This repository stores the LaTeX code for the Generalized State Channels paper. Each commit to `master` is automatically built by CircleCI.
6 |
7 | ### To view latest draft
8 |
9 | 1. Go to [CircleCI](https://circleci.com/gh/counterfactual/paper)
10 | 2. Click on latest build
11 | 3. Click on Artifacts
12 | 4. Open `artifact-file`
13 |
14 | ### Building the PDF locally
15 |
16 | [Install `docker-compose`](https://docs.docker.com/compose/install/) and run:
17 |
18 | ```bash
19 | docker-compose up
20 | ```
21 |
22 | ### Citing this paper
23 |
24 | To reference this paper in other works, here is an example BibTex entry:
25 |
26 | ```tex
27 | @misc{
28 | Coleman_2018,
29 | author = "Jeff Coleman, Liam Horne, and Li Xuanji",
30 | title = "Counterfactual: Generalized State Channels",
31 | year = "2018",
32 | howpublished = {\url{http://l4.ventures/papers/statechannels.pdf}}
33 | }
34 | ```
35 |
--------------------------------------------------------------------------------
/counterfactual.bib:
--------------------------------------------------------------------------------
1 | @misc{Nakamoto_2008,
2 | author = "Satoshi Nakamoto",
3 | title = "Bitcoin: a peer-to-peer electronic cash system",
4 | year = "2008",
5 | howpublished = {\url{https://bitcoin.org/bitcoin.pdf}}
6 | }
7 |
8 | @misc{Buterin_2013,
9 | author = "Vitalik Buterin",
10 | title = "A next generation smart contract and decentralized application platform",
11 | year = "2013",
12 | howpublished = {\url{https://github.com/ethereum/wiki/wiki/White-Paper}}
13 | }
14 |
15 | @misc{Poon_2016,
16 | author = "Joseph Poon and Thaddeus Dryja",
17 | title = "The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments",
18 | year = "2016",
19 | howpublished = {\url{https://lightning.network/lightning-network-paper.pdf}}
20 | }
21 |
22 | @misc{Lightning_RFC,
23 | author = "Rusty Russell et. al.",
24 | title = "Lightning Network In-Progress Specifications",
25 | year = "2018",
26 | howpublished = {\url{https://github.com/lightningnetwork/lightning-rfc}}
27 | }
28 |
29 | @misc{Back_2014,
30 | author = "Adam Back et al.",
31 | title = "Enabling Blockchain Innovations with Pegged Sidechains",
32 | year = "2014",
33 | howpublished = {\url{https://blockstream.com/sidechains.pdf}}
34 | }
35 |
36 | @misc{Poon_2017,
37 | author = "Joseph Poon and Vitalik Buterin",
38 | title = "Plasma: Scalable Autonomous Smart Contracts",
39 | year = "2017",
40 | howpublished = {\url{https://plasma.io/plasma.pdf}}
41 | }
42 |
43 | @misc{Pagnia_1999,
44 | author = "Henning Pagnia and Felix C. G{\"a}rtner",
45 | title = "On the Impossibility of Fair Exchange Without a Trusted Third Party",
46 | year = "1999",
47 | howpublished = {\url{https://www.cs.utexas.edu/~shmat/courses/cs395t\_fall04/pagnia.pdf}}
48 | }
49 |
50 | @misc{wiki:CounterfactualConditional_2017,
51 | title = "Counterfactual conditional --- {W}ikipedia{,} The Free Encyclopedia",
52 | year = "2018",
53 | howpublished = {\url{https://en.wikipedia.org/wiki/Counterfactual\_conditional}}
54 | }
55 |
56 | @misc{Wood_2017,
57 | author = "Gavin Wood",
58 | title = "Ethereum: A Secure Decentralized Generalised Transaction Ledger",
59 | year = "2018",
60 | howpublished = {\url{https://ethereum.github.io/yellowpaper/paper.pdf}}
61 | }
62 |
63 | @misc{Solidity_2018,
64 | title = "Solidity Documentation - Units and Globally Available Variables",
65 | year = "2018",
66 | howpublished = {\url{https://solidity.readthedocs.io/en/develop/units-and-global-variables.html}}
67 | }
68 |
69 | @misc{essrm:Counterfactual,
70 | author = {{Michael Lewis-Beck, Alan E Bryman, Tim Futing Liao}},
71 | title = "Counterfactual. The SAGE Encyclopedia of Social Science Research Methods"
72 | }
73 |
74 | @misc{se:contractaddress,
75 | author = {{Oleskii Matiiasevych}},
76 | title = "How is the address of an Ethereum contract computed?",
77 | year = "2016",
78 | howpublished = {\url{https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed}}
79 | }
80 |
81 | @misc{eip:accountabstraction,
82 | author = {{Vitalik Buterin}},
83 | title = "Account abstraction for main chain",
84 | year = "2018",
85 | howpublished = {\url{https://github.com/ethereum/EIPs/issues/859}}
86 | }
87 |
88 | @misc{readthedocs:raidenspec,
89 | title = "Raiden Specification",
90 | year = "2018",
91 | howpublished = {\url{http://raiden-network.readthedocs.io/en/stable/spec.html}}
92 | }
93 |
94 | @misc{raiden:217,
95 | author = {{Augusto Hack}},
96 | title = "Add cooperative channel closing",
97 | year = "2016",
98 | howpublished = {\url{https://github.com/raiden-network/raiden/issues/217}}
99 | }
100 |
101 | @misc{chess,
102 | author = {{Paul Grau}},
103 | title = "Lessons learned from making a Chess game for Ethereum",
104 | year = "2016",
105 | howpublished = {\url{https://medium.com/@graycoding/lessons-learned-from-making-a-chess-game-for-ethereum-6917c01178b6}}
106 | }
107 |
108 | @misc{perun,
109 | author = {{Stefan Dziembowski, Lisa Eckey, Sebastian Faust, Daniel Malinowski}},
110 | title = "PERUN: Virtual Payment Hubs over Cryptographic Currencies",
111 | year = "2017",
112 | howpublished = {\url{https://eprint.iacr.org/2017/635}}
113 | }
114 |
115 | @misc{perun2,
116 | author = {{Stefan Dziembowski, Sebastian Faust, Kristina Hostakova}},
117 | title = "Foundations of State Channel Networks",
118 | year = "2018",
119 | howpublished = {\url{https://eprint.iacr.org/2018/320}}
120 | }
121 |
122 | @misc{devcon1:uht,
123 | author = {{Jeff Coleman}},
124 | title = "Universal Hash Time",
125 | year = "2015",
126 | howpublished = {\url{https://www.youtube.com/watch?v=phXohYF0xGo}}
127 | }
128 |
129 | @misc{jeffcoleman:statechannels,
130 | author = {{Jeff Coleman}},
131 | title = "State Channels",
132 | year = "2015",
133 | howpublished = {\url{http://www.jeffcoleman.ca/state-channels/}}
134 | }
135 |
136 | @misc{bitcoinmagazine:history_of_lightning,
137 | author = {{Aaron van Wirdum}},
138 | title = "The History of Lightning: from brainstorm to beta",
139 | year = "2018",
140 | howpublished = {\url{https://bitcoinmagazine.com/articles/history-lightning-brainstorm-beta/}}
141 | }
142 |
143 | @misc{gnosisforum:offchain,
144 | author = {{Martin K\"oppelmann}},
145 | title = "How offchain trading will work",
146 | year = "2015",
147 | howpublished = {\url{https://forum.gnosis.pm/t/how-offchain-trading-will-work/63}}
148 | }
149 |
150 | @misc{funfair,
151 | author = {{Jeremy Longley and Oliver Hopton}},
152 | title = "FunFair Technology Roadmap and Discussion",
153 | year = "2017",
154 | howpublished = {\url{https://funfair.io/wp-content/uploads/FunFair-Technical-White-Paper.pdf}}
155 | }
156 |
157 | @misc{alcio:dust,
158 | author = {{Antoine Le Calvez}},
159 | title = "When the Bitcoin dust settles",
160 | year = "2018",
161 | howpublished = {\url{https://medium.com/@alcio/when-the-bitcoin-dust-settles-878f3431a71a}}
162 | }
163 |
164 | @misc{ethwiki:data,
165 | title = "A note on data availability and erasure coding",
166 | year = "2018",
167 | howpublished = {\url{https://github.com/ethereum/research/wiki/A-note-on-data-availability-and-erasure-coding}}
168 | }
169 |
170 | @misc{vitalik:triangle,
171 | author = {{Vitalik Buterin}},
172 | title = "The Triangle of Harm",
173 | year = "2017",
174 | howpublished = {\url{https://vitalik.ca/general/2017/07/16/triangle_of_harm.html}}
175 | }
176 |
177 | @misc{sprites,
178 | author = {{Andrew Miller et. al.}},
179 | title = "Sprites and State Channels: Payment Networks that Go Faster than Lightning",
180 | year = "2017",
181 | howpublished = {\url{https://arxiv.org/abs/1702.05812}}
182 | }
183 |
184 | @misc{EIP897,
185 | author = {{Jorge Izquierdo and Manuel Araoz}},
186 | title = "{EIP} 897: {ERC} DelegateProxy",
187 | year = "2018",
188 | howpublished = {\url{https://eips.ethereum.org/EIPS/eip-897}}
189 | }
190 |
--------------------------------------------------------------------------------
/diagrams/README.md:
--------------------------------------------------------------------------------
1 | hopefully, in the future these diagrams will be replaced by bits of latex and tikz.
2 |
--------------------------------------------------------------------------------
/diagrams/initialization-dispute.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/diagrams/nonce-dependent-conditional-finalization.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/diagrams/small-tree.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/diagrams/tree.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | pdf:
5 | build: .
6 | command: >
7 | sh -c "pdflatex -shell-escape main.tex
8 | && bibtex main.aux
9 | && pdflatex -shell-escape main.tex
10 | && pdflatex -shell-escape main.tex"
11 | volumes:
12 | - .:/workdir
13 |
--------------------------------------------------------------------------------
/solidity-highlighting.tex:
--------------------------------------------------------------------------------
1 | \usepackage{listings, xcolor}
2 |
3 | \definecolor{verylightgray}{rgb}{.97,.97,.97}
4 |
5 | \lstdefinelanguage{Solidity}{
6 | keywords=[1]{anonymous, assembly, assert, balance, break, call, callcode, case, catch, class, constant, continue, contract, debugger, default, delegatecall, delete, do, else, event, export, external, false, finally, for, function, gas, if, implements, import, in, indexed, instanceof, interface, internal, is, length, library, log0, log1, log2, log3, log4, memory, modifier, new, payable, pragma, private, protected, public, pure, push, require, return, returns, revert, selfdestruct, send, storage, struct, suicide, super, switch, then, this, throw, transfer, true, try, typeof, using, value, view, while, with, addmod, ecrecover, keccak256, mulmod, ripemd160, sha256, sha3}, % generic keywords including crypto operations
7 | keywordstyle=[1]\color{blue}\bfseries,
8 | keywords=[2]{address, bool, byte, bytes, bytes1, bytes2, bytes3, bytes4, bytes5, bytes6, bytes7, bytes8, bytes9, bytes10, bytes11, bytes12, bytes13, bytes14, bytes15, bytes16, bytes17, bytes18, bytes19, bytes20, bytes21, bytes22, bytes23, bytes24, bytes25, bytes26, bytes27, bytes28, bytes29, bytes30, bytes31, bytes32, enum, int, int8, int16, int24, int32, int40, int48, int56, int64, int72, int80, int88, int96, int104, int112, int120, int128, int136, int144, int152, int160, int168, int176, int184, int192, int200, int208, int216, int224, int232, int240, int248, int256, mapping, string, uint, uint8, uint16, uint24, uint32, uint40, uint48, uint56, uint64, uint72, uint80, uint88, uint96, uint104, uint112, uint120, uint128, uint136, uint144, uint152, uint160, uint168, uint176, uint184, uint192, uint200, uint208, uint216, uint224, uint232, uint240, uint248, uint256, var, void, ether, finney, szabo, wei, days, hours, minutes, seconds, weeks, years}, % types; money and time units
9 | keywordstyle=[2]\color{teal}\bfseries,
10 | keywords=[3]{block, blockhash, coinbase, difficulty, gaslimit, number, timestamp, msg, data, gas, sender, sig, value, now, tx, gasprice, origin}, % environment variables
11 | keywordstyle=[3]\color{violet}\bfseries,
12 | identifierstyle=\color{black},
13 | sensitive=false,
14 | comment=[l]{//},
15 | morecomment=[s]{/*}{*/},
16 | commentstyle=\color{gray}\ttfamily,
17 | stringstyle=\color{red}\ttfamily,
18 | morestring=[b]',
19 | morestring=[b]"
20 | }
21 |
22 | \lstset{
23 | language=Solidity,
24 | backgroundcolor=\color{gray!2!white},
25 | extendedchars=true,
26 | basicstyle=\linespread{1}\footnotesize\ttfamily,
27 | showstringspaces=false,
28 | showspaces=false,
29 | numbers=none,
30 | numberstyle=\sfseries,
31 | numbersep=7pt,
32 | tabsize=1,
33 | breaklines=true,
34 | showtabs=false,
35 | captionpos=b
36 | }
37 |
--------------------------------------------------------------------------------