# eth_getTransactionBySenderAndNonce

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://base-mainnet.g.alchemy.com/v2/{apiKey}

Returns the hash of the transaction sent by the given sender address at the specified nonce, or null if no such transaction exists. Originally introduced by the Otterscan project (as `ots_getTransactionBySenderAndNonce`) and now exposed under the standard `eth_` namespace. Requires an archive-capable backend because the lookup walks historical account state.

Reference: https://www.alchemy.com/docs/chains/base/base-api-endpoints/eth-get-transaction-by-sender-and-nonce

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Sender | string | Yes | The address of the sender (externally owned account) that submitted the transaction. |
| Nonce | string | Yes | The nonce of the transaction to look up, as a hexadecimal string. |

## Result

**Transaction hash** (null or string): The hash of the transaction sent by the given sender at the given nonce, or null if no such transaction exists.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionBySenderAndNonce",
  "params": [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "0x3"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": "0x021304206b2517c3f8f2df07014a55b79aac2ae097488fa807cc88eccd851a50",
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://base-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionBySenderAndNonce",
  "params": [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "0x3"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_getTransactionBySenderAndNonce',
    params: ['0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', '0x3']
  })
};

fetch('https://base-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://base-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getTransactionBySenderAndNonce",
    "params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "0x3"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://base-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getTransactionBySenderAndNonce\",\n  \"params\": [\n    \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n    \"0x3\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://base-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getTransactionBySenderAndNonce\",\n  \"params\": [\n    \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n    \"0x3\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://base-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getTransactionBySenderAndNonce\",\n  \"params\": [\n    \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n    \"0x3\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: eth_getTransactionBySenderAndNonce
description: Returns the hash of the transaction sent by the given sender address at the specified nonce, or null if no such transaction exists. Originally introduced by the Otterscan project (as `ots_getTransactionBySenderAndNonce`) and now exposed under the standard `eth_` namespace. Requires an archive-capable backend because the lookup walks historical account state.
x-compute-units: 20
params:
  - name: Sender
    required: true
    description: The address of the sender (externally owned account) that submitted the transaction.
    schema:
      title: hex encoded address
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
  - name: Nonce
    required: true
    description: The nonce of the transaction to look up, as a hexadecimal string.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
result:
  name: Transaction hash
  description: The hash of the transaction sent by the given sender at the given nonce, or null if no such transaction exists.
  schema:
    oneOf:
      - title: Not Found (null)
        type: 'null'
      - title: Transaction hash
        type: string
        pattern: ^0x[0-9a-f]{64}$
examples:
  - name: eth_getTransactionBySenderAndNonce example
    params:
      - name: Sender
        value: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
      - name: Nonce
        value: '0x3'
    result:
      name: Transaction hash
      value: '0x021304206b2517c3f8f2df07014a55b79aac2ae097488fa807cc88eccd851a50'
```
