Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions class-23.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Intro to Blockchain Development

### Class 23 - Current Blockchain Research - Sidechains & Scaling

We've covered most of the common topics in blockchain, now we'll look at the actively researched ones. One big area of research is how to expand the transactions per second in a blockchain. Currently, bitcoin handles under 10 transactions per second and Ethereum under 20. At peak times, the Visa credit card network handles tens of thousands (~40,000) transactions per second. For cryptocurrencies to replace centralized payment mechanisms, one question to answer is scale.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question to answer is scale.

Maybe scalability is better?


While delegation can help increase transactions speed, it comes at the cost of increased centralization of a database (though there is some debate as to whether this is important).

Reading & Videos:

- [Authoritative Guide to Sharding](https://medium.com/nearprotocol/the-authoritative-guide-to-blockchain-sharding-part-1-1b53ed31e060) - Good overview to sharding a blockchain. There is a bit of marketing message at the end from Near protocol, so keep that in mind when reading.
- [Lighthouse](<https://github.com/sigp/lighthouse>) - An ethereum client currently working on sharding
- [Lightning Network Paper](https://lightning.network/lightning-network-paper.pdf) - This is the paper detailing how the lightning network works on bitcoin

### Scaling

The structure of a blockchain like bitcoin, ethereum or even a DPOS chain makes scalability difficult. In bitcoin, each party tries to keep a full set of the database or tries to mine based on hashes of it. Even in delegated proof of stake networks like EOS, all witness nodes try to validate all blocks. This differs from some distributed databases (thinking back to lecture 2 digging into blockchain fundamentals). A common strategy is to split up data for faster processing, or holding more data overall. Pruning can solve some of this, discarding unncecessary or stale data, but verifying the full history (without relying on hashes for stale data) is still a challenge.

Some active topics in blockchain research and development involve splitting up data into more manageable chunks, but still trying to take on the verifiablity of a blockchain. Many of these solutions are only starting to launch, and still in early stages (as of the date of the lecture). Some of the popular areas of research include:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

involve splitting up data into more manageable chunks, but still trying to take on the verifiablity of a blockchain.

involve splitting up data into more manageable chunks , but while remaining verifiable as a blockchain.


* Sharding
* Sidechains
* Channels / "Lightning Network"

### Sharding

In a sharded database, each node doesn't have to hold all of the content. For example, if I have the 4 servers (call them server A, B, C, D) and 8 pieces of data (data 1,2,3, … 8). In a sharded database, I might write data 1 to server A & server C, then data 2 to server B & server D (or any number of write configurations). Each hardware device has its own capacity for writes, so the write capacity of a distributed database can sometime surpass the write capacity of a single hardware device (or the total amount of data stored).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if I have the 4 servers (call them server A, B, C, D) and 8 pieces of data (data 1,2,3, … 8).

This is a sentence fragment. Suggested fix:

  • For example, assume that there are 4 servers (named A, B, C, D) and 8 pieces of data (named 1,2,3, … 8).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each hardware device has its own capacity for writes, so the write capacity of a distributed database can sometime surpass the write capacity of a single hardware device (or the total amount of data stored).

  • Make sure the students understand that you're talking about servers when you talk about hardware devices
  • Discuss why you're talking about write capacity. How does it relate to sharding or sharded databases?
  • Why is the write capacity significant?


In Bitcoin or Ethereum at the current time, we don't take advantage of this. Each computer maintains the full database (In the above example, server A holds data 1-8, as well as B, C & D). All of them maintain the state of the blockchain, so to interfere with any part of the blockchain, it would take over 50% of the processing power.

In a sharded blockchain, each node maintains only some of the data. There are numerous strategies in how the shards maintain state, splitting off specific contracts or dapps, splitting data randomly and other strategies. Sharded blockchains also have to deal with possible bad actors. In a sharded proof of work chain, any single shard could be compromised by a majority of bad actors. Others try to elect representatives such as a DPOS strategy to maintain data. A long-standing production solution has yet to be implemented (at the time of the lecture) and it is an area of strong interest.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharded blockchains also have to deal with possible bad actors. In a sharded proof of work chain, any single shard could be compromised by a majority of bad actors.

  • Discuss why or how any single shard/sharded chain can be compromised differently from a regular blockchain.


### Sidechains

Another strategy to handle scaling is a sidechain. While an asset can be defined securely in a very decentralized manner on a blockchain, it has to share the transactional capacity of that blockchain with each other asset or smart contract defined there. This can result in high gas fees or slow confirmation times exchanged for the increased security on the network.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define what sidechain is right after the 1st sentence.


A way around this is to define a copy or alternative blockchain that represents the asset, but reserved only for the asset. In LoomX (specialized towards video games), assets are defined on the ethereum mainnet and on a LoomX sidechain. They can be transferred rapidly and with very high volume in the sidechain, but traded openly on many exchanges or in many wallets with confidence on the Ethereum network. However, one network won't pick up the change in the asset on the other automatically, so it makes use of a token bridge to transfer it.

In the token bridge, assets are exchanged through a smart contract or deposit/withdraw address. They are locked or burned on one network, then made available on the second network (and vice versa). This allows a user to effectively move their assets in and out of the sidechain, selectively gaining the benefit of either. Sidechains exist on other popular protocols, offering users the ability to move their tokens into blockchains with greater transactional throughput, different computational functionality (like smart contracts) and other use cases.

### Lightning

Another solution is handling transactions off of the mainchain through a channel. The most popular implementation of this is Bitcoin's Lightning Network, and other implementations have called this channel-based payments system by the same name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define what a channel is after the first sentence.


In the lightning network, some amount of cryptocurrency is locked up in a payment channel (using a similar mechanism to the timelock from the bitcoin transaction. You can see more info in week #1, lecture #3).
50 changes: 50 additions & 0 deletions class-24.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Intro to Blockchain Development

### Class 24 - Current Blockchain Research - Cryptography

Another component currently investigated by blockchains are alternative cryptographic schemes. These can be used to increase privacy, enhance security or other benefits.

Reading & Videos:

- [Shor's Algorithm, Grover's Algorithm and the Blockchain](https://codeburst.io/quantum-threat-to-blockchains-shors-and-grover-s-algorithms-9b01941bed01) - Overview of quantum attacks to the blockchain.
- [CryptoNote](https://cryptonote.org/inside/) - Graphical breakdown of CryptoNote and its use of ring signatures. The most popular implementation of this scheme is currently Monero
- [What are zk-SNARKS (introduction by Zcash)](https://z.cash/technology/zksnarks/) - This is a short series of posts detailing how zero knowledge proofs work in the context of Zcash

### Privacy Concerns

The structure of a blockchain gives makes transactions open and verifiable which has driven the usage seen before. However, not all users wish their transactions to be open and verifiable. In bitcoin, the method of change addresses gives some degree of obscurity to transactions - a user could deny owning the change address a transaction was sent to. By design, the entire payment history, including current balances, is available for any to verify. This means that someone holding millions of dollars worth of cryptocurrency could have their address identified, possibly opening them up to physical harm or extortion by bad actors. It also disincentivizes some sensitive transactions - such as buying guns, drugs or other illegal transactions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure of a blockchain gives makes transactions open and verifiable which has driven the usage seen before.

This sentence doesn't make sense.

By design, the entire payment history, including current balances, is available for any to verify.

Revise to: "By design, the entire payment history, as well as the current balance of a single address, is available for anyone to verify."

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also disincentivizes some sensitive transactions - such as buying guns, drugs or other illegal transactions.

This sentence implies that illegal transactions and purchasing guns or drugs should be incentivized?? Aren't you currently listing negative consequences of public address histories?


##### Ring Signatures

One way to avoid this is to use a ring signature. Instead of a signing the transaction with a single private key matched to a public key, collections of public keys are formed into rings.

![Ring Signature](https://cryptonote.org/img/cn02.png)

In a ring signature, it can be verified that one member of the ring sent the transaction, without fully revealing which member did the sending.

##### One-time Addresses

Using a point multiplication along the curve from the base point of the address, the holder of a private key can generate a one-time public key. To do this, they use keys twice the length of those in bitcoin, and only use part for the public address, and the other portion to help generate a one-time address.

These one-time addresses are exposed to use for receiving funds, so a third-party verifier cannot prove which public key was sent the funds.

##### Masking Amounts

Amounts in Monero and cryptonote coins are additionally masked, adding a third layer of protection. By obscuring:

- Who is sending funds
- Which address is receiving
- Amount sent

It becomes extremely difficult to compromise the privacy of a user. The combination of these 3 methods gives users close to anonymous transactions, so they can buy drugs more easily.

##### zk-SNARKS

Zero knowledge cryptography has also been actively researched to provide an additional layer of privacy in cryptocurrency. In a zero knowledge system, we can consider the interaction between two parties: a prover (who makes some claim), and a verifier (who checks a claim). The following conditions should apply:

1. A verifier or prover can prove that a particular statement is true, without any information beyond the statement an inputs (we can represent these in a circuit)
2. No interaction is needed between the prover and verifier to check this claim (non-interactivity)
3. It is computationally unfeasable to fake the proof of a false statement
4. A proof verifies that not only is the statement is true, but also the inputs demonstrate knowledge of why they are true

zk SNARK is short for *Zero-Knowledge Succinct Non-interactive ARgument of Knowledge*, referencing the above properties. While we can investigate zkSNARKS and the math behind them in greater depth in the future (an additional class after this curriculum), we will cover why this type of system is useful.
9 changes: 9 additions & 0 deletions week-8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Week 8

This week we will have a guest lecture and explore some active topics in cryptocurrency research and development.

- **Guest Lecture - UI/UX** - Major exchange hacks, and how we can learn from them when developing custodial applications
- **Research - Scaling** - Major wallet hacks, and how we can write secure client side software
- **Research - Cryptography** - Major protocol hacks, and how to secure distributed software

Many of these topics are just starting to be proven and tested and don't have the amount of testing that Bitcoin and Ethereum offer. They do offer many benefits and are worth studying for any cryptocurrency student. More classes will be offered in depth on these topics in the future.