# radFi Actions Flowchart

<figure><img src="https://4165095370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F69y8oAuD6aRRH0cGb8K7%2Fuploads%2FFRPN6thR4e8cfz74LQKp%2Fflow.png?alt=media&#x26;token=3eb8c1ce-7bcf-4d76-a37f-1c18330109ab" alt=""><figcaption></figcaption></figure>

### **Key Components**

**Frontend (FE)**&#x20;

* User interface for sending actions and signing transactions.

**RadFi Backend (BE)**&#x20;

* Processes requests, generates PSBTs, and handles transaction broadcasting.

**Pending State Contract**

* Temporary contract validating transactions before final submission.

**Sequencer**

* Ensures transaction validity before sending it to the Main State Contract.

**Main State Contract**

* Stores finalized transactions after validation.

**Bitcoin Chain**

* Bitcoin mainnet where transactions are permanently recorded on-chain.

**Database (DB)**

* Stores transaction-related data for tracking and verification.

### **Flow Overview**

**1. Fetch Pool and Ratio Data**

* The FE retrieves pool and ratio data from the user.

**2. User Action Request**

* The user initiates an action via the FE, which sends a request to the RadFi BE.

**3. Generate PSBT (Partially Signed Bitcoin Transaction)**

* The BE creates a PSBT and sends it back to the FE for user signing.

**4. User Signs PSBT**

* The user signs the PSBT and returns it to the BE.

**5. Broadcast Signed Transaction to Pending State Contract**

* The BE broadcasts the signed transaction to the Pending State Contract.

**6. Transaction Validation**

* The Pending State Contract processes the transaction and returns a success/failure status.

**7. Notify Frontend**

* The BE relays the transaction success/failure result back to the FE.

**8. Sequencer Processing**

* If the transaction is successful, the BE sends the signed transaction to the Sequencer for final verification.

**9. Broadcast Final Transaction to Main State Contract**

* The Validator broadcasts the final transaction to the Main State Contract.

**10. Transaction Finalization on Bitcoin Mainnet**

* The Validator broadcasts the fully signed transaction to Bitcoin mainnet, completing the process.
