Open18

Memo: Stacks

じんじん

なぜビットコインなのか?

1. 安全

ビットコインは最も実績のある分散型ブロックチェーンです。ビットコインをベースレイヤーとすることで、ユーザーも開発者もビットコインを強力で安全なものにしている特性の恩恵を受けることができる。

2. 採用

Bitcoinは最も馴染みがあり、採用されている暗号資産であるため、ビルダーは膨大なユーザーベースと未開拓の資本にアクセスできる。

3. 未開拓

1兆ドルを超える潜在的資本が、構築者、創業者、クリエイターの活性化を待っている。

じんじん

Build on Bitcoin, the most secure base layer

1. SECURED BY BITCOIN

Transactions on Stacks will be as irreversible as Bitcoin's.
スタック上の取引は、ビットコインと同様に不可逆的になる。

2. Bitcoin network effects

Build experiences for a massive, largely untapped audience.
未開拓の巨大なオーディエンスに向けた経験を構築する。

3. SMART CONTRACTS WITH CLARITY

A security-first programming language with visibility on Bitcoin state.
ビットコインの状態を可視化するセキュリティ優先のプログラミング言語。

4. Developer tools & Community

Enjoy tools, tutorials, and a vibrant community to aid you build.
ツール、チュートリアル、活気あるコミュニティがあなたのビルドをサポートします。


APPS AND PROJECTS

ZEST PROTOCOL

Zest Protocol is a lending protocol, built for Bitcoin.
Zest Protocolはビットコイン向けに構築されたレンディング(貸付)プロトコルです。
https://app.zestprotocol.com/

SORDINALS

Scaling ordinals with Stacks.
StacksでOrdinalsを拡張するプロジェクトです。
https://github.com/fess-v/sordinals

STX20

The STX20 protocol introduces a novel approach to creating and sharing digital artifacts on the Stacks blockchain.
STX20プロトコルは、Stacksブロックチェーン上でデジタルアーティファクトを作成・共有する新しいアプローチを導入します。
https://stx20.com/Explore

STAKING DAO

Liquidity for stacked tokens on Stacks.
Stacksのステーキングされたトークンに流動性を提供するプロジェクトです。
https://www.stackingdao.com/

VELAR

Velar is a multi-feature DeFi app with Bitcoin finality, built on Stacks.
Velarは、Stacks上で構築され、ビットコインのファイナリティ(最終性)を備えた多機能DeFiアプリです。
https://velar.com/

ASIGNA

Multisig wallet for Bitcoin, Ordinal BRC20s, and Stacks.
ビットコイン、Ordinal BRC20、およびStacks向けのマルチシグウォレットです。
https://www.asigna.io/

HERMETICA

A Bitcoin-backed, yield-bearing synthetic dollar protocol.
ビットコイン担保の、利回りを生むシンセティック(合成)ドルのプロトコルです。
https://hermetica.fi/

BITFLOW

The decentralized exchange for Bitcoiners.
ビットコイナーのための分散型取引所(DEX)です。
https://www.bitflow.finance/

Decentralized bio links using .btc domains.
.btcドメインを使って分散型のバイオリンクを提供します。
https://owl.link/

XVERSE

The Bitcoin wallet for everyone. Connect to Stacks apps and stacking pool with Ledger support. Available on iOS, Android, and Chrome.
誰にでも使いやすいビットコインウォレットです。Stacksアプリやステーキングプールに接続可能で、Ledgerサポートも提供します。iOS、Android、Chromeで利用可能です。
https://www.xverse.app/

LEATHER WALLET BY TRUST MACHINES

The Bitcoin wallet for the rest of us (fka Hiro Wallet).
ビットコインウォレットの決定版(旧Hiro Wallet)。
https://leather.io/

CONSOLE

A place for decentralized communities to focus and take action.
分散型コミュニティが集中して行動を起こすための場所です。
https://www.console.xyz/

じんじん

Stacks Primer

https://stacks.org/dev

Day 1: Understanding Stacks

Stacks is the leading Bitcoin L2 designed to bring smart contract functionality to Bitcoin. But what does it mean? How does Stacks work? What does Bitcoin L2 mean? In Day 1, we’ll cover exactly what Stacks is and how it works, plus provide links to resources for those of you who want to dive deeper.

Day 2: Introduction to sBTC

sBTC is the upcoming trust-minimized bridge. It’s the backbone of how we can activate and use Bitcoin on the Stacks L2 in as trust-minimized of a way as possible. When we talk about building the Bitcoin economy, it means we need to be able to use BTC in our smart contract. sBTC is how we do that, and in this lesson, we’ll cover how it works and how you can start experimenting with it now, even before it is released.

Day 3: Writing your first Clarity smart contract

Clarity is the smart contract language on Stacks. In this lesson, we’ll cover how it works and you’ll get introduced to Clarity by writing a basic borrowing and lending contract…using sBTC!

Day 4: Set up your Stacks dev environment

If you want to be a successful Stacks developer, you’ll need to be familiar with all the different tools you’ll be using. In this lesson, we’ll cover all of those tools and get your local developer environment set up for success.

Day 5: Kicking off your own Stacks project

Tutorial hell is the worst, and you should begin building your own projects as soon as possible. But that is easier said than done. In the final lesson, we’ll cover how to come up with an idea for your project, how to get paid just for working on it, potential funding paths, and how to stay consistent and motivated in the long term.

Bonus: How to Get Paid

After you finish the course, we’ll show you exactly how to start immediately getting paid to work on your project, and how to join an exclusive group of elite Stacks builders.

じんじん

Day 1: Understanding Stacks

Stacks is the leading Bitcoin L2 designed to bring smart contract functionality to Bitcoin. But what does it mean? How does Stacks work? What does Bitcoin L2 mean? In Day 1, we’ll cover exactly what Stacks is and how it works, plus provide links to resources for those of you who want to dive deeper.

Welcome back Stacks builder 🏗️

Today, we’re going to be covering:

  • What Stacks is
  • How Stacks works at a technical level
  • How Stacks operates as a Bitcoin L2
    Let’s dive in.
じんじん

🔸 Stacks Basics

Stacks is a Bitcoin L2 designed to bring smart contract functionality to Bitcoin.

That’s the gist and the most important takeaway from this lesson. But what does that mean?

By design, Bitcoin is a very simple distributed system. This means that it makes excellent money and is extremely secure and stable. But the tradeoff here is that we can’t do complex programming tasks like we can in Ethereum.

That’s where Stacks comes in. Rather than trying to create a completely new blockchain that competes with Bitcoin, Stacks takes a layered approach: keep the base layer extremely simple, stable, and secure, and add complexity at the second layer.

Stacks is that second layer.

Stacks is a separate but complementary blockchain that uses Bitcoin as its base security layer to add additional functionality without compromising the security and stability of Bitcoin itself.

Stacks can’t exist without Bitcoin and it inherits the security of Bitcoin.

But how does that work?


🔸 Stacks Basics
・StacksはBitcoinにスマコンの機能をもたらすために設計された
→ Bitcoin L2で、Bitcoinのセキュリティを活用しつつ、拡張機能として活用できる
・BitcoinはEthereumのように複雑なプログラムによるタスク実行ができない
→ StacksはL2という観点で動く

すなわち、Bitcoinの補完するブロックチェーン かつ Bitcoinに依存しなければならない側面も持つ

じんじん

🔸 How Stacks Works

Stacks uses a consensus mechanism called Proof of Transfer (PoX). At its core, PoX seeks to mimic PoW’s functionality programmatically. So as a Bitcoin miner, I spend one external resource (electricity) for a chance to mine Bitcoin.

With Stacks, we take that one level up, and as a Stacks miner, I spend an external resource (BTC) for a chance to mine new STX. I do that by spending my Bitcoin and sending it to a specific address. In goes Bitcoin, out comes new Stacks blocks that keep the chain moving forward.

All of that means transactions in Stacks blocks are recorded on the Bitcoin chain. After the Nakamoto upgrade which is currently being rolled out, miners will be able to produce blocks between Bitcoin blocks, allowing for fast transactions. And further, these transactions will become as irreversible as Bitcoin's once confirmed.


🔸 How Stacks Works
・コンセンサスアルゴリズム: Proof of Transfer (PoX)
・Stacksのブロックの取引は、bitcoin chainに追加される
→ Stacksブロックのハッシュやブロック情報がビットコインのトランザクションの一部に記録される

じんじん

🔸 Fast blocks

Each Bitcoin block, a Stacks miner is cryptographically selected for a mining tenure, rather than mining a single Stacks block. During this tenure, they create and propose new Stacks blocks every few seconds. These Stacks blocks are then sent to Stackers for validation, after which they will be approved and appended to the chain (assuming they are valid).


・Stacksのブロックは、ビットコインの1つのブロックが生成される間に複数回生成される。ビットコインのブロック間の「スロット」にStacksのブロックが配置される
→ Stacksチェーンがビットコインブロックチェーンと連動し、Stacksのブロックがビットコインのブロックチェーンに「アンカー」される
・Stacksでは、ビットコインの各ブロックが生成されるごとに1人のStacksマイナーが選ばれ、その期間中に高速で複数のStacksブロックを生成する
→ だから10分間(Bitcoinのブロック生成の時間間隔)の中に複数のブロックが存在する

じんじん

🔸 Bitcoin finality

As part of this process, miners are required to build atop the agreed-upon chain tip. This prevents miners from creating new Stacks forks, which means that (in addition to recording the hash of all Stacks history to the Bitcoin chain) you would have to attack and modify the history of the Bitcoin chain to modify the history of the Stacks chain. And since no forks are allowed, even if a malicious miner was able to control the Stacks block production, they would not be able to create their own fork.


・Stackerがそれらのブロックを検証し、問題がなければチェーンに追加されます。
・Stacksチェーンの改ざんをしようとする場合、ビットコインのチェーン自体も攻撃する必要がある。また、フォークが許されないため、攻撃者がマイナーを乗っ取っても独自のチェーンを作ることはできない仕様になっている

じんじん

🔸 Stacks as a Bitcoin L2

These two properties bring us to a conceptual point that needs to be made: How does Stacks work as a Bitcoin L2?

A Layer 2 is designed to bring scalability and functionality to a Layer 1 blockchain, Bitcoin in this case. This is especially important in the world of Bitcoin because L2s need to have both scalability and functionality improvements. In the Ethereum world, the primary use case is scalability because the L1 has the same computing power as the L2.

Stacks aims to improve both scalability and functionality with Bitcoin, and it does this through a combination of the properties of the chain like fast blocks and Bitcoin finality so we can inherit the security of the L1, in addition to sBTC, the trust-minimized bridge so we can use our BTC on Stacks.

There is a lot of nuance and conversation around the definition of L2s, especially Bitcoin L2s as many new projects pop up to capitalize on the hype. In my view, L2 is best used as a general term to describe a separate system that relies on the base layer to improve scalability or functionality.

There will be many different approaches to accomplishing that goal and a spectrum of solutions ranging from useless to ideal. Builders will build and the market will decide what the best solution is.


・そもそもL2はbitcoinとethereumで言われている内容が少し違う
→ bitcoinのL2は拡張性と機能性の両者の向上
→ ethereumのスケーラビリティの向上
・「高速なブロック生成(Fast blocks)」と「ビットコインによる最終確定性(Bitcoin finality)」という特性を組み合わせる

sBTCというtrust-minimized bridgeをすることで、Stacks上でBTCを使用することを可能としている

じんじん

Day 2: Introduction to sBTC

Welcome to Day 2! Today we’re going to talk about sBTC, the trust-minimized BTC bridge on Stacks.

We’ll cover:

  • What sBTC is
  • What the development timeline looks like
  • How you can begin experimenting with it today

Let’s dive in.

じんじん

🔸 What is sBTC?

sBTC is the upcoming trust-minimized two-way bridge between the Bitcoin and Stacks layers.

That’s a mouthful, let’s unpack it.

Remember that the entire point of an L2 is to increase scalability and functionality of the L1. That means we need a way to use the L1 asset (BTC) on the L2 (Stacks). And we want to do that in a way that is as decentralized as possible, with the potential for further decentralization over time.

sBTC exists to accomplish this goal.

There is a lot that goes into how sBTC works, and it is still under development (you can learn more about the details on the sBTC site), but we can cover the basics here.

It’s easy to create a centralized or custodial bridge mechanism. You just have a select entity or group of entities that are in charge of moving the asset back and forth. They control the asset.

For example, in the case of wBTC on Ethereum, BitGo is the custodian that controls the flow of the BTC.

When someone wants to convert their BTC into wBTC on Ethereum, they deposit it into a wallet controlled by BitGo, and then BitGo will mint the corresponding amount of wBTC on Ethereum.

The process is reversed for withdrawals, where a user will burn wBTC on the Ethereum side, and then BitGo will transfer the corresponding amount to their wallet in BTC.

sBTC operates in much the same way with one key difference: the bridge wallet is controlled by a decentralized, open-network, economically incentivized group of signers.

These signers are in charge of verifying the legitimacy of sBTC deposit and withdrawal transactions and they are economically incentivized to do so through the PoX mechanism outlined in the previous lesson.

If they fail to fulfill their duty as signers, they don’t get their PoX reward distribution and cannot access their locked STX tokens.

Again, there are a lot of details involved in how this all works at a technical level, so be sure to check out the sBTC.tech. But these are the basics of how it works.

🔸 How sBTC is being developed

It is very important that sBTC be developed intentionally, balancing decentralization with a viable path to growth and adoption. With this in mind, sBTC is being developed in two phases: Bootstrap and Signer Rotation.

Bootstrap

In this phase, an initial group of Signers selected through an open community governance process will be responsible for Signing sBTC transactions on the network. The initial group of Signers will be unchanged throughout the Bootstrap phase of the release schedule. During this phase, sBTC will have a distinct signer set (known as the “sBTC Bootstrap Signer”). And sBTC will not explicitly be integrated into the Stacks Proof of Transfer consensus. As a result, this release can activate without a hard fork.

Signer Rotation

In this phase the full design of the sBTC system with an open and decentralized Signer set is reached, increasing decentralization after the system is further tested in the bootstrap phase. At this point, sBTC is integrated into the Proof of Transfer consensus and Signers receive rewards for fulfilling sBTC operations. This release does require a hard fork.

The full SIP (Stacks Improvement Proposal) for sBTC is currently in the works. Once it is out, you can read that to get the full details on exactly how sBTC works.

Until then, you have enough knowledge to understand what it is and why it is needed. Now let’s talk about how you can begin experimenting with a mock version of sBTC immediately.

🔸 How to start experimenting with sBTC

sBTC will be released in phases later in 2024, but we can start experimenting with it now thanks to some nice design features. To understand what those are, let’s look at a couple of concepts you should be familiar with in the Stacks and Clarity world.

SIPs and Tokens

SIP stands for Stacks Improvement Proposal, and can be though of as similar to EIPs. In Clarity, tokens are defined according to SIP-009 and SIP-010 standards using built-in functions. You can learn more about SIPs in the docs and more about how Clarity handles tokens in the Clarity book.

sBTC will have its own SIP, the sBTC itself will be implemented as a standard SIP-010 token, meaning developers can interact with it using the standard fungible token functions in Clarity.

We’ll be covering this in a lot more detail tomorrow, what’s important now is just understanding the concept.

It means that we can create a basic SIP-010 token contract and interact with it in exactly the same way we will interact with the fully decentralized sBTC when it is released.

And it just so happens that I have created a starter repo for you to do exactly that, which you can find on GitHub.

In the next lesson, we’ll look at how we can build a simple borrowing and lending app using sBTC using that starter repo and the Hiro Platform.

If you want to get a head start, be sure to take a look at the README so you can see how the sBTC contract works and how we are making a couple of simple modifications to make it usable in mock form.

🔸 Further Learning

In case you want to dig deeper into Clarity and sBTC before we dig in tomorrow, here are a few places you can check out to learn more.

Tomorrow, we’ll begin writing your first smart contract using this sBTC starter that we covered today!

See you then,
Kenny

じんじん

memo on X
https://x.com/jin_vdf_xyz/status/1847526227894321174

Day 2: Introduction to sBTC

本文:
https://zenn.dev/link/comments/43c9102de317f0

agenda:
・What sBTC is
・What the development timeline looks like
・How you can begin experimenting with it today

🔸 What is sBTC?

sBTCはBitcoinとStacksの間で「トラストミニマム」な双方向のブリッジを採用したもの。

トラストミニマムとは、レイヤー1のイーサリアムブロックチェーン側に信頼があるネットワークのこと
https://neweconomy.jp/posts/113665 より

L1の資産(BTC)をL2(Stacks)で使う方法が必要になる。このL1の資産をL2で使用すると言ってもなるべく非中央集権的に実現したい。

例として、
・BitGo(カストディアン)によるwBTCへの変換
・PoXのアルゴリズムによってブリッジウォレットとしてsBTCに変換するものの比較
・ブリッジウォレットにより分散型、パブリックであることを強調したい。
・経済的なインセンティブとして、署名者がトランザクションの検証を行い、PoX報酬を受けられるようになっている。
→ ただし、これができなかった場合には、報酬がもらえない、ロックが解除できないなどの罰則が与えられる。

🔸 How sBTC is being developed

ポイント
・非中央集権的であること
・拡大(成長)と普及(採用)するために実行可能的であり、バランスが取れていること
・基本的には2フェーズで開発されていること
→ BootstrapとSigner Rotation

Bootstrap

・オープンなコミュニティガバナンスプロセスで選ばれた初期の署名者グループが、ネットワーク上でsBTCトランザクションの署名を担当
・この初期の署名者グループは、Bootstrapフェーズの間は変更されない
・このフェーズでは、sBTC専用の署名者セット(「sBTC Bootstrap Signer」)が存在
・sBTCはこのフェーズでは、StacksのPoXには統合されない。
・そのため、このリリースはハードフォークを行わずに有効化可能。

SignerRotation

・Signer Rotationフェーズでは、オープンで分散型の署名者セットを使用するsBTCシステムの完全な設計が実現され、Bootstrapフェーズでのさらなるテストを経て、分散化が強化される。
・この段階で、sBTCはPoXに統合され、署名者はsBTCの運用に対して報酬を受け取る。
・このリリースはハードフォークが必要。
・現在、sBTCに関するSIPが作成されている段階で、リリース後にsBTCの詳細な仕組みを確認できる予定。

🔸 How to start experimenting with sBTC

StacksとClarity(Stacksのスマコンの言語)の大枠な概念の紹介

SIPとトークン:
・SIP: Stacks Improvement Proposalの略
・Clarityではトークンは組み込み関数を使用してSIP-009およびSIP-010標準に従って定義
・sBTCは独自のSIPを持ち、sBTC自体は標準的なSIP-010トークンとして実装https://github.com/stacksgov/sips/blob/main/sips/sip-009/sip-009-nft-standard.md
https://github.com/stacksgov/sips/tree/main/sips/sip-010

じんじん

Day 3: Your first Clarity contract

Welcome back Stacks builder!
Yesterday we went over sBTC and mentioned that we can start experimenting with it today.
Today we’re going to get an introduction to Clarity and the Hiro Platform and build a very basic borrowing and lending protocol using sBTC.

We’ll cover:

  • The Hiro Platform
  • Clarity Basics
  • Building a simple borrowing and lending contract

Let’s dive in.

🔸 Clarity Basics

Clarity is the smart contract language that Stacks uses. It’s likely quite a bit different than other languages you might be used to like Solidity or JavaScript.

Clarity has been built from the ground up to build several security features right into the language, making it easier for developers to write secure smart contracts.

Rather than retyping it all here, it would be best for you to take a look at the Clarity documentation outlining how it is unique and dig into the crash course to get the basics.

In short, Clarity:

  • Is interpreted rather than compiled
  • Does not permit reentrancy
  • Has built-in underflow and overflow guards
  • Has support for custom tokens built-in
  • Requires returned responses to be checked
  • Is decidable

One of the biggest differences is that Clarity is decidable. From the Clarity book:

A decidable language has the property that from the code itself, you can know with certainty what the program will do. This avoids issues like the halting problem. With Clarity you know for sure that given any input, the program will halt in a finite number of steps. In simple terms: it is guaranteed that program execution will end. Decidability also allows for complete static analysis of the call graph so you get an accurate picture of the exact cost before execution. There is no way for a Clarity call to "run out of gas" in the middle of the call.

If you want to dive deeper into decidability, one of Clarity’s more interesting and controversial properties, there is a docs page dedicated to that topic.

🔸 Writing our Contract with the Hiro Platform

Now that you understand the basics of Clarity, let’s build something!

There’s a lot to cover here, so it’s best done in video format. Here’s a video walking you through getting set up on the Hiro Platform and writing our contract.

This project uses the example contract from the sbtc-starter. We’ll go over this repo in the video, but you’ll likely want to reference the repo during the video or in the future.

https://www.youtube.com/watch?v=-JFZ60UGODY

Alright, you now have your first contract under your belt.

Tomorrow, we’re going to get your local development environment set up and take a look at all the tools you’ll use in your workflow as a Stacks developer.

See you then!


movie: Building a Basic Borrowing and Lending Clarity Contract

じんじん

Day 4: Your Stacks development environment

Hello again Stacks builder,Today we’re going to get your machine set up for Stacks development.

Along the way, you’ll be introduced to all of the developer tools you should be familiar with.

Let’s get into it, this one will be a bit long if you go through and explore all the tools, but you’ll finish with a solid understanding of exactly what you need to be a successful Stacks developer.

🔸 The Essentials

As a Stacks developer, there are several tools you’ll need to be familiar with regardless of what project you are working on.

I highly recommend following along in this section and briefly exploring each tool before moving on. That will give you the best foundation for becoming a skilled developer.

Clarinet

The first, and one of the most essential tools you’ll need to familiarize yourself with is Clarinet. If you’ve ever built anything on Ethereum, you can compare Clarinet to Hardhat or Foundry. It’s a local development suite that allows you to spin up a local devnet, run test suites, deploy contracts, and more.

Clarinet Docs and Guides

Stacks.js

Stacks.js is the primary JavaScript library you’ll use for interacting with both the Stacks chain itself and contracts from your JS apps. This is the tool to familiarize yourself with when building frontend applications that utilize Stacks and Clarity.

Stacks.js Docs and Guides

Stacks API

The Stacks API (maintained by Hiro) is a key tool that you can use to get various data from the Stacks chain. While many of the endpoints are built into stacks.js as functions, you’ll still want to familiarize yourself with the endpoints available to you.

Stacks API Reference

Block Explorer

The block explorer is a key resource you’ll use to get data on your contracts and transactions. You can use the explorer on mainnet, testnet, and your local devnet. It has several useful features including transaction analysis and status, a sandbox environment for you to write and deploy contracts, and a testnet faucet.

Stacks Explorer

Wallet

You have a few options available to you when it comes to wallets. The main 3 are Leather, Xverse, and Asigna. Stacks.js has functions built-in (via the connect package) to allow you to utilize these wallets. Each wallet also has its own API for performing certain actions. It’s worth taking a look through the docs of each wallet to see which suits your needs the best.

🔸 Other Useful Tools

Chainhook

When building Stacks apps, you may want to trigger certain actions based on on-chain events on both Bitcoin and Stacks. Chainhook allows you to do just that.
Chainhook Docs

Token Metadata API

Hiro’s Token Metadata API is a service that offers a REST API, so you can easily pull any data you need for any token on Stacks that follows SIP 016 standards.
Token Metadata API Docs

Ordinals API

Hiro’s Ordinals API provides you with fast, reliable data for Bitcoin ordinals and BRC-20 tokens via an easy-to-use REST interface.
Ordinals API Docs

Ordhook

Ordhook enables you to build ordinals event streams, so you can create accurate, lightweight databases that gracefully handle Bitcoin forks and reorgs.
Ordhook Docs

Clarity-Bitcoin Library

The Clarity-Bitcoin library is a Clarity smart contract that provides several utility functions to make it easier to read and parse Bitcoin transactions from your Clarity contracts. If you want to verify that a particular Bitcoin transaction occured before taking an action in Clarity, this library will be instrumental.We use this library in the Bitcoin Primer and it is also used in the sBTC implementation.
View Clarity-Bitcoin library on GitHub

🔸 Bitcoin Specific Tools

Bitscript

Bitscript is an excellent web-based tool to help you learn, parse, and create Bitcoin transactions. It’s an excellent tool for learning to work with Bitcoin transactions and Bitcoin Script, which can be daunting to newcomers.

Learn Me A Bitcoin

Learn Me A Bitcoin is an excellent resource for understanding the technical details behind Bitcoin, especially how the cryptography and transactions work. It also comes with some interactive tools for understanding how they work.

Mempool

Mempool is a popular block explorer for Bitcoin that allows you to explore transaction data.

bitcoin-js

bitcoinjs-lib is a JavaScript library for working with Bitcoin transactions. This will come in handy if you need to construct Bitcoin transactions for users to initiate via a web wallet.

🔸 Action Step

Before moving on, it would be a good idea to get Clarinet installed on your machine and read through some of the docs to get yourself introduced to these tools.

The goal here isn’t to know everything there is to know, it’s to familiarize yourself with the tools so that when the time comes when you encounter and task or problem, you’ll have some context to know what to search for.

Tomorrow, we’ll be diving into one of the most exciting parts of the course: building your own project.

We’ll cover how to decide what to build, how to get started, and where to get support along the way.

じんじん

Day 4: Stacks開発環境

この日は、Stacks開発のためにマシンをセットアップし、Stacksブロックチェーンで構築するための主要なツールを紹介します。これらのツールに慣れることで、Stacks開発者としての確かな基盤を築くことを目指します。

必須ツール:

Clarinet: Stacksのローカル開発スイートで、EthereumのHardhatに似ています。ローカル開発ネットワークを設定し、テストを実行し、コントラクトをデプロイするためのツールです。
Stacks.js: Stacksチェーンやコントラクトとやり取りするためのJavaScriptライブラリで、Stacksを利用したフロントエンド開発に必須です。
Stacks API: Hiroが提供するStacksチェーンからデータを取得するためのツールです。様々なエンドポイントが用意されています。
ブロックエクスプローラー: コントラクトやトランザクションの追跡ツールで、メインネット、テストネット、ローカルデブネットで利用可能です。テストネットのファーセットやコントラクトのデプロイ用のサンドボックスも備えています。
ウォレット: Stacksでは、Leather、Xverse、Asignaなどのウォレットをサポートしており、Stacks.jsと連携して重要な操作を実行できます。
その他の便利なツール:

Chainhook: BitcoinやStacksのオンチェーンイベントに基づいてアクションをトリガーします。
トークンメタデータAPI: Stacksチェーン上のトークンに関するメタデータを取得するためのAPIです。
Ordinals API & Ordhook: Bitcoinのオーディナルやイベントストリームを処理するためのツールです。
Clarity-Bitcoinライブラリ: ClarityコントラクトでBitcoinトランザクションを確認するためのライブラリです。
Bitcoin関連ツール:

Bitscript: Bitcoinトランザクションの作成や解析を行うためのウェブツールです。
Learn Me A Bitcoin: Bitcoinの暗号技術やトランザクションの技術的な詳細を理解するための教育リソースです。
Mempool: 人気のあるBitcoinブロックエクスプローラーです。
bitcoin-js: JavaScriptでBitcoinトランザクションを構築するためのライブラリです。
アクションステップ:
Clarinetをインストールし、ドキュメントを確認してStacks開発環境に慣れ始めましょう。

じんじん

Day 5: Your own Stacks project

Alright Stacks builder, it’s time to get started building your own project!

It’s one thing to dig into tutorials and content, and that’s a necessary first step, but the real magic happens when you begin to work on your own product, and that’s what we want to help you do.

This is the final lesson in the Stacks Primer course, and it’s the most important. Getting started building your own project is how you’ll ultimately learn the most, get plugged in to the ecosystem, and begin to build out a successful career as a Stacks developer helping to create the Bitcoin economy.

While we won’t be diving into anything technical in this lesson, the soft skills and ecosystem familiarity you’ll learn here is going to be indispensable in your journey to becoming a professional Stacks developer.

Let’s get started!

🔸 How to Be a Successful Developer

Broadly, there are two groups of developers: those who want to be technical founders and those who just want to get paid to code, whether as a full-time employee, contractor, freelancer, etc.
I am going to make the argument here that the getting-started process looks the same for those two groups, and it can be broken down into 3 steps.

1️⃣ Learn the basics
2️⃣ Figure out something valuable to work on
3️⃣ Work on it in public

Those 3 basic things are how almost every single successful developer I know has gotten started in the Bitcoin/Stacks ecosystem.

Let’s go through these steps.

🔸 Learning the Basics

This one is easy. By going through Stacks Primer you have everything you need to learn the basics.

If you’ve followed along up until now, you have the foundation you need to make the jump to building your own project, which I would encourage you to do immediately.

The next thing to figure out is what to work on. You may already have an idea, but if not, that’s okay too.

🔸 Figure Out Something Valuable to Work On

There are a few different routes you can take to figure out what to build. Everyone has their own things that they are excited about, but I would lean into something that overlaps between three different things:

  • Something you genuinely care about
  • Has a market gap
  • Is feasible to build

Let’s dig into these, and explore a concept called the “Idea Maze” to help guide you down the path of discovering your idea.

If you already have an idea, you can check it against these guidelines. If you don’t have one, hopefully they will help you come up with one.

Also, keep in mind these are just guidelines. Often our intuition can be a great guide, so if you have an idea you are extremely driven to build and genuinely believe needs to exist, start building it. You can always iterate later based on feedback.

On that last point, I want to emphasize something else.

It is far better to start now and iterate as you go than to delay yourself because you are trying to find the perfect idea.

The perfect idea doesn’t exist, and you will learn far more from starting to build and iterate based on real-world feedback than from getting yourself stuck in tutorial/ideation hell.

🔸 The Importance of Drive and Passion

Following your passion is an overhyped catchphrase and, in general, not good advice for crafting a successful career. That being said, I do think it’s very important to make sure that you care about your work and the thing you are building.

For example, just because you identify a market gap for a DeFi protocol, doesn’t mean you should build a DeFi protocol if you have no interest in DeFi. Passion shouldn’t be a primary driver for what you build, but you should check to make sure you care about something before you go off and try to build something.

This applies to developers who want to be founders and others who are simply interested in being developers. Working in public is the best way to build a successful career (we’ll talk more about this below), and consistency is key here.

To maintain that consistency, you need to care about what you are building while balancing it with the need to make sure you are building something that people actually value.

🔸 Identifying Market Gaps

As you begin learning and researching, take note of gaps that you find in both the user and developer experience in the Stacks ecosystem.

Is there a developer tool that would make your life easier? Were you expecting to find a certain resource and didn’t find it? Looking for a particular DeFi protocol or primitive that you found doesn’t exist yet?

These are all excellent starting points to discover what idea you should build. Often, scratching your own itch is the best way to get started.

Do some research in other ecosystems, in the Bitcoin space, and in traditional finance to see what applications have been proven out and how you could make them better by building them on Bitcoin.

What things can’t exist in other ecoystems that can only be built on Stacks?

From more of a practical angle, what tools can Bitcoin/Stacks do better than anything else? One of my favorite ways to brainstorm use cases and ideas is to read books and listen to podcasts that discuss the use cases of Bitcoin from a philosophical angle, and then begin to brainstorm how to build a technical solution to that problem.

Here’s a collection of books and a podcast to get you started.

What daily things could be improved by building on a decentralized platform that uses Bitcoin as the money?

🔸 Feasibility, Pivots, and the Idea Maze

A few final points to keep in mind when figuring out what you are going to build:

Make sure that what you are building is technically feasible and that you can build. You can get a decent idea of this from research, but after a bit of research, you’ll need to just start building and approach challenges as they come.

When they do pop up, you may find yourself thinking “I can’t build my thing without this other thing.” If that other thing doesn’t exist, that may be a great opportunity to build something valuable. This process is called the idea maze, and it’s important to pay attention to it.

In early ecosystems like Stacks, you’ll often find that some intermediary tools or resources are missing. These are usually great places to look at opportunities to build.

You’ll need to exercise some discipline and find the balance between intelligent pivots and shiny object syndrome. You don’t want to be bouncing from idea to idea, but sometimes pivots make sense. Use your best judgment here and be honest with yourself.

🔸 Working in Public

My number one piece of advice for developers looking to build a career is to learn in public. That applies to the Stacks ecosystem as well.

Once you have your idea and have started building, start talking about it. Get active on X and in Discord. You don’t need/want to be overly promotional or spammy at all, just share what you are building.

Write about the process of adding a new feature. Ask for feedback on Twitter. Make a video walking people through what your tool does. Be active in the community and help other people out when you can. Ask questions about what you are working on.

This applies both if you want to become a founder or just work as a developer. The best way to grow your project (and your career) is to work in public and share your knowledge and tools.

We don’t need to overcomplicate this.

1️⃣ Build cool things
2️⃣ Tell people about them

What daily things could be improved by building on a decentralized platform that uses Bitcoin as the money?

🔸 How to Get Paid

Building in public is the best way to build your career, but it takes time. Let’s be honest, if you want to build a career you’ll need to figure out how to get paid eventually. There are a lot of different ways to do this depending on the route you want to take.

As you build, people in the community will begin to notice you and opportunities for work will present themselves.

Outside of that organic process, be sure to keep an eye out for hackathons and competitions held in the ecosystem. These are excellent ways to get your project off the ground and earn a bit of money for it. Many successful founders and developers got started via their hackathon project.

But again, consistency is key, and being consistent can be difficult. So, we started up a program called Code for STX where you can earn STX for doing nothing but making consistent progress on your project.

It works like this:

1️⃣ First, come up with an idea and get a basic GitHub repo up with the bare bones of the project.
2️⃣ Next, visit the Code for STX page to get an idea of how the program works and where to submit your code. Submit PRs showing your progress and have a chance to win up to 2,500 STX every single month.

That’s it.

I can’t emphasize enough the importance of making consistent progress. The Code for STX program was designed to provide some encouragement and a reward for maintaining that consistency.

Join Code4STX

🔸 How to Get Help

Building your project from scratch is hard, but you aren’t on your own. There are several ways you can get assistance in the process of building out your project.

Docs

The first place you should check are the docs. There are two primary sources to check: the Stacks Docs and the Hiro Docs, depending on what you are looking for. Both have search functionality built-in and contain lots of content, references, and tutorials.

Discord

This is the easiest option and usually the best place to start if you can’t find what you are looking for in the docs. The Stacks Discord is very active and there is usually someone who is able to answer your question or at least point you in the right direction.

Office Hours

Sometimes you need a little more one-on-one help or you don’t get the answer you are looking for in Discord. In that case, I run weekly office hours every Thursday at 11 AM EST. Those are held in the #call channel in the Discord and you can find it listed in the Discord events.

Clarity Collective

Finally, the Clarity Collective is an exclusive, invite-only group of developers who have proven that they are capable and dedicated to building apps in the Stacks ecosystem. Entry is free but the bar is high so we can keep it tight-knit and high-value for devs who are serious about building the Bitcoin economy. I’ll talk more about this in a follow-up email in a couple of days.

🔸 That's it, but that's not all

Alright, that wraps up Stacks Primer!

You now have everything you need to get started building the next great Stacks project. The only thing left to do is execute.

Remember that you aren’t alone. There’s an entire community of people ready and willing to help you get your project off the ground and build your career.

See you out there!

Kenny

P.S. Keep an eye out on your inbox, I’ve got a couple of other follow-up emails coming with some good content, and we’ll use this email to keep you updated on things like new events, hackathons, tutorials, etc.

じんじん

Day 5: 自分のStacksプロジェクト

いよいよ自分のプロジェクトを始める時が来ました!チュートリアルを学ぶのは重要ですが、本当の学びは自分のプロジェクトに取り組むことで得られます。これが、Stacks Primerコースの最後であり最も重要なレッスンです。

成功する開発者になる方法:
開発者には、大きく分けて2つのグループがあります。技術的な創業者になりたい人と、単に開発者として働きたい人です。どちらの場合も、次の3つのステップが重要です。

1️⃣ 基礎を学ぶ
2️⃣ 価値あるテーマを見つける
3️⃣ 公に取り組む

基礎を学ぶ:
Stacks Primerを通じて、すでに基本的な知識は得られました。次は、自分のプロジェクトを始めることです。

価値あるテーマを見つける:
何を作るかを決めるためには、次の3つの要素が重なる部分を探します。

  • 自分が本当に興味を持っていること
  • 市場にギャップがあること
  • 技術的に実現可能であること

完璧なアイデアを探すことよりも、早く始めてフィードバックを元に改善する方が重要です。

情熱とドライブの重要性:
成功するためには、作っているものに興味を持ち、価値のあるものを作り続けることが大切です。情熱が全てではありませんが、少なくとも自分の作るものに関心を持つべきです。

市場ギャップの発見:
Stacksエコシステムで欠けているものや、他のエコシステムにはないStacks特有のアプリケーションを探してみてください。

実現可能性とアイデアの迷路:
技術的に実現可能なものであるかを確認し、必要に応じてピボット(方向転換)も考慮しましょう。

公に取り組むことの重要性:
アイデアが決まったら、それを公に話し始めましょう。X(旧Twitter)やDiscordで活動し、開発の進捗やフィードバックを共有することがキャリアアップに繋がります。

報酬を得る方法:
一貫した進捗を続けることが成功への鍵です。Stacksエコシステムでは、Code for STXプログラムで継続的な進捗に報酬を与えています。GitHubにプロジェクトをアップし、PRを提出してSTXを獲得しましょう。

サポートを得る方法:

  • ドキュメント: Stacks DocsやHiro Docsで参照可能です。
  • Discord: アクティブなStacksコミュニティで質問や議論ができます。
  • オフィスアワー: 毎週木曜日に開かれるオフィスアワーで直接相談が可能です。
  • Clarity Collective: 優れたStacks開発者が集まる、招待制のグループです。

まとめ:
Stacks Primerを通して、次のStacksプロジェクトを始めるための準備は整いました。あとは実行するのみです!