Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ttytm/anchor-solana-twitter

Web3 application on the Solana blockchain written in Rust (Anchor). A Twitter like, decentralized communication platform.
https://github.com/ttytm/anchor-solana-twitter

anchor blockchain dapp solana web3

Last synced: 3 months ago
JSON representation

Web3 application on the Solana blockchain written in Rust (Anchor). A Twitter like, decentralized communication platform.

Awesome Lists containing this project

README

        

# anchor-solana-twitter

Extends and refactors the [v1-branch][10].

Changes

- Votings are their own accounts using PDAs, instead of just updating a counter on an existing tweet

- enables to filter votings for a user
- less costs for sending a vote
- the `rating` counter on tweets becomes obsolete, which results in slimmer tweet accounts

- Direct messages are separate accounts instead of being a tweet

- less cost on for dms
- `recipient` on tweet account becomes obsolete

- Comment functionality

- Users can create aliases

- New api syntax for tests

- abandon deprecated `.rpc` in favor of `.methods` syntax

## Running

The installation of the prerequisites to run an anchor program is nicely explained in the [anchor book][20].

With the prerequisites out of the way, `npm i` installs the rest of the dependencies.

Then building and running the tests can be done with `anchor test`.

To use the tests while working on a frontend run the localnet with `anchor localnet`.

In another terminal airdrop your wallet some SOL and load the test `solana airdrop 1000 && anchor run test`.

### Tested Functionalities

```
❯ anchor test

tweets
✔ can send and update tweets
✔ can send a tweet without a tag
✔ cannot send a tweet without content
✔ cannot send a tweet with a tag > 50 or content > 280 characters
✔ cannot update a tweet without changes
✔ can delete own tweets
✔ can fetch and filter tweets

comments
✔ can comment and update comments
✔ can delete comments

votings
✔ can vote and update votings
✔ can derive tweets from votings

direct messages
✔ can send and update dms
✔ can delete dms
✔ can fetch and filter dms

user alias
✔ can create and update a user alias
✔ can delete a user alias

status
✔ can set a status message with up to 50 characters
✔ can delete a status message

reactions
✔ can react on tweets and update and delete reactions
✔ cannot send other then predefined reactions
```

## Frontend Showcase

To showcase the functionalities of this app you can check out a frontend implementation using SvelteKit on https://twitter-with-ass.vercel.app/ - _WIP_

[10]: https://github.com/tobealive/anchor-solana-twitter/tree/v1
[20]: https://book.anchor-lang.com/getting_started/installation.html