In the world of cryptocurrency, we are bombarded with many different kinds of wallets to use.
We want to make transfer easy for people that have yet to onboard or has their crypto-wallet ready. At least say, they are not being pressured to create a wallet on the go while still retaining ownership of the fund that was transferred to them.
The thought of using a smart contract and linking the Twitter handle(username) to a wallet address helps to make the transfer easy. At the same time, we also get the benefit of transferring funds using a recognizable name.
- Create a developer account with Hedera Portal
- Create a Hedera account on Testnet.
- Create a developer account with Twitter Portal
- Create a new Project. Enable OAuth1.0, OAuth2.0, Automated App or Bot, and Direct Message.
- Insert the callback url:
http://localhost:3000/api/auth/callback/twitter. Update the localhost accordingly on prod or ngrok. - Create an account with MongoDB.
- Create a new database and collection.
- install Hashpack browser extension
- install Ngrok
cd contract&yarn install- rename
.env.sampleto.envand fill in the variable from the pre-requisite. yarn build- to build (rollup) the stratojs and
.solinto adist/*.jslibrary for web-browser usage
- to build (rollup) the stratojs and
- copy
dist/hedera-strato.hashpack.jstonextapp/public/hedera-strato.hashpack-esm.js. cd nextapp&yarn install- rename
.env.local.sampleto.env.localand fill in the variable- not that twitter DM has limited quota per day.
DISABLE_DMif not necessary for development.
- not that twitter DM has limited quota per day.
yarn dev- start
ngrok http 3000- This is needed due to "HashPack" only validate from
https://.
- This is needed due to "HashPack" only validate from
git subtree push --prefix nextapp heroku master
contractdirectory- mainly to facilitating to experiment and develop smart contract
experiment-hashgraph.jsis redundant (really for experiment)experiment-strato.jsis test strato. Use this script to deploy totestnetormainnet- Why the Rollup? Due to the maturity of the library. We use strato as the main library for the web-app. However, we need to compile before it can be use on the browser.
nextappdirectory- on the main page, we separate them into 2 core logic.
\walletpage and\twitterpage. \walletpage need to connect via Hashpack wallet before proceed.- on the page, user get to transfer via Twitter or see their transfer list.
\twitterpage need to connect via Sign In with Twitter.- on the page, it guide user to setup the wallet and update their wallet to the oracle smart contract.
- the user also get to see the list of fund that is transferred to them via this service.
- the used of MongoDB is to store the transaction for query. However, the source of truth is will be on the chain itself.
- on the main page, we separate them into 2 core logic.
We use Hedera smart contract. More specifically, we use the Strato library to communicate with the smart contract. We use Twitter API which to validate the user and send a notification to them when there is a fund transferred to their name.
- This maybe costly (gas fee) if not optimize to query from MongoDB.
- Certain API depends on reading the value from Smart Contract.
- Can consider check for changes before update smart contract to reduce cost.
- Additional work flow for user to directly update Hedera Account within the DM.
- Expanding similar use case to other social media platform.
- Get started with smart contract
- Solidity Dev
- First contract Eg
- Oracle reference
- Using Oracle Example
- Next JS doc
- Hashconnect on Next
- Stratos JS
- Stratos JS Sample
- Stratos JS Rollup Demo
- PR to fix fail example
- Next Auth
- Next Auth Upgrade
- Next Auth Twitter Provider
- Next Auth Example
- Next Auth Example
- Get started with smart contract
