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
If you are interested in how to use NoteStream to privately stream Ethereum tokens, then please look at our [Getting Started](./getting_started/README.md) page.
4
+
5
+
# Github
6
+
7
+
The codebase for the NoteStream contracts and frontend are hosted publicly on [Github](https://github.com/TomAFrench/NoteStream).
8
+
9
+
# Networks
10
+
11
+
As NoteStream is in rapid development, it is currently only deployed on the Rinkeby test network. We hope to deploy to other testnets and subsequently the Ethereum Mainnet in due time.
12
+
13
+
# Gas Costs
14
+
15
+
We have not measured the gas costs associated with using NoteStream in detail, however we expect the majority of the cost to be from validating the ZK proof required for all transactions using AZTEC Protocol. Since EIP 1108, this takes in the range of 200,000-300,000 gas which corresponds to roughly 5-6x that of a standard ERC20 token transfer.
Many of the tokens which you will want to stream are going to be ERC20 tokens such as DAI. These don't have the privacy features needed for NoteStream to work. Luckily we can wrap these tokens into an ZkAsset before we start streaming them.
5
+
To do this click the "Deposit ERC20 tokens for private assets" and enter the number of tokens you want to convert into ZkAssets.
6
+
7
+
## Deposit a note into a stream
8
+
9
+
You can create a stream by clicking the "Create a new stream" button and then following the shown instructions.
10
+
It is important to note that the stream recipient must have registered for an AZTEC address in order for then to be able to receive a stream. This is done automatically upon first visiting the NoteStream website.
11
+
12
+
## Withdrawing from a stream
13
+
14
+
The NoteStream app continually calculates the maximum amount which you can withdraw from the streams you are receiving. If you click the "withdraw" button next to the stream you want to withdraw from then a ZK proof will be generated to withdraw this amount from the stream note to your wallet.
15
+
16
+
## Converting back into ERC20 tokens
17
+
18
+
Once you have withdrawn your ZkAssets, you can convert them back into ERC20 tokens in much the same way as converting ERC20s into ZkAssets.
19
+
Of course, when you convert ZkAssets back into ERC20 tokens you lose the privacy properties given by AZTEC notes. There is also the possibility to leak information on the value of a stream if you immediately convert a withdrawal back into ERC20 tokens.
20
+
21
+
# Terminology
22
+
## AZTEC Note
23
+
24
+
AZTEC notes can be thought of as tokens on Ethereum for which all balances are encrypted so only their owners can view them.
25
+
This is a gross oversimplification as these notes instead work on UTXO model (similar to Bitcoin) rather than then fungible balance model of ERC20 tokens which are all familiar with.
26
+
27
+
## ZkAsset
28
+
29
+
A zero knowledge representation of an ERC20 token. For example: DAI is represented by the zkDAI ZkAsset.
30
+
31
+
## Stream Note
32
+
The AZTEC note held by the NoteStream contract for a given stream. This note represents the total value of the stream at any time.
33
+
34
+
# How it works
35
+
## Where is my money held?
36
+
37
+
Each stream is made up of an AZTEC note locked on the NoteStream smart contract. The logic of this smart contract is such that only the stream's sender or receiver may interact with this note.
38
+
39
+
## How can my streams be private if everything on Ethereum is public?
40
+
41
+
You're right that everything that happens on the Ethereum network is available for anyone to inspect, however NoteStream uses AZTEC Protocol which allows funds to be transferred as "notes" for which the value is encrypted. Everyone can see that a stream exists but nobody but you will know how much value it contains.
42
+
43
+
# Interacting with NoteStream
44
+
## Can I cancel streams?
45
+
46
+
Yes. Both the stream sender and recipient can cancel the stream at any time. This will send the appropriate fraction of the stream note's value to each party and then delete the stream.
47
+
Can I modify a stream in progress?
48
+
No. We're looking at the possibility to allow a stream's sender to modify a stream in progress in certain ways, e.g. extending the stream by topping up the stream note's value.
49
+
50
+
# Privacy
51
+
52
+
There are a number of privacy enhancing measures you can take using ZkAssets which are general rather than NoteStream-specific. Please see ["Using Aztec notes"](./using_aztec/README.md) for more information.
53
+
54
+
## NoteStream-specific public information
55
+
56
+
There are two times at which information about the stream is made visible
57
+
58
+
### Creating a stream
59
+
60
+
A stream is made up of the following information:
61
+
- Sender address
62
+
- Recipent address
63
+
- Stream note hash
64
+
- ZkAsset address
65
+
- Start Time
66
+
- Stop Time
67
+
68
+
An observer will then be able to see who is streaming to whom, what kind of token they are streaming and when this stream occurred. e.g.
69
+
> Alice streamed Bob an unknown amount of zkDAI represented by the AZTEC note with hash 0x1a3...cE1 from 9:00am until 5:00pm on 12/4/20
70
+
71
+
### Withdrawing/cancelling a stream
72
+
73
+
Withdrawal and cancellation transactions leak the same information. Here we discuss a withdrawal transaction as an example.
74
+
75
+
Each withdrawal transaction includes information on the fraction of the stream's duration which is being withdrawn. This is required such that the NoteStream contract can ensure that the withdrawal is valid.
76
+
An observer may then for example see that the recipient is withdrawing a value corresponding to a certain fraction of the remaining value on the stream note.
77
+
78
+
However it is important to note that without knowledge of the initial value of the stream note then it is impossible to determine the absolute value being withdrawn. e.g.
79
+
80
+
> Bob withdrew 50% of the value of the stream at 1:00pm on 12/4/20
81
+
82
+
83
+
# Security
84
+
## Is NoteStream safe?
85
+
Currently there are a number of known security flaws which mean that NoteStream should not be used for any Mainnet funds (as such, there is no current Mainnet deployment.). I'm currently speaking with AZTEC about updates to their SDK in order to fix these.
86
+
87
+
## How do I know you can't steal my funds?
88
+
89
+
All Notestream contracts are open source and verified on Etherscan.
# Issues associated with depositing/withdrawing ERC20 tokens
2
+
3
+
An important factor to keep in mind is that the process of depositing ERC20s into a ZkAsset doesn't immediately make them private, i.e. there will be a transaction visible on the blockchain in which a certain amount of DAI is converted into a number of zkDAI notes.
4
+
It's impossible to tell what each individual note is worth but the sum of them must equal the number of ERC20s deposited. In the worst case scenario, if all of those notes are then used in a single transaction (such as creation of a NoteStream stream) then it's obvious that the transaction value is equal to that of the ERC20 deposit.
5
+
6
+
This might sound like it means that it's impossible to have privacy using ZkAssets as anyone can trace your notes back to when they were deposited. However as people send ZkAssets to each other and notes are split and joined, a given deposit may be linked to a huge amount of notes spread over a vast number of people. We're very quickly at a point where we can see that 1000 people all together own the value from a given deposit but it's impossible to work out exactly who owns what fraction.
7
+
8
+
## Improving privacy of deposits
9
+
10
+
Even before this mixing behaviour there are steps you can take to improve your privacy. When depositing ERC20s into a ZkAsset its possible to create a number of notes which have zero value attached. This might sound pointless but it allows you then spend your entire deposit without letting anyone know how much you've spent.
11
+
12
+
An observer will only be able to tell that your stream is worth at most equal to your deposit but it could be anything less than that.
13
+
This behaviour is implemented automatically by the AZTEC sdk so you don't need to worry about it.
14
+
15
+
## Take aways
16
+
17
+
In order to improve the privacy of your transactions using ZkAssets it is best to
18
+
19
+
- Have a long history of transactions using this ZkAsset since your last deposit (idealling receiving ZkAsset funds from other people as well)
20
+
- Deposit an amount of ERC20 tokens in excess of what you are planning on immediately streaming.
0 commit comments