Web3 application on the Solana blockchain written in Rust (Anchor). A Twitter like, decentralized communication platform.
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
rating counter on tweets becomes obsolete, which results in slimmer tweet accounts
- Direct messages are separate accounts instead of being a tweet
recipient on tweet account becomes obsolete
- Comment functionality
- Users can create aliases
- New api syntax for tests
.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 <YourPhantomWalletPubKey> && 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
