Inspiration

When I first learned about Stacks NFTs about a year ago, I aped in. This was an opportunity for me, as a Bitcoin enthusiast, to contribute to the development of this emerging ecosystem. At the same time, a close friend of mine was creating some beautiful pixel art, and I realized that by combining our skills and resources, we could create something truly special.

That's how bitgear was born. We wanted to create a project that would appeal to gamers and collectors alike, by offering a range of unique and imaginative items that could be used to enhance and personalize their NFT characters. By leveraging the strengths of both Stacks and Clarity, we were able to create a project that was both fun and functional, while also promoting the wider adoption of the Bitcoin.

Story Time 📖

Okay, so imagine you have this cool game where you can collect special things called NFTs. NFTs are like digital items that you can't touch, but they're still really special because they're one-of-a-kind.

Now, there's this project called bitgear that adds even more fun to the game. It's like a store where you can get fantasy-style weapons, armor, and jewelry for your NFT characters.

But bitgear is not just any ordinary store, it's also a way to make your NFT character stronger and cooler. You can "equip" your bitgear to your NFT character, just like how you put on clothes in real life.

And there are even special characters called NPC, like the "dungeon-master," who help keep the game fair and give out rewards when you complete quests. The dungeon-master is like the boss of bitgear, and only they can take money out of the store.

As the game gets more popular, new dungeon-masters can take over and make it even better. It's kind of like a team of people working together to make the game more fun for everyone.

So basically, bitgear is a way to make your NFT characters even cooler and stronger, while also making the game more fair and fun for everyone.

Contracts

Traits

🧬 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/bitgear-traits-v1.clar

Core Contract

NFTs/Treasury

🏷️ https://explorer.stacks.co/txid/SP2D5BGGJ956A635JG7CJQ59FTRFRB0893514EZPJ.bitgear-genesis?chain=mainnet

👨‍💻 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/bitgear-genesis.clar

Character Creation

Leveraging ecosystem NFTs as identity providers for authentication

🕹️ https://explorer.stacks.co/txid/SP2D5BGGJ956A635JG7CJQ59FTRFRB0893514EZPJ.player-character-v0?chain=mainnet

👨‍💻 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/player-character-v0.clar

Equipment Logic

Interoperability between multiple contracts

👨‍💻 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/equipment-v0.clar

👨‍💻 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/bitgear-genesis-slots.clar

Quests/NPCs

Rewards and Gaming functionality

🌲 https://explorer.stacks.co/txid/ST2D5BGGJ956A635JG7CJQ59FTRFRB08934NHKJ95.woodlands-rc3?chain=testnet

👨‍💻 https://github.com/pointblankdev/bitgear-nft-contract/blob/master/contracts/woodlands-v0.clar

How we built it

Our approach involved utilizing several essential tools such as Clarity, stacks.js, and React/Next/Vercel. In addition to our technical tools, we also thoroughly reviewed contracts from other NFTs and DeFi projects. This enabled us to leverage the best practices and insights from other successful projects and implement them into our solution.

Challenges we ran into

Transferring assets to and from contract addresses is a challenging process, especially when implementing it with stacks.js and post-conditions. The main issue is sending tokens or other assets directly to the contract address, which requires a great deal of care to ensure that it's done correctly.

Defining post-conditions accurately is also a challenge when transferring assets to and from contract addresses. The stacks-explorer currently does not support post-conditions, which has been a significant pain point for me in the past year.

Despite these challenges, I remain optimistic that solutions will emerge, and the stacks-explorer will soon support post-conditions. In the meantime, I'll work around this limitation to ensure the correct functioning of my smart contracts.

Accomplishments that we're proud of

I'm really happy with the progress achieved during this past week, particularly given that I was able to build upon previous work despite the setback of having to take a break to attend to financial obligations. The hackathon reignited my motivation to resume where I left off and has resulted in some significant accomplishments.

Specifically, we recruited a new technical team member, successfully completed the first quest and reward issuance contract, and tested the equipment contract on testnet. Additionally, I'm delighted to have introduced new contract functionality, which I believe is a unique addition to the Stacks ecosystem. This functionality enables interoperability between bitgear and external contracts such as byte-fighters, bitcoin badgers, and happy welsh.

What we learned

In any given field, there are often multiple ways to approach a problem, and there is rarely a single "right way" to do things. This is particularly true in technology and innovation, where new solutions and approaches are constantly emerging.

To be successful in this space, it's essential to put in a significant amount of effort and dedication to finding novel ways to solve interesting problems. Simply following the status quo is unlikely to result in significant breakthroughs or achievements.

Instead, those who are willing to explore new ideas, experiment with different approaches, and push the boundaries of what is currently possible are most likely to achieve success. This requires a willingness to take risks and a commitment to continuous learning and growth.

What's next for bitgear?

Our next step is to deploy the Dungeon Master DAO (Decentralized Autonomous Organization) similar to the ALEX DAO. This will enable us to build a scalable system for quests and involve the community more in proposals, direction and development. Moving away from my direct management as the dungeon-master, we believe this will create a more decentralized, community-driven ecosystem for bitgear.

As someone who is committed to community involvement, I strongly believe in the power of community-driven quests. I would love to see the community take an active role in shaping the future of the questing experience by proposing and developing new quests. By working together, we can create an even more engaging and rewarding experience for all bitgear users.

I have a proposal to integrate our treasure management with ALEX DeFi, which will enable us to put the treasury to work earning interest and issue rewards beyond what was collected in the initial mint sale. It just makes sense to put the capital to use, and I believe this integration will provide even more value to bitgear users.

Finally, I'd like to put forward a new quest that will allow holders to burn their bitgear for a STX reward equivalent to the initial mint price. This will provide added incentive for our community and showcase our commitment to creating value for our users.


Testing with clarinet console

git clone https://github.com/pointblankdev/bitgear-nft-contract

cd bitgear-nft-contract

clarinet console

;; Here's a quick primer on what's fully functional right now in bitgear.
;; You can test this by pulling the code via github and running these commands in clarity console.

;; add byte-fighters to the list of "allowed" collections to play in bitgear 
(contract-call? .player-character-v0 add-collection .byte-fighters)

;; mint a NFT to play as your avatar 
(contract-call? .byte-fighters mint)

;; create your character! make sure to give it a good name ;) 
(contract-call? .player-character-v0 roll-character u"Rozar" .byte-fighters u1000)

;; look at your shiny new character (might need to change the principal) 
(contract-call? .player-character-v0 get-character 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM)

;; get some bitgear to equip to your character 
(contract-call? .bitgear-genesis claim u0)

;; initialization call (couldn't find a way to have this happen automagically) 
(contract-call? .equipment-v0 initialize-equipment)

;; test out the is-gear-equipped check in a failure case 
(contract-call? .equipment-v0 is-gear-equipped 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM) ;; fails

;; EQUIP GEAR :D 
;; Fun fact... this isn't limited to just the bitgear collection-
;; any NFT collections can make their own NFTs "equipment" by simply creating a "gear-slots" contract 
;; which defines a mapping between the NFTs and what slots they are allowed to be equipped to- 
;; e.g. head, main-hand, wrist, etc.
;; I created the gear-slots-trait for this very purpose
(contract-call? .equipment-v0 equip-gear-off-hand .player-character-v0 .bitgear-genesis u0 .bitgear-genesis-slots)

;; check out yourself!
(contract-call? .equipment-v0 is-gear-equipped 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM)
;; looking goood...

;; QUESTS! 📯 Dun, dun dun daaa...

;; this is the prep-work that in a future state will be managed by the DAO/dungeon-master 
;; let's grab a NFT from the bitgear-genesis contract so we can toss it into a rewards vault 
(contract-call? .bitgear-genesis claim u1)

;; unequip the gear to test out authorization 
(contract-call? .equipment-v0 unequip-gear-off-hand)

(contract-call? .woodlands-v0 quest u1) ;; fails
;; questing fails, need to have bitgear equipped to quest! (did i make liquid staking? jk) 

;; ok, put equipment back on, we want to quest! 
(contract-call? .equipment-v0 equip-gear-off-hand .player-character-v0 .bitgear-genesis u0 .bitgear-genesis-slots)

(contract-call? .woodlands-v0 quest u1) ;; fails
;; not so fast! the "woodlands" is not the active dungeon-master so it can't issue rewards. 
;; this is an exciting part of the whole rewards issuance idea 

;; make the woodlands the dungeon-master 
(contract-call? .bitgear-genesis bestow .woodlands-v0)
;; in a future state, the DAO would manage this transfer of control
;; or just be the dungeon master itself and facilitate transactions.
;; work in progress for sure. 

(contract-call? .woodlands-v0 quest u1) ;; fails
;; one problem left- NFT reward not yet deposited into the reward vault 
;; quest fails, unable to find the reward 

;; ok, drop off the reward in the vault so it's free to get claimed 
(contract-call? .bitgear-genesis transfer u1 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM .bitgear-genesis)

(contract-call? .woodlands-v0 quest u2) ;; fails
;; ah picked the wrong uint! gotta search harder to find it 
;; i hope this encourages people to use the block-explorer 
;; and review transactions to find rewards 

(contract-call? .woodlands-v0 quest u1)
;; Quest Completed! 

;; this was a basic end-to-end process to see how the bitgear project works. 
;; i hope the possibilities you see here excite you like they do for me. 
;; thanks! -rozar.btc

Built With

Share this project:

Updates

posted an update

;; Ran out of time while updating the submission, so here's a quick primer on what's fully ;; functional right now in bitgear. You can test this by pulling the code via github and running ;; these commands in clarity console.

;; add byte-fighters to the list of "allowed" collections to play in bitgear (contract-call? .player-character-v0 add-collection .byte-fighters)

;; mint a NFT to play as your avatar (contract-call? .byte-fighters mint)

;; create your character! make sure to give it a good name ;) (contract-call? .player-character-v0 roll-character u"Rozar" .byte-fighters u1000)

;; look at your shiny new character (might need to change the principal) (contract-call? .player-character-v0 get-character 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM)

;; get some bitgear to equip to your character (contract-call? .bitgear-genesis claim u0)

;; initialization call (couldn't find a way to have this happen automagically) (contract-call? .equipment-v0 initialize-equipment)

;; test out the is-gear-equipped check in a failure case (contract-call? .equipment-v0 is-gear-equipped 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM) ;; fails

;; EQUIP GEAR :D (FYI this isn't limited to just the bitgear collection- other NFT collections can ;; make their own NFTs "equipment" by simply creating a "gear-slots" contract which defines a ;; mapping between the NFTs and what slots they are allowed to be equipped to- e.g. head, ;; main-hand, wrist, etc.) (contract-call? .equipment-v0 equip-gear-off-hand .player-character-v0 .bitgear-genesis u0 .bitgear-genesis-slots)

;; check our yourself! looking good (contract-call? .equipment-v0 is-gear-equipped 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM)

;; QUESTS! Dun, dun dun daaa...

;; this is the prep-work that in a future state will be managed by the DAO/dungeon-master ;; grabbing a NFT from the og contract so we can toss it into a rewards vault (contract-call? .bitgear-genesis claim u1)

;; unequip the gear to test out authorization (contract-call? .equipment-v0 unequip-gear-off-hand)

;; questing fails, need to have bitgear equipped to quest! (did i make liquid staking? jk) (contract-call? .woodlands-v0 quest u1) ;; fails

;; ok, put equipment back on, we want to quest! (contract-call? .equipment-v0 equip-gear-off-hand .player-character-v0 .bitgear-genesis u0 .bitgear-genesis-slots)

;; not so fast! the "woodlands" is not the active dungeon-master so it can't issue rewards. ;; this is an exciting part of the whole rewards issuance idea (contract-call? .woodlands-v0 quest u1) ;; fails

;; make the woodlands the dungeon-master ;; in a future state, the DAO would manage this transfer of control, or just be the dungeon master itself and facilitate transactions. work in progress for sure. (contract-call? .bitgear-genesis bestow .woodlands-v0)

;; one problem left- NFT reward not yet deposited into the reward vault ;; quest fails, unable to find the reward (contract-call? .woodlands-v0 quest u1) ;; fails

;; ok, drop off the reward in the vault so it's free to get claimed (contract-call? .bitgear-genesis transfer u1 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM .bitgear-genesis)

;; ah picked the wrong uint! gotta search harder to find it ;; i hope this encourages people to use the block-explorer ;; and review transactions to find rewards (contract-call? .woodlands-v0 quest u2) ;; fails

;; Quest Completed! (contract-call? .woodlands-v0 quest u1)

;; this was a basic end-to-end process to see how the bitgear project works. ;; i hope the possibilities you see here excite you like they do for me. ;; thanks! -rozar.btc

Log in or sign up for Devpost to join the conversation.