You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/README.md
+18-38Lines changed: 18 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,64 +33,44 @@ If you're here on this page, hopefully you've already gotten a good sense of _wh
33
33
34
34
The Stacks documentation is organized into a set of top-level sections, each aligned to a distinct stage of a developer’s journey—from learning core concepts to building applications and operating infrastructure.
35
35
36
-
<details>
37
-
38
-
<summary><strong>Learn</strong></summary>
39
-
40
-
**How does the Stacks network work?**\
41
-
The [Learn](https://app.gitbook.com/s/H74xqoobupBWwBsVMJhK/) section focuses on building a strong conceptual foundation. It explains how Stacks functions as a Bitcoin layer 2, providing clarity and context around the network’s design and mechanics.
36
+
{% tabs %}
37
+
{% tab title="Learn" %}
38
+
**How does the Stacks network **_**actually**_** work?**\
39
+
The [Learn](https://app.gitbook.com/s/H74xqoobupBWwBsVMJhK/) section focuses on building a strong academic foundation. It explains how Stacks functions as a Bitcoin layer 2, providing clarity and context around the network’s design and mechanics.
42
40
43
41
Topics include Proof of Transfer (PoX), Bitcoin finality, block production, the transaction lifecycle, and more. If you want a deep understanding of how Stacks anchors to Bitcoin and why it works the way it does, this is the best place to start.
42
+
{% endtab %}
44
43
45
-
</details>
46
-
47
-
<details>
48
-
49
-
<summary><strong>Build</strong></summary>
50
-
44
+
{% tab title="Build" %}
51
45
**How do you build on Stacks?**\
52
-
The Build section (you're on it!) is for developers—both new and experienced—who want to start writing, deploying, and interacting with Stacks applications.
46
+
This section is for experienced developers, but are new to Stacks, who are in the exploratory phase of understanding the general workflow of building apps on Stacks. These guides focus on accomplishing specific tasks—writing contracts, integrating wallets, working with sBTC or USDC—without extensive explainers.
53
47
54
48
It includes curated quick starts for smart contract development with Clarinet and frontend development with Stacks.js, along with step-by-step guides covering common use cases such as integrating sBTC, onboarding users, working with price oracles, and more.
49
+
{% endtab %}
55
50
56
-
If you’re new to building on Stacks, this section provides a practical, hands-on introduction to the ecosystem.
57
-
58
-
</details>
59
-
60
-
<details>
61
-
62
-
<summary><strong>Operate</strong></summary>
63
-
51
+
{% tab title="Operate" %}
64
52
**How do you run Stacks infrastructure?**\
65
53
The [Operate](https://app.gitbook.com/s/4cpTb2lbw0LAOuMHrvhA/) section is designed for node operators and infrastructure providers. It covers how to run and manage Stacks nodes, signers, and miners.
66
54
67
55
If you’re responsible for operating or maintaining Stacks-related infrastructure, this section contains the resources you’ll need.
56
+
{% endtab %}
68
57
69
-
</details>
70
-
71
-
<details>
72
-
73
-
<summary><strong>Reference</strong></summary>
74
-
58
+
{% tab title="Reference" %}
75
59
**Where do you look up technical details?**\
76
60
The [Reference](https://app.gitbook.com/s/GVj1Z9vMuEOMe7oH7Wnq/node-operations/readme) section contains authoritative technical documentation for Stacks devtools and APIs. This includes function and type definitions for Clarity and Stacks.js, API endpoint schemas, and interactive API playgrounds.
77
61
78
62
If you’re an experienced Stacks developer looking to quickly reference a specific method, type, or API response, this section is built for fast lookup and precision.
63
+
{% endtab %}
79
64
80
-
</details>
81
-
82
-
<details>
83
-
84
-
<summary><strong>Tutorials</strong></summary>
85
-
86
-
**Looking for a more guided, learning-first experience?**\
87
-
The [Tutorials](https://app.gitbook.com/s/skGYu79qDNfITOqDNU3s/) section is designed for readers who want structured, long-form lessons rather than quick answers.
65
+
{% tab title="Tutorials" %}
66
+
**Looking for a more guided, lesson-oriented experience?**\
67
+
The [Tutorials](https://app.gitbook.com/s/skGYu79qDNfITOqDNU3s/) section is designed for complete beginner developers who want structured, long-form lessons rather than quick answers.
88
68
89
69
These tutorials provide step-by-step walkthroughs alongside in-depth explanations of the underlying concepts. The goal isn’t just to help you complete a task, but to help you understand _why_ things work the way they do as you build.
90
70
91
-
If you’re completely new to Stacks—or prefer a classroom-style, concept-driven learning experience—this section is the best place to start.
92
-
93
-
</details>
71
+
If you’re a complete beginner and prefer a classroom-style, concept-driven learning experience—this section is the best place to start.
@@ -25,49 +25,58 @@ Current work is underway to abstract this entire flow via Circle's Bridge Kit SD
25
25
5. Approve xReserve as a spender of your USDC.
26
26
6. Execute deposit to the remote chain Stacks.
27
27
28
+
**Withdrawal**
29
+
30
+
1. Prepare contract call arguments
31
+
2. Invoke `burn` function from the `.usdcx-v1` contract
32
+
28
33
### Key Tools To Use
29
34
30
35
*[viem](https://viem.sh/) - A Typescript-first library that interfaces with Ethereum.
31
36
*[stacks.js](/broken/pages/dH5waQhE6Vb7rhcrUG7z) - A js library that helps developers build Stacks apps by handling transactions, wallet authentication, and smart contract interactions.
37
+
*[Circle Faucet](https://faucet.circle.com/) - Get testnet USDC
38
+
*[Ethereum Sepolia faucet](https://cloud.google.com/application/web3/faucet/ethereum/sepolia) - Get testnet ETH
32
39
33
40
***
34
41
35
42
## Complete Code
36
43
37
44
If you want to jump straight to the full implementation, the complete working code used in this guide is shown below.
38
45
39
-
#### Deposit
40
-
41
46
{% tabs %}
42
47
{% tab title="index.ts" %}
43
48
This script bridges USDC from Ethereum Sepolia testnet to Stacks testnet by first approving the xReserve contract to spend USDC, then calling `depositToRemote` to initiate the cross-chain transfer. It encodes the Stacks recipient address into the bytes32 format required by the Ethereum contract and submits both transactions to the Sepolia network. The Stacks attestation service will receive this event and mint the equivalent amount to the specified Stacks address.
**Limit:** Up to **50 burn intents per request** (max **10 per batch**, max **5 batches**). Submitting more than 50 intents in a single transaction request may lead to failed processing and **risk of fund loss**.
627
+
{% endhint %}
628
+
629
+
{% stepper %}
630
+
{% step %}
631
+
### Prepare contract call arguments
632
+
633
+
Before invoking the `burn` function of the `.usdcx-v1` contract, you'll need to determine the amount of USDCx to withdraw and the native recipient address that'll receive the USDC on the other chain.
634
+
635
+
An Ethereum address is technically only 20 bytes but the `native-recipient` needs to be a 32 byte buffer. Pad left the address to 32 bytes.
636
+
637
+
```typescript
638
+
let amount =4800000// in micro USDCx (6 decimals)
639
+
640
+
let functionArgs = [
641
+
Cl.uint(amount), // amount in micro USDC
642
+
Cl.uint(config.ETHEREUM_DOMAIN), // native domain for Ethereum
let result =awaitbroadcastTransaction({transaction, network: 'testnet'})
670
+
```
671
+
672
+
The Stacks network's attestation service passes the burn intent message and signature to xReserve, managed by Circle. xReserve verifies the burn and issues a withdrawal attestation to release USDC to the user’s wallet.
673
+
{% endstep %}
674
+
{% endstepper %}
675
+
676
+
***
677
+
678
+
## Additional Resources
679
+
680
+
*\[[StacksDevs Livestream](https://x.com/StacksDevs/status/2011817589782249600)] A technical breakdown by the main builder behind Stacks' USDCx
0 commit comments