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

# Submitting transaction

If you are using the web3 SDK in JavaScript, signing looks like this:

```javascript theme={null}
import { PrivateKeyWallet } from "@alephium/web3-wallet";

const wallet = new PrivateKeyWallet({ privateKey: "your-private-key" });
const signature = await wallet.signRaw("503bfb16...");
```

## Step 3: Submit the signed transaction

```bash theme={null}
curl -X POST "https://rpc.ralphstudio.xyz/{your-slug}/transactions/submit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "unsignedTx": "0201010...long hex string...",
    "signature": "9e1a35b2931bd04e6780d01c36e3e5337941aa80f173cfe4f4e249c44ab135272b834c1a639db9c89d673a8a30524042b0469672ca845458a5a0cf2cad53221b"
  }'
```

```json theme={null}
{
  "txId": "503bfb16230888af4924aa8f8250d7d348b862e267d75d3147f1998050b6da69",
  "fromGroup": 0,
  "toGroup": 0
}
```

The returned `txId` matches what you got in step 1. The transaction is now in the mempool.

## Step 4: Check transaction status

Poll this endpoint until `type` is `"Confirmed"`:

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{your-slug}/transactions/status?txId=503bfb16...&fromGroup=0&toGroup=0" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**While pending:**

```json theme={null}
{
  "type": "MemPooled"
}
```

**Once confirmed:**

```json theme={null}
{
  "type": "Confirmed",
  "blockHash": "00000000ab3c...",
  "txIndex": 1,
  "chainConfirmations": 1,
  "fromGroupConfirmations": 1,
  "toGroupConfirmations": 1
}
```

**If not found:**

```json theme={null}
{
  "type": "TxNotFound"
}
```

For most use cases 1 confirmation is sufficient. For high-value transfers wait for at least **110 confirmations** (\~2 hours): this is the Alephium recommendation for exchanges and large amounts.

## Sending tokens alongside ALPH

To include a token in the transfer add a `tokens` array to the destination. Every output on Alephium must include a minimum ALPH amount (`dust`) even when the primary transfer is a token:

```bash theme={null}
curl -X POST "https://rpc.ralphstudio.xyz/{your-slug}/transactions/build" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fromPublicKey": "03a6b9c2d4e5f1...",
    "destinations": [
      {
        "address": "1AujpupFP4KWeZvqA7itsHY9cLJmx4qTzojVZrg8W9y",
        "attoAlphAmount": "1000000000000000",
        "tokens": [
          {
            "id": "b2d71c116408ae47a83c6db0571a1b2d1f58dc87ac5d7e8e4c2a3d1f9e0b8c4",
            "amount": "500000000"
          }
        ]
      }
    ]
  }'
```

`1000000000000000` attoALPH (0.001 ALPH) is the typical dust minimum. The node will reject outputs below this threshold.

## Sweep all ALPH from an address

To empty an address completely use the sweep endpoint it automatically calculates the correct amount after gas:

```bash theme={null}
curl -X POST "https://rpc.ralphstudio.xyz/{your-slug}/transactions/sweep-address/build" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fromPublicKey": "03a6b9c2d4e5f1...",
    "toAddress": "1AujpupFP4KWeZvqA7itsHY9cLJmx4qTzojVZrg8W9y"
  }'
```

```json theme={null}
{
  "unsignedTxs": [
    {
      "txId": "...",
      "unsignedTx": "..."
    }
  ]
}
```

Note that sweep returns an array of unsigned transactions if the address has many UTXOs the node may split it into multiple transactions. Sign and submit each one individually.

## Decode a transaction before signing

If you want to inspect what a transaction does before signing it:

```bash theme={null}
curl -X POST "https://rpc.ralphstudio.xyz/{your-slug}/transactions/decode-unsigned-tx" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "unsignedTx": "0201010...long hex string..."
  }'
```

```json theme={null}
{
  "unsignedTx": {
    "txId": "503bfb16...",
    "version": 1,
    "networkId": 0,
    "gasAmount": 20000,
    "gasPrice": "100000000000",
    "inputs": [...],
    "fixedOutputs": [...]
  }
}
```

Always decode and verify `fixedOutputs` matches your expectations before signing, especially when building transactions programmatically.

## Parameters reference

| Field          | Type    | Description                                             |
| -------------- | ------- | ------------------------------------------------------- |
| fromPublicKey  | string  | Hex-encoded 33-byte compressed public key of the sender |
| destinations   | array   | List of recipient objects                               |
| address        | string  | Recipient base58 address                                |
| attoAlphAmount | string  | Amount in attoALPH as a string integer                  |
| tokens         | array   | Optional list of token transfers `{ id, amount }`       |
| gasAmount      | integer | Optional: node estimates if omitted                     |
| gasPrice       | string  | Optional: node uses default if omitted                  |

## Next steps

<CardGroup cols={2}>
  <Card title="Read a contract" icon="file-code" href="/guides/reading-contracts">
    Call view functions on deployed contracts
  </Card>

  <Card title="Error handling" icon="triangle-exclamation" href="/guides/error-handling">
    Retry logic and error code reference
  </Card>
</CardGroup>
