Skip to content

Commit

Permalink
skel 3/
Browse files Browse the repository at this point in the history
  • Loading branch information
thisispalash committed Oct 5, 2021
1 parent 840ad86 commit d499820
Show file tree
Hide file tree
Showing 9 changed files with 820 additions and 40 deletions.
621 changes: 621 additions & 0 deletions FULL-LICENSE

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Tampopo.eth -- Empty your cup or pull others threads
tampopo [dot] eth -- Won't you unravel me, my love?
Copyright (C) 2021 Palash A.

This program is free software: you can redistribute it and/or modify
Expand All @@ -12,4 +12,5 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>
or the full license reproduced in the repository for convenience.
55 changes: 17 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# tampopo [dot] eth
> Empty your cup and lay down threads for others to pull !
> Won't you unravel me, my love ?!
We can be anyone we want to be on the internet, so let's all be real, in the hopes of abolishing from this world duality we may rise above and all be cubed !

Expand All @@ -16,54 +16,33 @@ Web3 also brings forth, and indeed hyperboles, the transactional nature of the m
- On _seeing colour_ - The two main ways to interact with the network is via `emptyyourcup.com` and `pullmythread.com`. However, you may also visit `tampopo.eth` where you may choose the _persona_ [read: colour] you want to read [read: see] and there is a cost associated with this choice, at some constant rate per click.
- Being _invited_ - A storyteller may also choose to invite you to read a story (or the world, by making it public) where the [cost] rate in _seeing colour_ is now the rate of minting fresh `TP` tokens.

## `TP` Tokens
## Network Information

Trivially `TP` stands for `tampopo`, but more interestingly [read: creatively], it stands for `timepass` (or `toilet paper`, depending on the goggles); because, the whole point of this project is to pass time by sharing and hearing stories and connecting with strangers* on the interwebs. Indeed, is there a better way to pass your time; for here you may _check out_ people in the convoluted and interactive _library_ and (perhaps) learn something new.
tampopo consists of three networks - i. the default `mainchain` where all the action happens; ii. a `draftchain` for storytellers to get some feedback on their stories prior to publishing; and iii. a `hidechain` for permissioned access to a story, ie, invite-only story views for more sensitive content. Each chain uses a different Ethereum chain (such as `homestead`, `ropsten`, etc.) for their unique capabilities, as explained further;

**tokenomics** As you have probably guessed by now, there is no real upper limit to the number of `TP` tokens. `tampopo.eth` is the main address of the project, which holds the minted `TP` tokens and the donated alts. This address also serves as the community fund, helping out those who can not (or may not) help themselves; kinda like pay-it-forward coffee. Additionally, as each _storyteller_ is identified with a subdomain of `tampopo.eth` (as `<persona>.tampopo.eth`), the mint and alt duality exists for every storyteller as well; every effort is made to make the private keys human friendly.
**mainchain** This is the default chain for the network, running as a layer-2 chain on the main Ethereum Network (`homestead`). A bunch of smart contracts help peg the value of `tP` tokens to ether, and thus real-world* value. Every public story that is publised to the network resides as a story hash on this chain.

**cryptonomics** The other part of the `TP` tokens (or any crypto token for that matter) is the **private** key. Like addresses, private keys are not _human friendly_. Some attempt is made to abstract the keys to _n_ word seeds, however even these are not nice to remember. Treating seeds as elongated passwords seems like a good idea, and as such users are encouraged (and assisted in) to create _memorable_ seeds which can then be used to regenerate their private key. Additionally, multi-sig is used extensively to add another layer of complexity, and to share the _burden_ of knowledge.
> ___note___ these ideas are still quite raw and in need of further exploration into the hard math behind ECC; a possible solution lies in using semaphores from ethereum foundation's Privacy and Scaling explorations group, combined with _creative_ suggestions
**draftchain** This is the chain where the points are made up, and the rules don't matter. Effectively, it is the wild wild west, designed for more chaotic creations, as close to `main` conditions. As a result, implemented on Ethereum's `ropsten` network. The idea is to store drafts here, until it is ready to be published on the main network.

**hidechain** This is a Proof of Authority chain (as opposed to PoW (and maybe PoS) above) to enable DPoS voting, while separating the votes from money and its related data. Effectively, the aim here is to form something like Twitter's [Communities](https://blog.twitter.com/en_us/topics/product/2021/testing-communities) because this network can also be used for whitsleblowing, or fighting injustice. In some [naive] way linking web3 and twitter, to give the (armchair) activists some teeth, if you will.

### Current* Constants
> I think they're quite funny, don't you?

`69 TP` minted on registration at `tampopo.eth`
> oh so intimate! welcome to the club!!
## Contributing Guidelines
> read: participating with the network
`420 TP` minted on publishing a story at `emptyyourcup.com`
> come, let's sesh with some buds!!!
The beautiful thing about open-source, is that you can *copypasta*. Moreover, code is a language; one to express ideas in (shamelessly stolen from [Lex Clips](https://www.youtube.com/c/LexClips)), and as such these are my ideas, hence there is no contributing, per se, permitted. Having said that, since the entire repository is under a [copyleft license](), you are free to fork it or even just copy individual lines from any file (*note:* the license mentions stating source of code, but also emphasises no liability, thereby making a sort of honour system possible; so, will you be honourable?).

`(420/n * m) TP` minted on every link click at `pullmythread.com`
- `n` :: Number of links to click in the story
- `m` :: Number of stumbles until your story reached
Also, the most ideal, and indeed quickest for it is designed as so, way to *contribute* to the network, is to *participate* in it - either by [emptying your cup]() or by [filling it](). Either link helps mine `tP` tokens, which are made real by purchases of stories as memorablia of the time shared together (across space) [as an NFT [read: ERC-1155 multitoken]]. Of course, you may read stories for free without paying anything, but then I would be obliged to refer you to the honour code mentioned above.

`6.9 TP` minted on every link click on _seeing colour_ at `tampopo.eth`
> a fun activity stopped by a period [read: thought [read: ego]]
In summary, you create a persona on either website (`emptyyourcup.com` || `pullmythread.com`) to share your stories or consume others' stories (respectively). Either of those activities mines fresh `tP` network tokens, which are made real* and consumable using some [web3 magic](). The idea behind the network is effectively an idea, that of existential dread - for aren't we all just stories at the end of it all? If so, why not become immortal together and scream out our [colourful] stories into the abyss*? This network is that abyss, with some effort to make sense of the chaos as well, of course.

## External Projects Used*
### Future Considerations

**_persona_ registration**
- [ ] Ethereum Name Service
- [ ] Ethereum Foundation Semaphores
- [ ] tampopo [dot] eth for *meaningful* and insightful stats of the network
- [ ] alternate document formats, such as poetry, plays, scripts, etc.
- [ ] openAI integrations for *fun* and convenience

**story publishing**
- [ ] The Graph
- [ ] EthBlockArt
- [ ] web3.storage
- [ ] Rarible Protocol

**streaming alts**
- [ ] Superfluid
- [ ] Gas Station Network
## Further Reading
> TODO
### [future] OpenAI extensions

- [ ] speech to text for storytelling
- [ ] text to speech for storyreading
- fun stuff with data?
- [ ] cooler artwork generation from semantics
- [ ] mint on providing data; ie, on interacting
- [ ] seed [read: key] generation using story data
- [ ] colour suggestion and more efficient stumbles
54 changes: 54 additions & 0 deletions docs/scalability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Layer 2 (and beyond?)
> Why reinvent the wheel?
## Rethinking Nodes

One of the best aspects of web3 is its permissionless entry to the network, by anyone being able to set up a *node* for the network. However, for most networks, it is still quite technically challenging, and the average user would rather be abstracted away from it. If they so choose, they may learn more by reading the code and these docs to learn how nodes work and operate. As such, this project is divided into two main parts — the web3 address and decentralised website; and the familiar interface to the network in the form of `emtyyourmind.com` and `pullmythread.com`.

The decentralised version (at `tampopo.eth`) serves as a website and the main address for community funds. Moreover, it is designed keeping the avid blockchainer in mind (so, you are familiar with, *and use*, metamask, some crypto exchange, and perhaps even have some investments), ie, no spoonfeeding. The spoonfed versions, and highly automated, versions are on the traditional internet (compare with TradFi?). One thing that always bothered me was that engagement and behaviour tracking is used primarily for ad revenue, which seems like the opposite of what we should be doing - making that data accessible so users may benefit overall. But, traditional systems are often also zero sum games (as opposed to positive sum ones via web3), so it is not that surprising that [the most versatile substance on the planet was used to create a shield*](https://youtu.be/hI9GyhX7yHM?t=266).

Moreover, with javascript and modern browsers, any website visitor can run a node in the background; of course the onus is on the programmer to be able to effeciently run the node, without compromising user experience. Having said that, as technology improves and becomes increasingly accessible, more services can be run in the background; most are anyway, but to provide user tracking for the service provider (ie, the companies themselves) to profit off of your time and attention. This project aims to flip that around by rewarding the one who captured your attention and thereby tilting the balance slightly. Of course, this is only possible now with web3 and cool math (such as one way hashing, tries, proof logic, etc.), but now that it is possible, the question is how probable it is; and that question we can answer ourselves, for there's a permissionless entry, again made possible with math!

As such, this project extensively uses the techniques described by rollups and zero-knowledge proofs (and [merkle trees]()) to truly make nodes lightweight to be decentralised, and also keep the network secure with at least one keeper*.


## Optimistic Rollups

The basic idea of an *optimistic* rollup is that transactions are added to the chain constantly and if someone [read: anyone] finds a fraudulent transaction (double spend, etc.), they may submit a *proof* showing the *fraud* and the network deletes that branch entirely. Hence, this allows transactions on the layer to be almost instant (and *optimistic*) with a submission required only at the end. Effectively, you roll a bunch of transactions together and only submit the top most transaction [hash]. Building the *txn tree* is easy due to simply defined one way functions (such as hashing, concatenation, etc.). If you are somewhat familiar with the technology, you should read [this blog by Vitalik](https://vitalik.ca/general/2021/01/05/rollup.html); and if not, you should read and reread [that blog](https://vitalik.ca/general/2021/01/05/rollup.html) until you understand it.

For this project, the mining of `tP` tokens is done offline (ie, off chain, on the user's browser) as they read through stories. The mined tokens (and the branch) is stored as cookies in the user's browsers (compared to personally identifiable information by ad-based megacorporations). Once they reach an end of a story though, they may *mint* the story as an NFT (ERC-1155), and in doing so also publish the past transactions stored locally. The `transaction` word is used quite liberally here, but in essence, every interaction with the story (or the website) is considered to be a transation. As you pull the story's *threads*, and that act of you *spending* your time and attention to *unravel the [coloured] yarn* is considered a transaction and mines new `tP` tokens for the storyteller (or the yarn spinner).

Until you *purchase* an NFT (which is designed to give the storyteller extremely quick access to *real world funds*), a record of mined `tP` tokens is kept locally. Only when an NFT is *minted*, the prior batches are merged onto the main chain, somewhat git style*; ie, each unique visitor creates a persona to read stories which are considered separate branches, *merged* only when the persona creates a new ERC-1155 token.

### Current Constraints
> TODO

## Zero Knowledge Rollups

Like *optimistic* rollups rely on fraud proofs, ie, assume that the data is right, and if fraud is detected, posthumously alter the branch and invalidate the transactions since; these rely on *validity proofs* (again, [Vitalik's blog](https://vitalik.ca/general/2021/01/05/rollup.html) is a great resource). One way to think about this is that the *burden of proof* is on the action-performer or the sender, rather than a third party (or the receiver) to discover fraud. This view is why zero knowledge proofs are adopted into this project. **note** these are zero knowledge proofs since you would only submit the proof without any personally identifiable information to the chain.

As mentioned above, mining tokens for the network [read: storyteller] is optimistic, but only made real once some *real world funds* are brought into the network. This part of the process is where validity proofs are used, and indeed necessary. The idea is that the storyteller may not be in the position to pay a price for sharing their stories (think adolescents, whileblowers, prisoners, boomers even!), but since a price must be paid as every action must have (an equal and opposite) reaction, the burden is laid onto the one who the story is being shared with. In essence, the network *optimistically* (but locally) mines `tP` tokens which are *pushed* to and *merged* with the network only if a reader decides to mint a Non Fungible Token (for isn't every story unique?) for some amount of ERC-20 tokens, which serves two purposes - i. It provides the reciever (yarn spinner or the network itself) with *cashable* funds for their story, in effect a *payment* for reading their stories; ii. It provides a way for `tP` tokens to be pegged to a more universally accepted token (such as ETH itself) without having it list on exchanges, and thus without having stories being subjected to *market forces* (such as shorting, margin *bets*, quantitative analysis, etc.).

As such zk-SNARKs (zero-knowledge - Succinct Non interactive Argument of Knowledge) are used to provide a validity proof from the *reader*, ie, the person minting the NFT. This covers the gas required to mint an NFT, and also the gas required to mine new `tP` tokens, without the network bearing any cost. To continue the stories analogy, this can be considered the cost of *reading past* stories, priorly *free*. Of course, if no NFT is minted, ie, if no story is read such that the reader is moved enough to create a memento, then the network needs to upgrade or be shut down, and as such the branch (created as a cookies in-browser on unique visits, and user consent) is simply never submitted to the network, and the mined `tP` tokens are never merged with the network; ie, the network has no knowledge of new `tP` tokens being mined.

### Current Constraints
> TODO

## Merkle Roots

A lot of this optimisation and compression is possible due to clever math and data structures. Merkle Trees are used [extensively]() to store stories, and as such only the root of the tree needs to be submitted to the main chain, and the rest of the tree can be built as and when needed, by the entity who needs it. This only requires some data to be changed on chain and thus reduces the gas fees tremendously. For *optimistic mining*, a transaction occurs every link click [read: tree exploration] and the batch of transactions (of explorations) is submitted to the local chain once a new depth is reached in story [read: depth of merkle tree (the one storing the story) reached].

Each story read becomes a leaf in a local merkle tree formed to describe the local *branch*. The root of this tree thus formed, upon reading stories, locally is then submitted to the network for merging once a story is minted as a ERC-1155, as a personal memento. As the final push to the network uses validity proofs, the deeper this local tree (depth increases as more stories are read), the more data the proof takes*, and hence the more gas you pay to the network.

Having said that, the gas you pay to the network is only once, and to facilitate the mining of network [read: `tp`] tokens, ie, register your participation in the network, by rewarding the entity that drew you in. This one time fee is also quite cleverly low (by using merkle roots, stateless contracts, and rollups), so you can read multiple stories and only mint the one you like, and in doing so, convert your past time into monetary* assistance for the entitiy that consumed your time.

### Stateless Contracts

Another cool aspect of on chain dynmaics is that since all transactions are recorded (and publicly accessible) and every interaction with the chain is considered to be a transaction, we can *cleverly* store data as part of the transaction, ie, interacting with the network, such as calling a function in a smart contract, and then retrive it by decoding the (past) transaction that can be easily obtained by seeing the shared ledger. This manipulation of protocol schemes (and seeing problems in a different light) helps to reduce gas costs, and thus make the entire project scalable, for the experience is now more acccessible.

## Voting and Amnesty
> DPoS TODO
One of the goals of this project is to provide assistance to storytellers because at the end of the day, we are all just stories (and some lucky ones get to be songs <3). Initially this assistance is monetary, either via `tP` tokens or minted stories (as NFTs, ERC-1155 tokens) for a certain price. However, a future provision can be made for voting where certain stories* may be so important that a community rally may be necessary for the story, or storyteller. This decentralised *voting* for *stakes* is something that needs more thought and as such is a future consideration.
34 changes: 34 additions & 0 deletions src/static/js/compiler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This code is run to convert the HTML from `editor.js` to a
* trotter-merkle-trie to enable some web3 majix
*
* `trie` converts the trie from document and returns the root hash of story
* `invert` inverts the stored trie for easier (and more fun) tree exploration
* `read` converts the opened document into a hash to commit to local network
*
*/

function trie() {
// Create the trotter-merkle-trie from HTML data

}

function invert() {
// Invert the trie so reader pulls leaf and reads towards root

}

function read() {
// Convert explored tree to hash and return for commit and stats

}



//// *internal* functions, modify at your own risk ////


function _trap() {
// Custom trapdoor for difficulty in reversing

}
25 changes: 25 additions & 0 deletions src/static/js/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* All code pertaining to user edits
*
* `seeder` allows user to create custom seeds for private keys
* `trotter` enables the main feature, editing stories to publish
* `comment` enables comments in a story, on specific tokens
*
*/


function seeder() {
// one for forward, two for backward

}

function trotter() {
//

}

function comment() {
//

}

Loading

0 comments on commit d499820

Please sign in to comment.