Skip to content

Instantly share code, notes, and snippets.

@piboistudios
Last active January 14, 2022 00:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piboistudios/0c7e6448fa73b495bb40d66954d89cdb to your computer and use it in GitHub Desktop.
Save piboistudios/0c7e6448fa73b495bb40d66954d89cdb to your computer and use it in GitHub Desktop.
GunChain

GunChain

This is a working draft of a proposal for a Block Chain based on the principles of Freeism.

Overview

The network is effectively a "public Cloud" where users own all of the data and services.

Basically, there must be an autonomously run cluster of services (like a Kubernetes one).

This cluster will be a Gun super-peer/WebTorrent super tracker.

It will also run Tendermint (written in Golang), a JS Tendermint application powered by GunDB and a p2p compute engine (to be created; Gun-compute) powered by Bugout (WebTorrent).

It must also be able to mine currency for other existing block chains by proxy of all users in the network (via WebGPU), so it will run mining nodes for whatever currencies we mine.

This may also be possible with some hack of copy/v86 for CPU Mining... it (copy/v86) can run relatively well, and run in the background in a worker... so this is optimal. It may not be super fast, but it doesn't need to be because it can run in the browser, and users use browsers... users scale horizontally ;)... we could for example do a setup of a full Lotus node for Filecoin on the cluster, and run lite-nodes (Lotus/Filecoin is also written in Golang) in user's browsers via copy/v86 (agan, somehow, idk if this is possible). Or even better (again, somehow idk if this is possible)... compile Lotus to gowasm via TinyGo. Then we could get far more power out of a given user than spinning up copyv86 with the appropriate tools/polyfills to run a lotus lite node...

More realistically.. while we can mine for Filecoin, Arweave, Storj etc... we'd need to write a Docker volume that uses GunDB for storage... then just stand up images using this volume that run the respective storage miners for these storage networks...

Much easier than this would be:

  1. Write a custom FTP server that stores/retrieves data from Usernet (https://www.npmjs.com/package/ftp-srv)
  2. Mount it to a Linux directory (https://linuxconfig.org/mount-remote-ftp-directory-host-locally-into-linux-filesystem)
  3. Run a storage miner in a docker driver (https://docs.docker.com/storage/volumes/)
  4. Literally just profit. That's it. You make money off users that damned easily lmao

The decentralized storage chain/platform I'm using is Storj.

I looked fairly deeply into FileCoin and Sia.

FileCoin gives far too much power to node operators. So much so that they can easily just hold your data ransom..

Storj is much more distributed in that no one operator controls your data.. it's just about speed, presumably.

Don't know enough about Arweave, but sounds promising.

Then, if we wanted to participate in computational block chains, we would have to write a simple Linux kernel that connects to the fastest peers in usernet and uses them to run computations..

Just write a copy/v86 image/OS/kernel/whatever that uses the users in the network for massive parallelization, run from the cluster in node.js via WASM. This would act as a massive smart contract (e.g. storing state in the block chain/gun network). The kernel itself needs to be able to run things such as the CLMiner or CUDAMiner...

Or alternatively, write a port that will leverage the usernet's massive parallelization capabilities. Every user is effectively a thread, so... we could, for example, try tens of thousands of hashes at once... or however many users there are active...

For parallelized mining (ETH specifically), it seems most feasible to run a geth node, then just have users do work for the node in the browser

This needs to leverage WebGPU... I estimate one user can probably get somewhere between 1-10MH/s using WebGPU..

Based on this, one could assume this would mean 75-750 users would bring in about $30/day.... that's about $1/user/mo after some is set aside for staking...

And that is just Ethereum.

This then allows the network to fund itself using user power (which is great, because the network only costs money when users use it... so long as mining is more profitable than the users there is always a surplus... this is how we tap into Freeism).

The network would also set aside some funds for staking in order to eventually become a validator.. once the network becomes a full validator, all earned rewards would accrue interest.

Application developers would use this publicly available (well, public to anyone in the network) "super-stack" to build applications, Usernet could then profit off of the fees paid by developers.

Users, by using the applications, would give app owners their DV%. The DV% can then be exchanged for any surplus in the cluster reserves.

This then incentivizes application owners to get more users, users will go to apps that pay them yada yada freeism.

Stack

Anything without a link needs to be made, basically

Shared stack:

  • GunDB - Persistent data storage
  • Bugout/WebTorrent - Connection brokering/private p2p data transfer
  • WASM - The Smart contract language
  • Bugoff - Secure key exchange
  • GunCompute - Peer to peer compute engine

Server Side (the autonomous governance/treasury):

  • Akash network - Where the autonomous cluster runs
  • Tendermint - consensus/transaction validation
  • Gun-Compute - p2p compute engine; powers applications (to be created)
  • GunFTPeer - An FTP Server that'll STOR and RETR files from users in Usernet.
  • Storj or Arweave - Proof of Storage mining via GunFTPeer
  • Geth - Ethereum mining/validation (but I mean, if we can mine it from users, we can use any currency... the more currencies the better... by mining it we effectively suction the value of those currencies into the GunChain network)
  • Some smart contract (probably on Ethereum) to act as the treasury in conjunction with the Akash clusters (using ChainLink)

Client Side (the usernet):

Other notes

  • DV% is also voting power on the configuratino of the Akash cluster:
  • For example, whether more resources are proportioned to the Gun superpeer vs. the WebTorrent tracker vs. the mining. Or even just the location of the cluster. Or even for new clusters in different regions etc...
  • There will be some public app (or in general, public "community" apps) where users can just "idle" and mine for the network.. this will allow them to get voting power/DV% much like application owners.
  • Probably eventually, if I can figure it out we can work in free public Wi-Fi... we can call it the Usernet or something.
  • You would exchange DV% for either voting power or crypto from the reserves

Terms

  • Freeism - the production and distribution of goods incentivized by algorithms
  • DV% - Daily Value %; this is the % of value a user gets out of an app. If a user uses 1 app all day, it gets 100% of their DV%. If they use 2 apps, but one half of the day, that one gets 25% and the other app gets 75%, etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment