# How Does It Work?

## What is LN Assets Daemon (LAD)?

The LN Assets Daemon (LAD) is a backend process that implements the Lnfi for issuing assets on the Nostr protocol.

It serves as a wrapper for Taproot Assets (formerly known as Taro) and Lightning Network, allowing users to effectively manage their assets on Bitcoin (BTC), the Lightning Network, and Taproot using their Nostr accounts.

### **Features**

1. Import Taproot Assets & Satoshi\
   \&#xNAN;*(\*support for other tokens to be added in the future)*
2. Mint Taproot Assets
3. Send and receive Taproot Assets
4. Provide separate accounts for end users
5. Work on both Self-Custodial and Custodial mode

<div data-full-width="false"><figure><img src="/files/tsM4UTRrgYgQ72UPFOZE" alt=""><figcaption></figcaption></figure></div>

***

## Scenarios

### 1. Depositing Taproot Assets to Lnfi

{% hint style="info" %}
**Alice deposits assets from Taproot Assets Daemon (TAPD)**

**to LN Assets Daemon (LAD)**
{% endhint %}

**Step 1**\ <mark style="background-color:orange;">Alice sends a private message to LAD's Nostr address with the content "receive 100 USDT".</mark>

**Step 2**\ <mark style="background-color:green;">NAD requests its TAPD to generate a "new address" to receive the 100 USDT.</mark>

**Step 3**\ <mark style="background-color:purple;">Alice sends the asset to the "new address" on Other-TAPD.</mark>

<div data-full-width="false"><figure><img src="/files/RFukYonkhkxaFGwWpAWg" alt=""><figcaption></figcaption></figure></div>

***

### 2. Withdrawing Taproot Assets

{% hint style="info" %}
**Alice withdraws assets from LN Assets Daemon**
{% endhint %}

**Step 1**\ <mark style="background-color:orange;">Alice generates a "new address" on Other-TAPD to receive the assets.</mark>

**Step 2**\ <mark style="background-color:green;">Alice sends a private message to LAD's Nostr address with the content: "send to address (new address)".</mark>

**Step 3**\ <mark style="background-color:purple;">LAD requests the TAPD to send the asset to the provided address.</mark>

<div data-full-width="false"><figure><img src="/files/WVkPULhdxE0XteNmaUxA" alt=""><figcaption></figcaption></figure></div>

***

### 3. Transferring Assets within the same LN Assets Daemon (LAD)

{% hint style="info" %}
Alice sends assets to Bob, who is on the same LN Assets Daemon (LAD) as Alice.
{% endhint %}

**Step 1**\ <mark style="background-color:orange;">Alice sends a private Nostr message to the LAD Nostr address with the content: "send 100 USDT to (Bob's Nostr address)".</mark>

**Step 2**\ <mark style="background-color:green;">The LAD adjusts the balances of both Alice and Bob accordingly.</mark>

<div data-full-width="false"><figure><img src="/files/cA9ovAKiAU3lVz3J71TK" alt=""><figcaption></figcaption></figure></div>

***

### 4. Transferring Assets Between Different Nostr Addresses

{% hint style="info" %}
Alice sends assets to Bob, who is on a different LN Assets Daemon (LAD) from Alice.
{% endhint %}

Similar to withdrawing assets, a "new address" is created on another LAD for Alice to transfer her assets to.

**Step 1**\ <mark style="background-color:orange;">Bob sends a private Nostr message to the LAD he is on (LAD2), with the content:</mark> *<mark style="background-color:orange;">"receive 100 USDT"</mark>*<mark style="background-color:orange;">.</mark>

**Step 2**\ <mark style="background-color:green;">Bob's NAD requests his Taproot Assets Daemon (TAPD2) to generate a</mark> *<mark style="background-color:green;">"new address"</mark>* <mark style="background-color:green;">to receive the 100 USDT.</mark>

**Step 3**\ <mark style="background-color:purple;">Bob shares the</mark> *<mark style="background-color:purple;">"new address"</mark>* <mark style="background-color:purple;">with Alice.</mark>

**Step 4**\ <mark style="background-color:red;">Alice sends a private Nostr message to the LAD nostr account she is on (LAD1), with the content:</mark> *<mark style="background-color:red;">"send to address (new address)"</mark>*<mark style="background-color:red;">.</mark>

**Step 5**\ <mark style="background-color:blue;">Alice's LAD requests her Taproot Assets Daemon (TAPD1) to send the asset to the provided address.</mark>

<div data-full-width="false"><figure><img src="/files/0Hj7W66PmgMvtkppXfLN" alt=""><figcaption></figcaption></figure></div>

***

## Trading Modes

LN Assets Daemon offers 2 key trading modes to accommodate users' preferences and requirements.

1. **Basic Mode**\
   This mode supports all essential operations, including transaction bundling, and facilitates Chat-to-Trade functionality. Users can execute trades at a rate of 1 Transaction per Second (TPS) in this mode. \\
2. **Professional Mode**\
   In addition to all the features available in Basic Mode, the Professional Mode includes advanced functionalities such as JSON mode and more.\
   \
   Users can experience faster trading with a speed of 20 TPS in this mode. It caters to the needs of experienced individuals seeking more comprehensive options.

***

## Nonce

{% hint style="info" %}
A nonce (which stands for "number used once") is a random or unique value that is used only once in a cryptographic communication or protocol. It is typically a large random number or a timestamp.
{% endhint %}

In the LN Assets Daemon (LAD) system, each account is assigned a transaction nonce. The nonce value increments by one for every completed transaction, serving as a counter to keep track of the number of transactions sent from a specific address. However, the handling of nonce differs between the Basic Mode and Professional Mode.

In Basic Mode, LAD takes care of managing the nonce on behalf of the users. It automatically handles the incrementing and tracking of the nonce for each transaction, simplifying the process for users who prefer a more straightforward approach.

In contrast, Professional Mode allows users to manage the nonce themselves. This mode offers greater flexibility by enabling users to label transactions and execute them in a sequential order of their choice. Users can conveniently handle the nonce value according to their preferences, streamlining transaction management within the Professional Mode of LAD.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lnfi.network/overview/technology/how-does-it-work.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
