> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Transactions

> Sign and send transactions on the Quai and Qi ledgers.

<Tabs>
  <Tab title="Quai Transactions">
    <Steps>
      <Step title="Configure Wallet">
        To send a Quai transaction, you'll first need to connect a [Wallet](/sdk/content/classes/Wallet) or [QuaiHDWallet](/sdk/content/classes/QuaiHDWallet) to a [Provider](/sdk/content/interfaces/Provider).

        ```js theme={null}
        const provider = new quais.JsonRpcProvider('https://rpc.quai.network', undefined, { usePathing: true })

        // initialize wallet
        const wallet = new quais.Wallet(privateKey, provider)

        // initialize HD wallet
        const hdWallet = quais.QuaiHDWallet.fromMnemonic(mnemonic)
        await hdWallet.connect(provider)
        ```
      </Step>

      <Step title="Build Transaction">
        Then, build the transaction you want to send using the [QuaiTransactionRequest](/sdk/content/type-aliases/TransactionRequest) type.

        ```ts theme={null}
        // get to address from wallet
        const from = wallet.getAddress()

        // get to address from HD wallet
        const addressInfo = hdWallet.getAddressNextAddress(0, quais.Zone.Cyprus1)
        const from = addressInfo.address

        // build simple transfer transaction
        const txData: QuaiTransactionRequest{
          from,
          to: "0x002F4783248e2D6FF1aa6482A8C0D7a76de3C329",
          value: quais.parseQuai("1.0"),
        }
        ```

        <Tip>
          The above transaction is a simple value transfer. Additional transaction params for more complex transactions can be found in the [QuaiTransaction](/sdk/content/classes/QuaiTransaction) class.
        </Tip>
      </Step>

      <Step title="Send and Sign Transaction">
        Finally, sign and broadcast the transaction using your wallet of choice.

        ```js theme={null}
        // send transaction with wallet
        const tx = await wallet.sendTransaction(txData)
        const txReceipt = await tx.wait()

        // send transaction with HD wallet
        const tx = await hdWallet.sendTransaction(txData)
        const txReceipt = await tx.wait()
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Qi Transactions">
    <Steps>
      <Step title="Configure Wallet">
        To send a Qi transaction, you'll first need to connect a [QiHDWallet](/sdk/content/classes/QiHDWallet) to a [Provider](/sdk/content/interfaces/Provider) and sync the UTXO set.

        ```js theme={null}
        const provider = new quais.JsonRpcProvider('https://rpc.quai.network', undefined, { usePathing: true })

        // initialize HD wallet
        const hdWallet = quais.QiHDWallet.fromMnemonic(mnemonic)

        // connect to provider and sync UTXO set
        await hdWallet.connect(provider)
        await hdWallet.scan(quais.Zone.Cyprus1)
        ```

        Syncing the UTXO set will retrieve standard and change addresses, as well as scan the specified account for addresses with unspent outputs. You'll need the wallet outpoints and addresses to build a transaction.
      </Step>

      <Step title="Build Transaction">
        Using the addresses and outpoints from the UTXO set, build the transaction you want to send using the [QiTransactionRequest](/sdk/content/type-aliases/QiTransactionRequest) type.

        ```js theme={null}
        // get from address from HD wallet
        const addressInfo = hdWallet.getAddressNextAddress(0, quais.Zone.Cyprus1)
        const from = addressInfo.address

        // get outpoints for a specified zone
        const outpoints = hdWallet.getOutpoints(quais.Zone.Cyprus1)

        // build transaction
        const txData: QiTransactionRequest = {
          txInputs: outpoints[0]
          txOutputs: { address: "0x002F4783248e2D6FF1aa6482A8C0D7a76de3C329", denomination: 7 },
        }
        ```
      </Step>

      <Step title="Send and Sign Transaction">
        Finally, sign and broadcast the transaction.

        ```js theme={null}
        // send transaction with HD wallet
        const tx = await hdWallet.sendTransaction(txData)
        const txReceipt = await tx.wait()
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>
