Adam Caudill

Security Leader, Researcher, Developer, Writer, & Photographer

Insane Ideas: Blockchain-Based Automated Investment System

This is part of the Insane Ideas series. A group of blog posts that detail ideas, possible projects, or concepts that may be of interest. These are ideas that I don’t plan to pursue, and are thus available to any and all that would like to do something with them. I hope you find some inspiration – or at least some amusement in this.

A few months ago I was reading about high-frequency trading (HFT) – algorithms that allow investors to make money essentially out of nothing by executing trades at high speed, and leveraging the natural (and artificial) volatility of the market. While contemplating how HFT could be applied to a blockchain environment, I had an idea that I considered to be equal parts brilliant and insane (as described to a friend of mine):

A blockchain/smart contract based market; functioning similar to a stock market, but instead of holding shares in a company, you hold shares of a contract. Contracts will automatically trade in shares of other contracts to generate profit; contracts that perform well will have more demand, and thus be worth more.

Rules limit the maximum time a contract can hold shares and a requirement that a contract hold at least N% of its value in shares of other contracts will ensure constant trading activity. Each contract is essentially a HFT system trading against all the other contracts.

With the ability to trade options on other contracts, it would produce a very dynamic market that exists for the sole purpose of making money.

This is a market that is intended to be volatile, constantly changing, with new smart contracts being created and closed frequently. There would be immense pressure to create ever more sophisticated contracts that can outperform the competition. This rapid evolution would allow those that choose well to make a substantial profit. Of course, though that pick their investments poorly will find losses mounting up very quickly.

This is, simply put, crazy. It’s a very high risk / high reward system that is designed for investors that are willing to take substantial risks – though the upside could also be substantial.

This project became something of a thought experiment, and what follows is the start of a high-level specification for this system. This isn’t complete, though could have some value to someone – it has no value being unseen in my notes.

Please note: The following contains opinions on legal matters. I am not an attorney, nor is this legal advice. Please consult with an attorney should you decide to pursue a concept like this, as it’s highly likely that they will have many opinions that you should listen to.

Overview #

This document describes a novel blockchain-based investment system, designed to provide a fair market using smart contracts that engage in automated trading. These smart contracts issue shares, allowing investors to profit from their performance.

The network uses a hybrid centralized-decentralized approach to ensure the level of performance needed to achieve the goals stated and rapid trading activity. Using a truly decentralized approach is likely not possible for a variety of reasons, though pursuing such a design would present some novel problems that are worthy of future research.

Definitions #

This document uses the following definitions throughout.

Coin – This is the “currency” of the system, used to purchase shares from contracts, and used by contracts to purchase shares of other contracts. Coin is issued by a special contract, and is a Network Token, no different than the tokens that represent shares of a contract.

Network Token – This is a token that represents value in the network, it may represent Coin, or shares of a contract. Each token includes the identification of the contract that it originates from.

Securities – It’s possible that the contract shares could be seen by the SEC as a security. This would need to be reviewed by an expert in this area of law to determine what compliance steps would be needed.

Capital Gains – The tax implications of this type of trading isn’t clear. This will need to be reviewed, to determine the tax implications of this design and how best to handle these issues.

Block Generator #

The Block Generator is an elected system, from among the Block Signers, that will be responsible for collecting Commitments from the network, and producing a new block every blockGenerationTime seconds. The Commitments will be added to a block, and signed by the Block Generator, it will then send the new block to each of the Block Signers for their signatures. Each Block Signer will return their signature of the block. The Block Generator will then broadcast the new block to the network.

The Block Generator will only publish blocks that have at least blockMinimumSigners signatures, excluding its own. The Block Generator SHOULD publish a block as soon as it has received enough signatures to satisfy the blockMinimumSigners requirement.

Given the importance of quickly producing blocks to the system, the Block Generator should be a highly redundant system, resilient to common disruptions.

Block Generation Reward #

Given the critical role that the Block Generator and the other Block Signers play, a reward is issued on the creation of each block. When a new block is created, the Coin Contract will mint new Coin, and distribute it evenly among those that signed the block, including the Block Generator.

No reward is generated for special purpose blocks.

Operating Fees #

To ensure the continued health of the network, there are certain operating fees that are charged to each contract on a weekly basis. These fees are a percentage of the total value of the contract, and defined in the Network Parameters. These fees are:

Network Operator Fee – To cover the cost of operating and scaling the underlying network.

Coin Contract Operator Fee – To cover the administrative, security, and other costs of maintaining the contract configuration and protecting the assets held by the contract.

Founders Fee – This fee is paid to the founders of the network, to enable them to recover development costs, and continue to invest in improving the network.

These fees are payable via Coin or shares of the contract they are charged against. All contracts, other than the Coin Contract and Closed contracts must pay these fees. If multiple addresses are listed for any fee, the payment MUST be split evenly between these addresses.

Network Parameters #

Multiple items in the investment contracts and other network components refer to agreed upon configuration items. These items will be retrieved from the most recent Network Parameters special block. This block will contain a single record containing a JSON document which defines all parameters needed for the network to function.

This values include:

  1. blockGenerationTime (in seconds)
  2. blockGenerator (public key & address, 1 item)
  3. blockSigners (public key & address, multiple items)
  4. blockMinimumSigners (int, must be less than blockSigners)
  5. blockProductionReward (int)
  6. contractMinimumSharePrice (int, in Coin)
  7. contractMaximumShareHoldTime (in seconds)
  8. contractMinimumShareHoldTime (in seconds)
  9. contractMaximumManagerFee (percentage of contract value, decimal)
  10. contractMaximumManagerShare (percentage of contract share, decimal)
  11. contractNetworkOperatorFee (percentage of contract value, decimal)
  12. contractNetworkOperatorFeeAddress (address list)
  13. contractFoundersFee (percentage of contract value, decimal)
  14. contractFoundersFeeAddress (address list)
  15. contractCoinContractOperatorFee (percentage of contract value, decimal)
  16. contractCoinContractOperatorFeeAddress (address list)

A new Network Parameters block may be generated by any Block Signer, and must be signed by blockMinimumSigners, excluding the Block Signer that generated the block. Should the Block Generator become unavailable, the Block Signers MUST elect a new Block Generator, and produce a new Network Parameters block.

Contracts #

All contracts are immutable, and may not be change, amended, or otherwise altered once they are created. While not allowing updates does complicate the situation should a vulnerability be discovered, it is the only way to ensure that a contract can not be updated in a way that would enable fraudulent activity once it has established value.

All contract code will be included in the special purpose block that creates the contract, making the source code public. Portions of the code, including the code that processes the New Block Action, may be encrypted using a key available to the Contract Execution Servers, provided that the Contract Manager provides a code review report from an approved security vendor to the public, and requests approval from operators of all Block Signers. The Block Signer operators may approve or reject the request at their discretion. Partially encrypted contracts are allowed to protect sensitive strategy information that may be critical to contract performance.

When a contract is created, it defines a certain number of shares, which it will initially own all of. It is not possible for a contract to issue additional shares, or to perform stock splits, or reverse splits. The number of existing shares is immutable.

Contracts have four states that they may exist in:

Active – Contract is live, and may engage in normal activity.

Restricted – A contract may be placed in a Restricted state, meaning that no activity is permitted. The New Block Action will not be executed, it will not be permitted to sell shares of itself, buy shares, or otherwise engage in normal trading. A contract may be Restricted, or have its state changed to Active by a special purpose block. The purpose of this state is to minimize risk should a vulnerability be discovered. In the Restricted state, the Contract Manager may opt to closing the contract, by changing its state to Closing.

Closing – When a contract state is changed to Closing, the contract will begin a shutdown process, liquidating its assets and halting its normal trading activity. Once a contract has been placed in Closing, it can not be changed back to Active. When the contract has liquidated all assets, holding only Coin and its own shares, it will move to the Closed status.

Closed – When a contract enters the Closed state, which is only possible by going through the Closing state, the contract will issue a Repurchase transaction for all outstanding shares, and cease all activity. The contract distributes all Coin it holds via the Repurchase; when completed, the will hold only shares of itself.

Closing A Contract #

At the end of the life of a contract, the holder of the contracts private key SHALL trigger the contract to close. When a contract is closed, the following actions are taken:

  1. The contract stops all direct sales of its own shares, if any are remaining.
  2. The contract stops all purchases of shares using its own shares as the currency (Share Swapping).
  3. The contract stops all purchase using Coin as the currency.
  4. The contract sells shares in other contracts only for Coin.
  5. When all assets have been sold, the contract will issue a Repurchase transaction for all outstanding shares, calculating the price based on total Coin held divided by the number of outstanding shares.

Contract Execution #

All contracts will be executed via Contract Execution Servers that are operated by the Network Operator.

Purchasing Contract Shares #

Contract shares may be purchased via an exchange, or from the contract directly. Shares purchased from the contract have a minimum price of contractMinimumSharePrice per full share; this is to ensure that new contracts are able to gain adequate funding to operate.

Shares of a contract may be purchased either as full shares (1.0 share), or as a fractional share.

The Coin Contract #

The Coin Contract is a special purpose contract that backs all Coin issued within the system. It acts as the value store backing Coin, receiving payments in cryptocurrencies, and returning new Coin in exchange. The Coin Contract will also repurchase Coin, transferring cryptocurrency for Coin received; Coin received via this system will be burned and removed from circulation.

The Coin Contract acts much like a regular contract from a functional perspective, except that it is the only contract that is able to produce new tokens beyond those created when the contract was created.

Coin is created via two mechanisms:

  1. Direct Purchase – When Coin is purchased from the Coin Contract via another currency, new Coin is produced.
  2. Block Generation Reward – When a new block is generated, new Coin is produced as a reward and to cover operations expense for the system operators.

The Coin Contract operator SHALL chose which cryptocurrencies are accepted, and which, if any, are thereafter converted to another cryptocurrency. The Coin Contract may not hold any reserves in Coin, or any other tokens from this network; all value must be stored in an outside value store.

The Coin Contract will use multiple sources of data, whenever possible, to determine the appropriate exchange rates.

Coin Contract Operator #

As the Coin Contract holds value outside of the system, it must have an operator that is responsible for the security of its holdings, and updating its configuration. This operator should be a distinct legal entity, with oversight that is independent from the rest of the system.

The Coin Contract Operator SHOULD publish regular reports listing the status of the accounts held for the Coin Contract, and engage with a reputable auditor to provide assurance that the funds are secured.

The Coin Contract Operator SHOULD place funds in excess of what is needed for the Coin Contract to operate for 30 days with a fully independent custodian, such as a regulated financial institution.

Funds held for the Coin Contract MUST NOT be used for operating or other expenses by any party.

Contract Manager #

The Contract Manager is the party that holds the private key for a contract, allowing them to update the contract’s configuration and change the state to Closing.

The Contract Manager MAY charge a fee against the contract, based on a percentage of total value, up to contractMaximumManagerFee. Any fee specified by the contract that exceeds contractMaximumManagerFee will be reduced to contractMaximumManagerFee.

Upon creation of a contract, the Contract Manager MAY receive shares automatically from the contract, based on a percentage of total shares, not to exceed contractMaximumManagerShare. The Contract Manager may purchase additional shares through the normal mechanism and at market rates.

Network Operator #

The network operator is responsible for maintaining the components of the system that can not be decentralized while maintaining the level of performance required.

The Network Operator SHALL operate a number of Contract Execution Servers sufficient to process all contracts with minimal delay after a new block is broadcast.

The Network Operator SHALL operate a public exchange, with minimal fees, supported by the Network Operator Fee, to allow users to easily buy, sell, and trade Coin and contract shares.

The Network Operator SHALL employ reasonable security measures for all systems they operate for the network.

If the Network Operator also operates Block Signers, the number of Block Signers they operate MUST be less than 50% of blockMinimumSigners to minimize the risk that the Network Operator is able to perform fraudulent activity.

Adam Caudill


Related Posts

  • Insane Ideas: NFT the Stars

    This is part of the Insane Ideas series. A group of blog posts that detail ideas, possible projects, or concepts that may be of interest. These are ideas that I don’t plan to pursue, and are thus available to any and all that would like to do something with them. I hope you find some inspiration – or at least some amusement in this. NFTs are drawing in vast amounts of money; the cryptocurrency community couldn’t be more excited unless Elon sold himself as an NFT.

  • Insane Ideas: Stock in People

    This is part of the Insane Ideas series. A group of blog posts that detail ideas, possible projects, or concepts that may be of interest. These are ideas that I don’t plan to pursue, and are thus available to any and all that would like to do something with them. I hope you find some inspiration – or at least some amusement in this. There are many ways to invest in a variety of things, though there is one hugely promising front that has barely begun to emerge, that could have massive potential for profit, and incredible ramifications: the ability to invest in individuals.

  • Bitcoin is a Cult

    The Bitcoin community has changed greatly over the years; from technophiles that could explain a Merkle tree in their sleep, to speculators driven by the desire for a quick profit & blockchain startups seeking billion dollar valuations led by people who don’t even know what a Merkle tree is. As the years have gone on, a zealotry has been building around Bitcoin and other cryptocurrencies driven by people who see them as something far grander than they actually are; people who believe that normal (or fiat) currencies are becoming a thing of the past, and the cryptocurrencies will fundamentally change the world’s economy.