Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Matthews Lab
Search
Search
Appearance
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Permissioned resource coins
(section)
Page
Discussion
British English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Allocating storage space === Consider a simple example with four parties, each with 10 GB of storage space. To buy storage space in this system, a person must purchase resource coins and make a request to the coin for storage space. The coin would then use available storage space in the order defined in the farmer set, and reserve payments between them. <pre>price_per_gb = 0.01 swarms = {} pending = {} balances = { "client": 100 } # Unbound for loops don't work well on blockchains. # This will need to be optimised. def allocate_storage(gb_amount, client, id): id = random() swarm = [] for farmer in farmers: # How much space can we get from this farmer? if farmer["gb"] > gb_amount: change = gb_amount else: change = farmer["gb"] # Check the client has enough to buy this. total_cost = change * price_per_gb if balances[client] < total_cost: break # Don't continue if there was no change. # We're done here. if not change: break # Apply changes. farmer["gb"] -= change gb_amount -= change balances[client] -= total_cost pending[id][farmer] += total_cost # Record farmer in this resource set. swarm.append(farmer) swarms[id] = swarm</pre> What I have described above is a simple proof-of-stake system. It is a system that awards storage based on the order in which people join. In a real system, there are other variations that could be used. For example, you could program the allocate_storage function to distribute 75% of the storage space based on join order and the remaining 25% randomly. <span id="paying-for-storage-space"></span>
Summary:
Please note that all contributions to Matthews Lab may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Matthews Lab:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)