Inspiration

I live in a country where the best way to keep money is in USDT or other stable coins or even non stable coins because our national currency is always being devalued. The issue I have always had keeping money in crypto is the fear of the unknown. As the breadwinner of my nuclear family, what if I die today? how would they access my crypto? What if I am in a coma? what if I am nowhere to be found. Pondering over these questions and thinking about solutions as I live my day to day life, I heard about sBTC for the first time and then it hit me. The most popular of all crypto currencies is BTC. The BTC chain before now had no means of running smart contracts. Thanks to Stacks, there is hope for the most secure and the first ever chain to be able to run protocols. And so I decided that this Idea of mine would be implemented for bitcoin. For this hackathon, I would be implementing the minimalistic and core version of the application.

What it does

The application is a next of kin implementation for the Stacks token. The application takes a list of addresses (max of 3) and puts them in a queue in the order that they came in. These addresses would be able to access the funds in the contract deposited by the deployer if the deployer does not notify the contract of his or her activeness within a particular threshold set by the deployer.

How I built it

Written in Clarity, we assigned a variable to hold a list of addresses that would be set by the contract owner ( who is the deployer as the contract is a vault for a single user). the list are in a queue by their indexes on the list and would have access to funds that can only be deposited by the deployer to the contract. The deployer can from time to time be storing and retrieving funds as they like from to and from the contract without any limit in amount nor frequency of transaction. The deployer would update or continue using the default threshold on the contract. The threshold variable represents the amount of block height that would be mined from the last active transaction by the deployer, which would unlock the ability for the next user on the queue to be able to withdraw all the funds from the contract. The absolute threshold for this calculation is a product of their position in the queue and the threshold variable. Positions are determined by the NFT token IDs allocated to the participants. The owner has an NFT ID if 0 and the others have NFT IDs that are a sum of their index on the list and 1. The frontend would use this non transferrable NFTs to know the different Kins that they belong to and their position in the queue. Anytime the Deployer transacts with the contract, the last-pinged-height is updated to the present block-height so that the span which is the difference between the present block height and the last-pinged-height does not reach or exceed the threshold. If it does, the deployer does not lose their access but now somehow shares it with the next person until the deployer calls the ping method or transacts with the contract. The same goes for everyone in the queue with the formulae below

span = present_block_height - last_pinged_height
1st wallet, span >= (threshold * 1) ---> token 1 can withdraw until next ping by deployer
2nd wallet, span >= (threshold * 2) ---> token 2 can withdraw until next ping by deployer
3rd wallet, span >= (threshold * 3) ---> token 3 can withdraw until next ping by deployer

The token holders apart from the deployer can only withdraw all the STX tokens and not in any amount as they want like the deployer. Each participant can ping basically making sure their threshold does not exceed to the next person's span or even bring it back if it does.

Challenges we ran into

The only challenge I ran into was the frontend. I got to know about the hackathon 2 days ago and I thought we were to submit a full project. My UI designer had finished in the short notice but I was too busy with the contracts to write the frontend and the other frontend dev on my team was unavailable.

Accomplishments that we're proud of

My team and I are a really proud of the fact that we could put these together even the such short notice. and we are also very much excited about the sBTC news as we have another great use case on our sheets

What's next for Stack of Kin (its called Kins Protocol now)

We would love to apply for a grant to fund building and marketing and MVP implementation for STX and sBTC

Stacks address: SP356ASPHXK1EMKDZF5JBA36Z33DKSZD7R4PMCWZB

Built With

Share this project:

Updates