Skip to content

Instantly share code, notes, and snippets.

@genecyber
Last active September 17, 2019 01:02
Show Gist options
  • Save genecyber/29f93d9f6ebc8ce3d92c443bd84cc3c9 to your computer and use it in GitHub Desktop.
Save genecyber/29f93d9f6ebc8ce3d92c443bd84cc3c9 to your computer and use it in GitHub Desktop.
OpenAI gpt-2 Trained on Bitcoin Whitepaper and Ethereum Yellow paper

The main purpose of a native token system is to serve as a regulatory layer. By having a Turing-complete language, a cryptocurrency with one operation, and a token system with two operations, we can set up a system where any transaction can be programmed to take any number of different values, and any number of different actions can lead to a different result. This allows for the creation of a cloud computing market where any user can participate with their desktop, laptop or specialized server, and spot-checking of their code can be done automatically by the cloud provider to ensure that the transaction is valid and that the peer-to-peer network is not working to generate an alternate chain. This removes the need for centralized mining pools and automated trading platforms; although trading platforms can still serve the legitimate role of evening out the randomness of reward distribution, they are no longer needed as the protocol is Turing-complete.

The token system described above is not fully Turing-complete, but it is close enough. The key point to understand is that the state is made up of objects called "states" that are made up of objects called "accounts" and "value" objects that are made up of objects called "contracts". The purpose of the state is to allow the caller to make

The main purpose of a native token system is to serve as a baseline against which other cryptocurrencies can be compared, so that if one is found to be inadequate, another can be substituted. By substituting a different subset of operations for some of the basic elements of the Bitcoin blockchain, the Bitcoin network can be made more efficient, thereby allowing for a more stable price and providing an alternative way for people to obtain currency.

The Bitcoin-based approach may seem highly inefficient at first glance, because it needs to store the entire state with each block, but in reality efficiency should be comparable to that of the vast majority of Bitcoin implementations, since the vast majority of Bitcoin processing is CPU-intensive. The reason is that the state is stored in the tree structure, and after every block only a small part of the tree needs to be changed. Thus, in general, between two adjacent blocks the vast majority of the tree should be the same, and therefore the data can be stored once and referenced twice using pointers (ie. hashes of subtrees). Additionally, at least one ancestor of every block must exist, must be a valid block, and must be different from all blocks since the previous block. This eliminates the need for centralized mining pools; although mining pools can still serve the legitimate role

The main purpose of a native token system is to provide a blockchain with a built-in means of storing a state transition function, allowing users to encode their own private key and private key encryption, private key authentication and private key forfeiture, among dozens of other such concepts, into a blockchain transaction. Theoretically, this allows for the creation of a decentralized file storage ecosystem, where individual users can earn small quantities of money by renting out their own hard drives and unused space can be used to further drive down the costs of file storage.

The mechanism behind Ethereum contract execution is surprisingly simple. While the Ethereum virtual machine is running, its blockchain transaction database is updated with the new transaction data, and the state is changed so that the transaction is found by running a cryptographic hash against the transaction data and a list of all of the transactions that have taken place since the previous block. Because every transaction in the blockchain database is unique, the only way to create a duplicate transaction is simply trial and error, repeatedly incrementing the nonce and then checking the transaction for duplicates. If any do exist, the original transaction is discarded and a new one is created using the hash of the discarded transaction as the key.

The Merkle tree protocol is arguably essential to long-term

The main purpose of a native token system is to serve as a regulatory layer. By having a Turing-complete programming language, a cryptocurrency, and a decentralized consensus system, we will be able to create a platform on which any programmer can create any smart contract or transaction type they please, provided that they are not abusing the system to cheat. This allows us to include a large number of benefits into a single platform, while at the same time maintaining a large number of costs, such as lower levels of generality, lower levels of flexibility, and greater levels of complexity. The benefits of Ethereum-based meta-protocols are arguably greater, but the costs of Ethereum-based Turing-completeness are more appropriately borne by the larger cryptocurrency ecosystem.

Currency And Issuance The Ethereum protocol includes an optional currency, ether, which serves the dual purpose of providing a primary liquidity layer to allow for efficient exchange between various types of digital assets and, more importantly, of providing a mechanism for storing value. In the standard implementation, the only mechanism that can issue and revoke digital tokens is through a complicated series of transactions that take up valuable computational resources. The purpose of this is to make digital tokens "usable" for non-computational purposes, thereby avoiding the

The main purpose of a native token system is to serve as a foundational layer over top of Bitcoin-based meta-protocols, allowing Bitcoin transactions to be sent from one cryptocurrency to another without needing to worry about storing the transaction data or retrieving the transaction history. Over the course of the Bitcoin blockchain, the state is made up of messages received from transaction senders messages received from transaction senders and a list of all of the transactions that have been added to the state. Over time, this creates a persistent, ever-growing, "state tree" containing every transaction that has taken place in the Bitcoin blockchain. The state is made up of messages received from transaction senders messages received from transaction senders and a list of all of the transactions that have been added to the state. Over time, this creates a persistent, ever-growing, "state tree" containing every transaction that has taken place in the Bitcoin blockchain. The state is made up of messages received from transaction senders messages received from transaction senders and a list of all of the transactions that have been added to the state. This allows the protocol to retrieve the state from the last

If I knew then what I knew now about blockchain.

The state A is changed from what was before, and the state transition function returns an error.

The state S is the same as before, but the contract's output is changed to indicate that the previous hash was correct.

The contract's input is the same as before, but the output changes to indicate that the previous hash was incorrect.

The contract's contract code is:

if !self.storage[calldataload(calldataload(calldataload(calldataload(calldataload(calldataload(n) + ud) Then, execute the following code at the command line:

if !self.storage[calldataload(calldataload(calldataload(calldataload(n) + ud) The contract's storage will then be:

[0,i,K,V] [1,i] [2,i] [3,i] [4,i] [5,i] [6,i] [7,i] [8,i] [9,i] [

If I knew then what I knew now about blockchain. if I had known then, what if I had only known then that the next block would be a lie?

There is another interesting property of the Merkle tree protocol that is not covered by other protocols. Although there are many ways to classify data fed by Merkle trees, the simplest approach is through the Merkle tree protocol, where each node in the Merkle tree represents a transaction and each node is a Merkle branch. This allows for the analysis of only the root of the Merkle tree, allowing one to determine the likely order of execution of the transaction and the root of the tree, and the likely state of the block after a certain point in the sequence. Although this approach is valid, its fault is that it does not include all of the details of the transaction, block and block context. Hence, the protocol is not just a protocol for executing arbitrary code, but also a protocol for generating arbitrary code. The protocol is not just a protocol for executing arbitrary code, but also a protocol for constructing arbitrary code.

The Merkle tree protocol is arguably essential to long-term sustainability. A "full node" in the Bitcoin network, one that stores and processes

If I knew then what I knew now about blockchain. if !self.storage[hash] 9. Peer-to-peer gambling. if !self.storage[hash] 10. Prediction markets. if !self.storage[hash] 11. On-chain decentralized marketplaces, using the identity and reputation system as a base. 12. On-chain decentralized marketplaces, using the identity and reputation system as a base. The significance of the "decentralized autonomous corporation" (DAC) as an alternative to the centralized model of a corporation is well-understood. The purpose of the "decentralized autonomous community" (DAC) is to serve as a catalyst for change in the autonomous vehicle industry, by allowing the creation of a database containing the ownership status of vehicles, a mechanism for voting on which transactions to include, and a mechanism for retrieving the current transaction status. The database would be maintained by the community, and each node would have a small role, being as follows:

  1. Allow other nodes to query for the status of the vehicle, but require a 51% majority
  2. Allow other nodes to query for the status of the ==================== If I knew then what I knew now about blockchain.

The 'smart' contracts' described above are implemented by the Ethereum protocol, and not Bitcoin or Ethereum Classic.

The Ethereum protocol should be as simple as practical, but it may be necessary to have quite a high level of complexity, for instance to scale, to internalize costs of storage, bandwidth and I/O, for security, privacy, transparency, etc. Where complexity is necessary, documentation should be as clear, concise and up-to-date as possible, so that someone completely unschooled in Ethereum can learn it and become an expert.

See the Yellow Paper for the Ethereum Virtual Machine (which is useful as a specification and as a reference for building an Ethereum client from scratch), while also there are many topics in the Ethereum wiki, such as sharding developmment, core development, dapp development, research, Casper R&D, and networking protocols. For research and possible future implementation there is ethresear.ch.

Also see the Yellow Paper for the Ethereum Virtual Machine and the Ethereum wiki for results.

  1. Peer-to-peer gambling. Any number of peer-to-peer gambling protocols, such as Frank Stajano and Richard Clayton's ==================== If I knew then what I knew now about blockchain.

Messages and Transactions The Ethereum protocol is not a message broker, nor is it intended to be. It is possible to construct a message broker on the Ethereum blockchain, using the Ethereum protocol to send messages from one account to another, and the Ethereum protocol to interpret the data being sent from the sender to compute the output account's balance. This allows the creation of a cloud computing market where any account can participate, with the exception of the sender, which is enforced by the cloud computing service provider. The disadvantage of this approach is that the sender and the recipient of a message need to be physically located, but the offset created by the offsetting message offsetting offsetting the sender's account from the end allows the recipient to send the message to anyone in the world. The advantage of this approach is that the sender and the recipient of a message can be anywhere in the world, and the cost of transportation is justifiable if the message is small and unimportant. The disadvantage of this approach is that the sender and the recipient of a message need to be physically located, but the offset created by the offsetting message offsetting the sender's account from the end allows the

"We have a problem in Ethereum: the majority of network nodes do not follow protocol", says Vitalik Buterin, "because they do not have the security guarantees".

The solution that we will propose is simple: all nodes on the Ethereum network will be required to enforce the protocol, and only the very best nodes will be allowed to influence the protocol. The reason why this works is that Ethereum multisig is based on a blockchain protocol called SchellingCoin, which is designed to be as simple as practical, but at the cost of some data storage or time inefficiency. SchellingCoin basically works as follows: N parties all put into the system the value of a given datum (eg. the ETH/USD price), the values are sorted, and everyone between the 25th and 75th percentile gets one token as a reward. Everyone has the incentive to include the most useful transaction first. This creates a decentralized protocol in which any node can participate, and the vast majority of the work will be done by the very few mining nodes that are still capable of keeping up with the network.

Scalability One common concern about Ethereum is the issue of scalability. Like Bitcoin, Ethereum suffers from the flaw that every transaction needs to be processed by every node in the network. With Bitcoin, the size of the current blockchain rests at about 15 GB, growing by about 1 MB per hour. If the Bitcoin network were to process Visa's 2000 transactions per second, it would grow by 1 MB per three seconds (1 GB per hour, 8 TB per year). Ethereum is likely to suffer a similar growth pattern, worsened by the fact that there will be many applications on top of the Ethereum blockchain instead of just a currency as is the case with Bitcoin, but ameliorated by the fact that Ethereum full nodes need to store just the state instead of the entire blockchain history.

The problem with such a large blockchain size is centralization risk. If the blockchain size increases to, say, 100 TB, then the likely scenario would be that only a very small number of large businesses would run full nodes, with all regular users using light SPV nodes. In such a situation, there arises the potential concern that the full nodes could band together and all agree to cheat in some profitable fashion (eg. change the block reward, give themselves BTC). Light nodes would have no way of detecting this immediately. Of course, at least one honest full node would likely exist, and after a few hours information about the fraud would trickle out through channels like Reddit, but at that point it would be too late: it would be up to the ordinary users to organize an effort to blacklist the given blocks, a massive and likely infeasible coordination problem on a similar scale as that of pulling off a successful 51% attack. In the case of Bitcoin, this is currently a problem, but there exists a blockchain modification suggested by Peter Todd which will alleviate this issue.

In the near term, Ethereum will use two additional strategies to cope with this problem. First, because of the blockchain-based mining algorithms, at least every miner will be forced to be a full node, creating a lower bound on the number of full nodes. Second and more importantly, however, we will include an intermediate state tree root in the blockchain after processing each transaction. Even if block validation is centralized, as long as one honest verifying node exists, the centralization problem can be circumvented via a verification protocol. If a miner publishes an invalid block, that block must either be badly formatted, or the state S[n] is incorrect. Since S[0] is known to be correct, there must be some first state S[i] that is incorrect where S[i-1] is correct. The verifying node would provide the index i, along with a "proof of invalidity" consisting of the subset of Patricia tree nodes needing to process APPLY(S[i-1],TX[i]) -> S[i]. Nodes would be able to use those Patricia nodes to run that part of the computation, and see that the S[i] generated does not match the S[i] provided.

Another, more sophisticated, attack would involve the malicious miners publishing incomplete blocks, so the full information does not even exist to determine whether or not blocks are valid. The solution to this is a challenge-response protocol: verification nodes issue "challenges" in the form of target transaction indices, and upon receiving a node a light node treats the block as untrusted until another node, whether the miner or another verifier, provides a subset of Patricia nodes as a proof of validity.

After having implemented this on my system, I opened it up to the rest of the world.

The system

is written in the low-level EVM code. This means that EVM code can encode any computation that can be conceivably carried out, including infinite loops. EVM code allows looping in two ways. First, there is a JUMP instruction that allows the program to jump back to a previous spot in the code, and a JUMPI instruction to do conditional jumping, allowing for statements like while x < 27: x = x * 2. Second, EVM code allows looping in the form of JUMPI, allowing for statements like while x < 27: x = x * 2. This allows looping through recursion, but it does lead to programs that become very space-inefficient as they go along. For example, implementing an alternative elliptic curve signature algorithm would likely require 256 repeated multiplication rounds all individually included in the code.

As an additional firewall, a new key pair should be used for each transaction to keep them from being linked to a common pool of gas. Some pools may wish to keep this information private, and if so, make it public. However, this information is still usable by pool administrators for research and possible future implementation.

The system

is not a complete programming language, but it is a good approximation of a complete programming language, using a small subset of programming concepts. The major exception is the concept of infinite loops, which is implemented by the EVM code itself. EVM code allows looping in two ways. First, there is a JUMPI instruction that allows the program to jump back to a previous spot in the code, and a JUMPI instruction to do conditional jumping, allowing looping through recursion. Second, EVM code allows looping in the form of a for loop, allowing the same code to be used to loop and then stop halfway through to reset the state. This allows the program to start all over again from the beginning, but with a new set of inputs and outputs that are slightly different.

The system

is not a Turing-complete programming language, but it is reasonably complete, using a subset of Turing concepts. The major exception is the concept of infinite loops, which is implemented by the EVM code itself. EVM code allows looping in two ways. First, there is a JUMPI instruction that allows the program to jump back to a previous spot in the code, and a JUMPI instruction to do conditional jumping, allowing looping through recursion. Second, EVM code allows looping in the form of a for loop, allowing the same code to be used to loop and then stop halfway through to reset the state. This allows the program to start all over again from the beginning, but with a new set of inputs and outputs that are slightly different.

The system

is Turing-complete, but not Turing-complete Turing-complete programming languages are not very common, and even rarer are Turing-complete programming languages. The reason is that Turing-completeness is no longer a compelling enough barrier to entry for the vast majority of programmers, and so the vast majority of new programmers will never learn to program at all. EVM programming does this by having a Turing-complete language inside the EVM that is also Turing-complete, allowing EVM code to encode any computation that can be conceivably carried out. EVM code allows looping in two ways. First, there is a JUMPI instruction that allows the program to jump back to a previous spot in the code, and a JUMPI instruction to do conditional jumping, allowing looping through recursion. Second, EVM code allows looping in the form of a for loop, allowing the same code to be used to loop and then stop halfway through to reset the state. This allows the program to start all over again from the beginning, but with a new set of inputs and outputs that are slightly different.

This design would allow looping through an infinite loop, but it would need to be combined with another design to actually implement it. Alternately, one could loop infinitely with one operation, producing an infinite loop that runs out of gas and stops halfway through.

Ethereum State Transition Function ethertransition.png

The Ethereum state transition function, APPLY(S,TX) -> S' can be defined as follows:

Check if the transaction is well-formed (ie. has the right number of values), the signature is valid, and the nonce matches the nonce in the sender's account. If not, return an error. Calculate the transaction fee as STARTGAS * GASPRICE, and determine the sending address from the signature. Subtract the fee from the sender's account balance and increment the sender's nonce. If there is not enough balance to spend, return an

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment