Finschia / flutter-bird

A decentralized Flappy Bird clone making use of NFTs.
MIT License
0 stars 1 forks source link

Flutter Bird Cover

Flutter Bird (Prototype)

TL;DR A decentralized Flappy Bird clone making use of NFTs.

Flutter Bird imitates the minigame "Flappy Bird" which domitated the AppStores in 2014. On top of that Flutter Bird adds one basic feature to the original game: The ability to play with alternative skins. These skins are realised as NFTs on the Ethereum Blockchain. The Purpose of Flutter Bird is to demonstrate the processes of an Ethereum Authentication and Authorization with NFTs within a Flutter Application. Flutter Bird has been developed as part of my bachelor thesis.

Flutter Application (Flappy Bird App)

The Frontend Application is built with Flutter. The Game Logic as well as Authentication and Authorization processes are implemented in this application. The Flutter Application is referred to as Flutter Bird App. It runs on iOS, Android and the Web.

NFT-Collection (Flappy Bird Skins)

The NFT-Collection consists of 1000 Image Files that each represent a different skin for flutter bird. These images are stored in the IPFS and ownership is managed with an ERC-721 Smart Contract. The Smart Contract is referred to as Flutter Bird Skins. It has been deployed on the Ethereum Testnet "Goerli". Flutter Bird Skins can be found on Etherscan and on OpenSea.

Authors

Features

Tech Stack

Client: Flutter application for iOS, Android and Web

Blockchain: Ethereum (Goerli Testnet)

Smart Contract Standard: ERC-721

Node Provider: Alchemy Supernode

Storage: IPFS

Demo

Flutter Bird Demo

Build and Run Locally (Flutter App)

Prerequisites:

Steps:

  1. Clone project
git clone https://github.com/Tonnanto/flutter-bird
  1. Create secrets.dart file at flutter_bird_app/lib/secrets.dart.
  2. Add the following contents to the file and insert your alchemy api key:
const alchemyApiKey = "YOUR_ALCHEMY_API_KEY";
  1. Go to apps directory
cd flutter-bird/flutter_bird_app
  1. Install dependencies
flutter pub get
  1. Run app on an available device.
    Hint: Use an IDE to comfortably connect real mobile devices or mobile simulators. Browsers should be available by default.
flutter install

Troubleshooting:

flutter doctor
flutter analyze

More info here

Mint Skin-NFT

In order to use a Flutter Bird Skin in the game you need to mint one first.

Prerequisites:

Steps:

  1. Visit the contracts page on etherscan.

  2. Find a skin that has not been minted by entering values between 0 and 999 in the ownerOf function. If it returns an error, the skin has not been minted, and you can proceed to the next step. If no skin is available, you have to buy one on a secondary market like OpenSea.

  3. Go to Write Contract

  4. Click "Connect to Web3" and connect your wallet.

  5. Use the mintSkin function and enter 0.01 as the payableAmount, and the token ID from step 2 as the newTokenId

  6. Click "Write" and confirm and sign the transaction with your wallet.

  7. Once the transaction is successful, you have successfully minted a skin that you can use in the Flutter Bird App.

For Klaytn testnet

./flutter_bird_skins/.env

PRIVATE_KEY=XXXXX
API_URL=https://XXXX

Compiling your contracts...

✓ Fetching solc version list from solc-bin. Attempt #1 ✓ Downloading compiler. Attempt #1.

Everything is up to date, there is nothing to compile.

Starting migrations...

Network name: 'baobab' Network id: 1001 Block gas limit: 999999999999 (0xe8d4a50fff)

1_initial_migration.js

Replacing 'FlutterBirdSkins'

transaction hash: 0xcfe48dd339af389ed2dd85e2b94ac53fb64c9874fb2980b7e59e55aa2ec58eb9 Blocks: 0 Seconds: 0 contract address: 0xAca84dc56A05bbC7a335a74d9e13C91dfA2Ea16D block number: 158855531 block timestamp: 1720436952 account: 0xeB022B68B17Ec89e539C6F5BD740c648c013D9e0 balance: 59.645653649985826146 gas used: 4724618 (0x48178a) gas price: 25.000000001 gwei value sent: 0 ETH total cost: 0.118115450004724618 ETH

Saving artifacts

Total cost: 0.118115450004724618 ETH

Summary

Total deployments: 1 Final cost: 0.118115450004724618 ETH

Generate and Mint full onchain bird

# node scripts/mint_full_onchain_bird/mint_random_skin.js
Minting a random Flutter Bird Skin on contract: 0xBa29cfe58943Ee7830663C31029ef73f65B1D470
data:application/json,{"name":"Flutter Bird - 358","description":"NFT Flutter Bird","attributes":[{"trait_type":"File size","value":"17,510 bytes"}],"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAALuCAYAAADxHZPKAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3dW4xsWXkf8G/VnDMzppuLLWMD4WI5sjkTkBwFCytyZJLYGWGEIkRAAhmJEGEpD4mSOHFirOAHiPEFIhNFQnF4QLIQ..."}
chunk count: 1
appendUri tx: [object Object]
Minting successful
Token ID of new Skin: 358
0xbfd1a547a6dc6d332e5dc23530992c550719c8db3e39ef3454d8cb24c05617be
# node scripts/transfer_nft.js 0xde7c30d8548b1b38856aa3ae2bf02c536ab60f1e 66
Sender address: 0x492ca3c9594B17b65494F910A9a33Fa66f3141ed
Recipient address: 0xde7c30d8548b1b38856aa3ae2bf02c536ab60f1e
Token ID: 66
NFT (Token ID: 66) successfully transferred
Transaction Hash: 0x5a2c95a0a19e7621f21f058fcc712d92a0850ea5cc0983444d3904c1d72b5025

Access via LINE

The LINE Messenger API allows us to receive URLs via LINE.

image