Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Reinforcement Learning #7

Open
yeqbfgxjiq opened this issue Sep 1, 2019 · 1 comment
Open

Reinforcement Learning #7

yeqbfgxjiq opened this issue Sep 1, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@yeqbfgxjiq
Copy link
Contributor

The idea is to (somewhat) follow the practice of reinforcement learning as described by Michael Nielson in Augmenting Long-term Memory and mnemonic mediums. This could be questions within the course, the option to sign up for email reminders to reinforce what you've been learning (like qcvc does), or community made study guides. Ideally this will help make learning as easy as possible by automating many of the strategies that help humans learn faster and remember longer.

@yeqbfgxjiq yeqbfgxjiq added the enhancement New feature or request label Sep 1, 2019
@yeqbfgxjiq
Copy link
Contributor Author

Review Questions


Chapter 1.1

Describe the main effect of a cryptographic hash function

  • preimage => hash function => hash

What is the preimage to a hash function?

  • the data that goes in before it gets hashed

The data that goes into a hash function is also called the?

  • preimage

If you are given a hash that is cryptographicly strong, could you determine the preimage?

  • no

What are the main properties of (cryptographic) hash functions?

  • preimage resistance
  • 2nd preimage resistance
  • collision resistance
  • random oracle

What is preimage resistance?

  • we cannot reverse a hash function
  • given a hash function's output, we cannot determine it's input

What is 2nd preimage resistance?

  • if we have a hash function we cannot find 2 pieces of data that create the same hash
  • a hash function will not produce 2 or more preimages for a given hash - all hashes correspond to unique inputs

Why is 2nd preimage resistance important?

  • We can reveal a hash of data at time X, and then reveal the preimage of that hash at time Y, and this will verify that at time X we committed to the preimage. This is useful in voting mechanisms, games, and much more.

What is collision resistance

  • you cannot find 2 preimages that hash to the same thing (this is essentially the same thing as 2nd preimage resistance)

Another name for collision resistance is?

  • 2nd preimage resistance

What does the random oracle property imply in the context of hash functions

  • the output of a hash function is completely random and has no statistical correlations with the preimage

What is onion hashing?

  • the hash of a hash of a hash of a... (hashing a hash repeatedly)

What is the core feature of a signature?

  • it proves that the signer did/signed something

A public key is like your

  • address or username

A private key is like your

  • password or signature

What is one use of public/private keys?

  • verify the source (signer) of messages
  • prove that a certain thing was created or agreed to by verifying the signatures
  • allowing you to receive messages/funds to an address that is public (your public key), but only you can control (with your private key)

If someone gains access to your private key

  • they are able to impersonate your account and sign things as well as control any funds/data that account might own

Why is it so important that users control their keys in the blockchain space?

  • because the private keys are what verify your account, and without them you have no control over your data/funds

Chapter 1.2

What is a state transition function?

  • a function that takes in a state, and based on some rules, outputs a new state

What are some examples of state in the real world?

  • a chess board at any point in the game
  • any block in a blockchain (each block is a particular state, and the chain is the history of state changes over time)
  • the world at any point in time (assuming you could "freeze" time, which is highly questionable)

What are some examples of a state transition function?

  • the rules of chess
  • the rules of the Ethereum protocol
  • the rules of any Ethereum dApp
  • the laws of physics
  • the laws of mathematics

Why is the state transition function so important in the context of a blockchain?

  • it determines what is and is not a valid transaction (no double spends!)
  • it processes all tx
  • it's what finalizes a block and adds a new state to the chain

What is the difference between the history and the state?

  • the state represents all the data of a system at a particular moment in time (often this refers to the current "state" of that data in the system), whereas the history represents an account of all the times we've applied the state transition function to the state and what that resulting state was

Which is larger, the history or the state? Why?

  • the history is longer because it is an account of every state that has occurred in the past, whereas the state is just the data in the system at any point in time

Chapter 1.3

Why are nonces important?

  • they prevent double spends
  • they prevent replay attacks

A nonce is associated with a unique

  • account and transaction

Do nonces stay the same or change?

  • they change
  • they get incremented every time an account sends a transaction

When you sign messages will they always do exactly what you want?

  • No! That's why the signature should specify exactly who, what, when, why, where the message is for

What is replay protection?

  • making sure that a transaction can only be processed once (no double spends!)

What is a nonce?

  • A nonce is a number that is unique to every Ethereum account and attached to every transaction from that account. This number is incremented with every new transaction.

Why are nonces important?

  • Every transaction's signature is a hash of many things including the data of the transaction, the account nonce, and the account key. Thus every authentic transaction signature is unique and every unique transaction is recorded in the history. If someone tries to resend the same transaction twice, the signature will match another transaction in the history. According to the rules of Ethereum (the state transition function) this is invalid. Invalid transactions are not processed by the network. Because all nodes on the network follow the same rules, this works.

What if a node makes up their own rules?

  • Then it wouldn't be an Ethereum node because Ethereum nodes all follow the Ethereum protocol (state transition function) which determines what is and is not valid.
  • If a node goes rouge and tries to process invalid transactions they would have a different state than the rest of the blockchain. This would make all their future transactions and blocks different than the rest of the Ethereum nodes, and thus would be rejected by the blockchain.

Chapter 1.4

What is an example of an account model blockchain?

  • Ethereum

What is an example of a UTXO model blockchain?

  • Bitcoin

What does UTXO stand for?

  • un spent transaction output

Are UTXOs blockchain transaction anonymous?

  • NO! Only purely private way to send transactions is zero knowledge proofs (zcash).

What is the best way to send private transactions?

  • Transactions verified by zero knowledge proofs (zcash and soon some Ethereum dApps)

Account model (Ethereum) :

  • A global mapping of account->balance
  • Sends reduce one account’s balance and increase another account's balance

UTXO model (Bitcoin)

  • Every send must include the entire account balance.
  • Sends can specify multiple recipients.
  • Sends can originate from multiple senders.

What is blockchain "dust"?

  • a very very low value amount in an account that isn't even high enough to cover the transaction fee to send it

Is using a new address for every transaction a good way to preserve privacy?

  • No. It's better than nothing, but if you want to preserve privacy use zk-snark based transactions (zcash)

What is one of the major benefits of a UTXO model?

  • explicit dependencies - you can only spend unspent transaction outputs, so if you try to spend the output of a transaction that doesn't exist it will obviously be marked invalid.
    • note: the origin of all utxo transactions is the "coinbase" transaction (block reward) that creates a new coin, then that "coin" is split up as it gets spent more and more
  • spending UTXOs explicitly depends on a specific unspent output, thus you can run transactions in parallel without worrying about ordering (no double spends)

Why would you choose an account model vs a utxo model?

  • utxo
    • explicit dependencies (no double spends)
    • parallel processing (because ordering doesn't matter)
  • accounts
    • easier to build wallets/infrastructure for
    • less conceptual complexity

Chapter 1.5

Is a system ever truly centralized or decentalized?

  • Not exactly... it's more like spectrum with lots of shades of grey in between

Are decntralized systems automatically better than centralized systems?

  • Depends on your goals and your use case. One size does not fit all.

Are decentralized systems every truly "trustless"?

  • No. You're just switching your trust from people and their preferences to mathematics and computer code.

What are a few downsides of centralized systems?

  • Very hard to prove if the central operator is honest or lying
  • Very easy for the central operator to exert power to favor their own interests vs those of users
  • Very easy for a central operator to deny some users service or to constrict the use of users
  • Data can be lost, corrupted, or stolen
  • Central operators are incentivized to extract as much value as they can from users

What are some benefits of decentralized systems?

  • Everything is publicly verifiable so you know that no one is cheating
  • Anyone can do whatever they want as long as it's within the agreed upon rules of the protocol
  • If someone wants to break the rules of the protocol they are free to go roll their own blockchain (fork)
  • Users own their data and connect via their own node on the network
  • With well designed cryptoeconomic mechanisms users are incentivized to contribute value to the network, creating value for themselves and others

Chapter 2.1

In decentralized networks do messages always get processed right away?

  • No. We have no idea if or when messages will arrive. This is one of the challenges in designing decentralized networks.

What is a synchronous network model?

  • one in which there is an upper bound on how long it will take a message to be sent and delivered

What is a partially synchronous network model?

  • there is an upper bound on how long it will take messages to be delivered, but we don't know what that upper bound is

What is an asynchronous network model?

  • we do not know if or when messages will arrive

Chapter 2.2

Why are double spends such a problem?

  • they allow users to spend money they don't have
  • they partition the network from a shared state of consensus (a single blockchain) to multiple different forks (multiple blockchains) that are all disconnected from each other

How can we prevent double spends?

  • we can use nonces to order transactions
  • we can use UTXOs to create explicit dependencies for transactions

Are double spends more likely to be a problem in a synchronous or asynchronous network?

  • asynchronous network because we never know if or when messages are going to arrive
    a user could send a message, but not have it processed in a reasonable amount of time and so they send it again
  • a user could send multiple messages that spend the same account balance, but we wouldn't be able to see that until later if the messages were not processed both at the same time

What happens if different nodes in a network have different versions of a state?

  • they either have to resolve the difference via the network protocol rules, or fork and create different versions of the network with different states

Chapter 2.3

What are some problems with using timestamps for security critical protocols?

  • decentalized blockchains are asynchronous so the first valid message is the one that is processed, even if another message is later received that invalidates that earlier message (in this case the second would be discarded because the first was already processed)
  • a user can selectively propagate different messages to different nodes in the network, all of which are individually valid, but tog ether are not
    • example: user has balance of 10tokens, sends 3 messages spending those 10 tokens on different things, each message is valid, but together only 1 can be valid the rest are double spends.
  • a user can always spoof the timestamp by altering the clock on their local machine
    • there are only a handful of truly synchronous clocks around the world, and most other computers/services are slightly out of sync with those clocks (note: Cloudflare is trying to help fix this with their time services)

Chapter 2.4

What are some advantages of a Proof of Authority network?

  • fast transaction times
  • easy to fix errors
  • (potentially) lower fees due to a lower cost to secure the network

What are some disadvantages of Proof of Authority networks?

  • they're essentially a slightly more decentralized version of a central payment/data processor
  • no guarantees of service (censorship resistance) or availability (liveliness)
  • network rules (protocol) is determined by whoever has authority and can change at any time

What's an alternative to Proof of Authority networks?

  • a truly decentralized network where anyone has the authority to join as a node and validate transactions (Bitcoin, Ethereum, etc)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant