• This repository has been archived on 08/Jul/2024
  • Stars
    star
    408
  • Rank 105,946 (Top 3 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kitty Items: CryptoKitties Sample App

๐Ÿ‘‹ Welcome! This demo app is designed to help you learn to build on Flow.

  • Kitty Items: CryptoKitties Sample App is a complete NFT marketplace built with Cadence, Flow's resource-oriented smart contract programming language.
  • Learn how to deploy contracts, mint NFTs, and integrate user wallets with the Flow Client Library (FCL).

๐ŸŽฌ Live Demo

Check out the live demo of Kitty Items, deployed on the Flow Testnet. The demo features 4 main views: homepage, marketplace, profile page, & admin view to mint your very own Kitty Items.

โœจ Getting Started

Looking for a step by step guide? Follow the Kitty Items tutorial in the Flow documentation.

1. Install Dependencies

๐Ÿ›  This project requires NodeJS v16.x or above. See: Node installation instructions
๐Ÿ›  This project requires flow-cli v0.39.1 or above. See: Flow CLI installation instructions
๐Ÿ›  This project requires Python v3.6 or above. See: Python installation instructions

2. Clone the project

git clone --depth=1 https://github.com/onflow/kitty-items.git

3. Install packages

  • Run npm install in the root of the project.

โš ๏ธ NOTE for Mac M1 users:
You'll need to run the following command in the web project:
From the ./web directory run npm install -D @next/swc-darwin-arm64

Local development

Run this command to start Kitty Items with the Flow local development suite:

npm run dev:emulator

Note: This script launches the Flow Emulator and FCL Development Wallet to simulate the blockchain and an FCL-compatible wallet using the initialization code in this repository

Testnet development

Run npm run dev:testnet and follow the prompt to begin developing on testnet.

If this is your first time interacting with KI or Flow, you will need to create a wallet account (Blocto) using an email. If you created a wallet (Blocto) account before July 7th, the user should create a new account with Blocto. This is because the account storage paths have changed, and the older accounts may result in conflicting paths during minting/purchasing.


Cypress tests

There are 3 ways tests can be run:

  1. dev environment - start the server with npm run dev:emulator and run cypress npx cypress run --headed --browser chrome
  2. Github actions locally - requires the use of https://github.com/nektos/act
    • On Apple M1 - act -j cypress --container-architecture linux/arm64
    • On Intel/AMD - act -j cypress --container-architecture linux/amd64
  3. Github actions - executed automatically when merged to master. Add your branch name to integration-local.yml after line 10 to trigger workflows for every push into your remote branch.

Project Overview

Project Overview

๐Ÿ”Ž Legend

Above is a basic diagram of the parts of this project contained in each folder, and how each part interacts with the others.

1. Web App (Static website) | kitty-items/web

A true dapp, client-only web app. This is a complete web application built with React that demonstrates how to build a static website that can be deployed to an environment like IPFS and connects directly to the Flow blockchain using @onflow/fcl. No servers required. @onflow/fcl handles authentication and authorization of Flow accounts, signing transactions, and querying data using using Cadence scripts.

2. Look Ma, a Web Server! | kitty-items/api

We love decentralization, but servers are still very useful, and this one's no exception. The code in this project demonstrates how to connect to Flow using Flow JavaScript SDK from a Node JS backend. It's also chalk-full of handy patterns you'll probably want to use for more complex and feature-rich blockchain applications, like storing and querying events using a SQL database (Postgres). The API demonstrates how to send transactions to the Flow blockchain, specifically for minting Kitty Items (non-fungible tokens).

3. Cadence Code | kitty-items/cadence

Cadence smart contracts, scripts & transactions for your viewing pleasure. This folder contains all of the blockchain logic for the marketplace application. Here you will find examples of fungible token and non-fungible token (NFT) smart contract implementations, as well as the scripts and transactions that interact with them. It also contains examples of how to test your Cadence code.

๐Ÿ˜บ What are Kitty Items?

Items are hats for your cats, but under the hood they're non-fungible tokens (NFTs) stored on the Flow blockchain.

Items can be purchased from the marketplace with fungible tokens. In the future you'll be able to add them to Ethereum CryptoKitties with ownership validated by an oracle.

โ“ More Questions?

Troubleshooting

Non-Intel issues

You'll need to run the following command in the web project:
From the ./web directory run npm install -D @next/swc-darwin-arm64
If you're running on another non-intel based system, the issue and troubleshooting steps are detailed here: vercel/next.js#30468

Rebuild dependencies

  • The api and web projects depend on sqlite3. If you change node versions on your system, you'll need to cd into the web and api directory and run npm rebuild to rebuild you dependencies for the new version.

Finding the logs

  • You can see what processes have been started, and if they are online using pm2 list
  • You can tail logs for individual processes using pm2 logs [process name]. eg., pm2 logs api or pm2 logs web
  • You can tail all logs in the same terminal using pm2 logs

Starting over

  • In the event of problems, you may want to start over. To reset the project, perform these steps:
    • Run pm2 delete all to stop and delete all processes
    • Delete database files in ./api. (kitty-items-db-*.sqlite)

Unblock ports

  • Kitty Items uses the following ports. Make sure they are not in use by another process
    • 8080 : Flow emulator
    • 3569 : Flow emulator
    • 3000 : Kitty Items API
    • 3001 : Kitty Items web app
    • 8701 : FCL dev-wallet

Understanding the Marketplace

  • The Kitty Items Marketplace on testnet is universal. Every instance of Kitty Items deployed on Testnet points to the same marketplace (NFTStorefrontV2) contract. So, you may see other listing s showing up in your Kitty items instance, but you will not see items in your marketplace page that were added before you deployed your instance of Kitty Items.

๐Ÿš€ Happy Hacking!

More Repositories

1

flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
Go
532
star
2

cadence

Cadence, the resource-oriented smart contract programming language ๐Ÿƒโ€โ™‚๏ธ
Go
505
star
3

flow-nft

The non-fungible token standard on the Flow blockchain
Cadence
459
star
4

flow

Flow is a fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them ๐ŸŒŠ
Go
357
star
5

fcl-js

FCL (Flow Client Library) - The best tool for building JavaScript (browser & NodeJS) applications on Flow ๐ŸŒŠ
JavaScript
318
star
6

flow-go-sdk

Tools for building Go applications on Flow ๐ŸŒŠ
Go
211
star
7

flow-cli

The Flow CLI is a command-line interface that provides useful utilities for building Flow applications
Go
207
star
8

flow-ft

The Fungible Token standard on the Flow Blockchain
Cadence
136
star
9

flow-playground

Flow Playground front-end app ๐Ÿคนโ€โ™‚๏ธ
TypeScript
112
star
10

nft-storefront

A general-purpose Cadence contract for trading NFTs on Flow
Cadence
102
star
11

flow-core-contracts

Cadence smart contracts that define core functionality of the Flow protocol
Go
86
star
12

flow-emulator

The Flow Emulator is a lightweight tool that emulates the behaviour of the real Flow network
Go
84
star
13

freshmint

TypeScript
68
star
14

vscode-cadence

The Visual Studio Code extension for Cadence
TypeScript
52
star
15

fcl-dev-wallet

A Flow wallet for development purposes. To be used with the Flow Emulator.
Go
50
star
16

developer-grants

Grants for developers that contribute to the broader developer ecosystem
50
star
17

flip-fest

A backlog of all the available tasks to complete for Flow's FLIP Fest.
50
star
18

flow-js-testing

Testing framework to enable Cadence testing via a set of JavaScript methods and tools
JavaScript
46
star
19

atree

Atree provides scalable arrays and scalable ordered maps.
Go
39
star
20

nft-catalog

Cadence
37
star
21

flow-101-quest

Cadence
30
star
22

flips

Flow Improvement Proposals
25
star
23

cadence-tools

Developer tools for Cadence
Go
24
star
24

flow-cadut

Node based template generator to simplify interaction with Cadence files.
JavaScript
22
star
25

wallet-api

A REST API to create and manage Flow accounts
HTML
22
star
26

walletless-arcade-example

An example Flow App to demonstrate walletless onboarding and promote composable, secure, and smooth UX for on-chain games without the need for a traditional backend.
Cadence
21
star
27

monster-maker

Create a monster on Flow
TypeScript
18
star
28

hybrid-custody

Cadence suite enabling Hybrid Custody on Flow
Cadence
15
star
29

rosetta

Rosetta implementation for the Flow blockchain
Go
15
star
30

UnityFlowSDK

Flow SDK for Unity - build Unity games on the Flow blockchain
C#
13
star
31

flow-java-client-example

Java
12
star
32

wallet-extension-example

An example and guide showing how to build an FCL-compatible wallet extension on Flow.
JavaScript
12
star
33

fcl-discovery

JavaScript
11
star
34

flow-interaction-template-service

TypeScript
11
star
35

flow-playground-api

Flow Playground back-end app ๐Ÿคนโ€โ™‚๏ธ
Go
11
star
36

linked-accounts

Cadence
11
star
37

ledger-app-flow

JavaScript
10
star
38

sc-eng-gaming

Showcasing how a Rock Paper Scissors game could be made #onFlow
Cadence
10
star
39

flow-batch-scan

Library for running batch scans of the flow network
Go
10
star
40

flow-evm-gateway

FlowEVM Gateway implements an Ethereum-equivalent JSON-RPC API for EVM clients to use
Go
9
star
41

cadence-libraries

Libraries for common programming utilities in the Cadence smart contract programming language
Go
9
star
42

flow-evm-bridge

Repository for contracts supporting bridge between Flow <> EVM
Cadence
9
star
43

sdks

Tips and resources for building Flow SDKs and client libraries ๐Ÿ”ง
Cadence
9
star
44

developer-portal

Source code for developers.flow.com
TypeScript
8
star
45

docs

Flow Developer Portal. Discover the developer ecosystem and master the Flow blockchain
TypeScript
8
star
46

cadence-lang.org

The home of the Cadence website
MDX
8
star
47

cadence-cookbook

JavaScript
8
star
48

flow-multisig

JavaScript
8
star
49

OWBSummer2020Project

OWB (Open World Builders) bootcamp summer 2020 cohort capstone projects submission
CSS
8
star
50

Flow-Working-Groups

8
star
51

casestudies

Learn more about building on Flow from teams that have already launched successful projects
7
star
52

BFTune

Byzantine Fault Tolerance (BFT) Testing Framework for Flow
7
star
53

cadence-style-guide

The Flow Team guide on how to write better Cadence code
7
star
54

twg

Tokenomics Working Group
6
star
55

flowkit

Go
6
star
56

flow-interaction-template-tools

TypeScript
6
star
57

flow-kmm

Kotlin Multiplatform Mobile (KMM) library for building Android and iOS applications on the Flow blockchain
Objective-C
5
star
58

scaffold-flow

๐ŸŒŠ forkable Flow dev stack focused on fast product iterations
JavaScript
5
star
59

flow-issue-box

A public repository dedicated to collecting issues and feedback from external contributors. The Issue Box ๐Ÿ—ณ๏ธ is similar to a backlog, where the issue is later triaged and assigned to the proper team.
5
star
60

ccf

Cadence Compact Format (CCF) is a binary data format and alternative to JSON-CDC
4
star
61

token-cold-storage

JavaScript
4
star
62

cddl

A CDDL implementation in Go
Go
4
star
63

Offers

Cadence
4
star
64

full-observer-node-example

An example demonstrating the use of the Flow unstaked consensus follower
Go
4
star
65

flow-account-api

Go
4
star
66

faucet

Cadence
4
star
67

contract-updater

Enabling delayed contract updates to a wrapped account at or beyond a specified block height
Cadence
4
star
68

flow-validator

Run a Flow node and help secure the network
4
star
69

flow-playground-tutorials

Repository to contain and test tutorials, which are deployed to Playground and used in docs
Cadence
3
star
70

flow-public-key-indexer

A observer service for indexing flow Accounts and by their associated Keys.
Go
3
star
71

flow-cadence-eth-utils

Cadence
3
star
72

flow-cadence-hrt

Write your Cadence tests with human readable TOML
JavaScript
3
star
73

random-coin-toss

An example repo demonstrating safe use of onchain randomness
Cadence
3
star
74

blindninja

Blind Ninja is a composability-first fully onchain game on Flow
JavaScript
3
star
75

waterhose

Waterhose listens to Flow events and publishes them to Kafka
2
star
76

fcl-auth-android

A Kotlin library for the Flow Client Library (FCL) that enables Flow wallet authentication on Android devices
Kotlin
2
star
77

service-account

Cadence
2
star
78

fcl-six

Stored Interactions (SIX) for FCL
JavaScript
2
star
79

flow-scaffold-list

Scaffolds for starting Flow apps
2
star
80

hybrid-custody-scaffold

Starter template for working with HybridCustody contract suite
Cadence
2
star
81

fcl-contracts

Cadence contracts used by the Flow Client Library (FCL)
Cadence
2
star
82

crypto

Assembly
2
star
83

dex

2
star
84

gwg

The Flow Governance Working Group (GWG) is an open-for-all forum that plays a pivotal role in shaping the Flow ecosystem with a focus on discussing and resolving governance issues.
2
star
85

next-docs-v0

next-docs
JavaScript
1
star
86

storage-fees-scripts

1
star
87

unity-flow-sdk-api-docs

HTML
1
star
88

fusd

Cadence source code for the FUSD stablecoin on Flow
Cadence
1
star
89

band-oracle-contracts

Contracts and related for integration with Band protocol Oracle Network
Cadence
1
star
90

cadence-1-migrator

Cadence
1
star
91

fcl-gcp-kms-web

JavaScript
1
star
92

fcl-next-scaffold

JavaScript
1
star
93

wallet-wg

Flow Wallet Working Group
1
star
94

minting-nfts-in-a-set

Cadence Cookbook Recipe: Minting NFTs in a Set
Cadence
1
star
95

create-a-marketplace

Cadence Cookbook Recipe: Create a Marketplace
Cadence
1
star
96

metadata-views

Cadence Cookbook Recipe: Metadata Views
Cadence
1
star
97

create-a-topshot-play

Cadence Cookbook Recipe: Create a TopShot Play
Cadence
1
star
98

collection-for-holding-nfts

Cadence Cookbook Recipe: Collection for Holding NFTs
Cadence
1
star
99

add-a-play-to-topshot-set

Cadence Cookbook Recipe: Add a Play to TopShot Set
Cadence
1
star
100

minting-a-moment-in-topshot-set

Cadence Cookbook Recipe: Minting a Moment in TopShot Set
Cadence
1
star