Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 12.2 KB

how-to-secure-index.md

File metadata and controls

43 lines (30 loc) · 12.2 KB

####The DLOA's plan to secure its library index by Devon Read

The Decentralized Library of Alexandria relies on three decentralized networks for its core functions; the Bitcoin blockchain for direct payments to content creators, the IPFS DHT for hyper efficient p2p file distribution, and the Florincoin blockchain to store and retrieve the library's index. Bitcoin for payments and IPFS for file storage and distribution will be addressed in later writings, but this one focuses on answering the question of why we selected Florincoin for our library index, or more specifically, why we aren't using Bitcoin for that purpose. A major concern shared by some is that the Florincoin blockchain isn't anywhere near as secure from malicious attack as the Bitcoin blockchain. An attackable blockchain is a problem for two reasons: 1) the tx-comments in the Florincoin blockchain could potentially be altered, thus altering the information in Alexandria itself and 2) Florincoin transactions could be reversed, blocked from being allowed or altered in some other way, thus causing the miners and traders who's activity the blockchain rellies on to have their confidence in the coin's value shaken.

#####So why don't we simply use the Bitcoin blockchain for Alexandria's library index, the undisputed king of hash rates (in fact, the incredible amount of mining power behind the Bitcoin blockchain actually makes it the worlds most powerful distributed computer), instead of a little known Scrypt altcoin with a relatively low hash current rate?

To answer that question, first we must discuss how users will interact with Alexandria's library index. Most media distribution platforms rely on a centralized library index, stored in a large server farm somewhere, and accessed over http. The size of the database doesn't really matter too much, because it is only stored in servers which users interact with to look up the content they're looking for. However, doing so exposes users searching and browsing habits to that server's logs, and the company that owns it, and anyone else they chose to sell the info to. Since the user is forced to trust the results they get back when they ask the server to search its contents, they have no way to know if the returned results are actually complete, since all it takes to censor content is making some changes to the privately controlled database. In order to search, browse and publish content permissionlessly and without needing to trust any 3rd parties, one must use a decentralized database as the library index, which basically just means that users store the whole database locally and let it sync with other nodes to stay up to date so they can add new content to it and search and browse it privately. As it turns out, blockchain's make for pretty great decentralized databases in which users store them locally and rely on a brilliant combination of collaboration and competition to ensure that all nodes stay in sync with each other. But they're not exactly open databases, they're intended to store very specific data, transaction data - Bitcoins blockchain is almost entirely made up of the ledger of all Bitcoin transactions since Jan 3, 2009. Florincoin was forked from Litecoin with the specific intent of creating a blockchain intended to store more than just transaction data by allowing users to include up to 528 bytes of information with a transaction, so simply by sending a transaction to one-self, a user can add 1/2kb of data to a permanent, decentralized database for just the cost of a Florincoin tx-fee (about $0.00015 right now). However, Bitcoin has an... unreported feature? a feature/bug?... that allows it to function pretty similarly. The OpReturn function can be used to cram about 80 bytes of data into a Bitcoin transaction, and with this, we could theoretically use the Bitcoin blockchain as Alexandrias library index. So why don't we? Well, the Bitcoin blockchain takes more than 50GB to store whereas the Florincoin blockchain takes up about 1GB to store. Yes, both will continue to grow, and especially if Alexandria is succesful, its index itself will grow quite large. But if we stored Alexandrias index in the Bitcoin blockchain, we would forever have that additional 50GB of data which is completely unrelated to our index, and it will only continue to grow. Remember, in order to publish, browse and search the Library index with the confidence that their searches are not being tracked and their results are not being altered or censored, users will need to store it locally. Storing all of the Bitcoin transactions that ever happen on their local hard drive should not be required in order to privately browse the Decentralized Library of Alexandria, so to us it makes more sense to keep the Alexandria index on a blockchain that isn't likely to be used primarily for transaction data.

####Then how do we ensure that our selected blockchain is secure from attack?

We have a plan. It requires a few components, so we'll start out by explaining each of them.

Component 1 - The DLOA Scrypt Miner Rental Service
Component 2 - The DLOA Florincoin Mining Pool
Component 3 - Publishing with TradeBot

####The DLOA Scrypt Miner Rental Service Built into Librarian will be a portal to the rig rental APIs of http://www.miningrigrentals.com, http://www.nicehash.com and http://www.betarigs.com that allows users to set a weekly rental budget in BTC and then forget about it, secure in the knowledge that Librarian will rent the best priced rigs available each week. Eventually, Alexandria itself will host a p2p rental service that does not rely on these 3rd party services, but we plan to continue to support them as well at that time.

####The DLOA Florincoin Mining Pool
http://pool.alexandria.media
When the DLOA Florincoin Mining Pool wins a block, it will attach a tx-comment to the block reward payouts to miners. This tx-comment will include the following info:
flo_current_hashrate - sourced from http://hashreport.alexandria.media:5831/getMiningInfo: networkhashps
pool_24h_avg_hashrate - calculated using data from http://pool.alexandria.media/api/pool_stats: time & hashrate MRR_scrypt_last10_avg_cost_per_MHs - sourced from https://www.miningrigrentals.com/api/v1/rigs?method=list&type=scrypt&showoff=no: last_10
NH_scrypt_last10_avg_cost_per_MHs - sourced from https://www.nicehash.com/api?method=stats.global.24h&algo=1 BR_scrypt_last10_avg_cost_per_MHs - sourced from betarigs.com if it ever comes back online

####Publishing with TradeBot In order to publish an artifact (our term for a piece of digital media) to the Decentralized Library of Alexandria, a small amount of descriptive info and meta data must be stored in the Florincoin blockchain... for as long as it exists. For this reason, doing so requires a publishing fee. This fee serves two purposes; first, it is an anti-spam measure, similar to the viggish, a failed proposal from the early days of the internet that would serve as a means of micro-fees for publishing and accessing information in order to prevent the predicted SPAM and DDOS attacks that regularly make our experience of the internet far less enjoyable. The concept is that an individuals cost to do something legitamate is fair and completely reasonable, but attempting to maliciously overwhelm a database with useless data would become cost prohibitive. The second purpose for this fee is to directly reward the miners who contribute security to the database that stores Alexandria's library index, Florincoin.

The cost to publish will vary based on the users monetization preferences. If they opt to give their artifact away without cost, their publishing cost will be the minimum required by the blockchain miners, approximately .2FLO per 528 bytes of information. Keeping in mind that this applies only to the descriptive information and meta data associated with the artifact, not the media files themselves, most artifacts will be about 1-2kb, so their publishing cost will be less than $0.001.

If a Publisher wishes to require a minimum price for their artifact, their publishing cost will be equivalent to that purchase price. For example, if they are publishing a short video that asks for $0.02 per play or $1.00 to purchase, the publishing cost will be $1. If they are publishing an album of songs priced at $.99 each, with a total album purchase price of $9.99, their publishing cost for the album will be $9.99.

After the publisher has added their digital files to the IPFS network for file distribution, provided their Bitcoin address for payments or optional tips, and provided the rest of the descriptive info and meta data needed to easily find this artifact in the library later on, the user hits the publish button and a few processes begin happening in the background:

  1. The Publisher's local Libraryd daemon indexes recent tx-comments from the DLOA Florincoin mining pool to calculate the current (past 24 hours) cost basis to mine one Florincoin, in number of Bitcoin per 1 mined Florincoin. We'll call this variable FLO_24h_cost_basis_in_BTC
  2. The API https://api.bitcoinaverage.com/ticker/global/USD/ is checked to look up the current average exchange price between Bitcoin and the fiat currency that the publisher has chosen to price their purchases and tips in. We'll call this variable FLO_24h_cost_basis_in_USD
  3. Using a p2p direct voting system, all owners of the Decentralized Library of Alexandria register their votes for what profit margin the DLOA Florincoin Mining pool should earn for its miners - the current concensus for this figure is checked by the Publisher's local Libraryd daemon. We'll call this variable DLOA_FLO_Pool_Margin
  4. Using the FLO_24h_cost_basis_in_USD and DLOA_FLO_Pool_Margin, a total cost of USD per FLO is calculated. This variable will be dubbed DLOA_FLO_Pool_Price_in_USD

At this point, the Publisher will be prompted with a total number of Florincoins required to publish their artifact. If they already have enough FLO in their local wallet, they can click a button to spend them and their artifact will be published right away, likely in less than a minute. If they do not yet have any Florincoins in their wallet, or if they do not have enough, they'll be given the option to use TradeBot to exchange BTC for FLO - if they chose to, they'll be presented with a QR code and a total price in BTC (i.e., the equivalent of $9.99 in BTC for a $9.99 album, per our example above). TradeBot will monitor the unique BTC address the Publisher was presented with, and send Florincoin to their wallet when some amount of Bitcoin has been received. TradeBot will use the same method to calculate the exchange price between BTC and FLO as described above, but rather than sourcing the "FLO offer" side of the trade from a third party web exchange, it is sourced directly from the DLOA Florincoin Mining pool. This is the magic step that brings everything together. Users who mine Florincoin through the DLOA mining pool will directly receive their block reward pay-outs, and they're welcome to do whatever they wish with them, like send them to an exchange, or use them for publishing their own artifacts. But if they chose to leave the coins alone in their local wallet, they are eligible to automatically trade their Flo with Publishers in exchange for BTC. Since TradeBot calculates its exchange price using the actual cost basis to mine Florincoins at any given time, miners who use this service will know that any trades automatically executed will be profitable ones. No more needing to use multi-pools to chase the best blockchain to mine based on immediate spot profitability and the hope that the miner can trade their winnings while its still profitable, this system guarantees that trades will be made at a known profit... but of course it doesn't guarantee how much time will pass between when the cost was incurred and when the trade revenue is received. This will be a function entirely of the supply and demand relationship between Flo mined by DLOA pool miners and Flo required by Publishers, so if our overall efforts at driving more publishers to share their content are successful, the time differential between when a particular Florincoin is mined and when it is sold at a known profit margin should become smaller and smaller over time.