# eth_submitWork

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

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

Submit a proof-of-work solution (Ethash) consisting of a nonce, the header PoW hash, and the mix digest. **Not supported on post-Merge Ethereum clients**; many nodes will return JSON-RPC error -32601 (method not found).


Reference: https://www.alchemy.com/docs/chains/pharos/pharos-api-endpoints/eth-submit-work

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| nonce | string | Yes | The 8-byte nonce found by the miner. |
| hash | string | Yes | The block header's PoW hash (32-byte). |
| digest | string | Yes | The mix digest (32-byte). |

## Result

**Submission accepted** (boolean): Returns `true` if the provided solution is valid, otherwise `false`.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_submitWork",
  "params": [
    "0x0000000000000001",
    "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000"
  ],
  "id": 1
}
```

### Response

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

## Code Examples

### cURL

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

### JavaScript

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

fetch('https://pharos-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://pharos-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_submitWork",
    "params": ["0x0000000000000001", "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000"]
}
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://pharos-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_submitWork\",\n  \"params\": [\n    \"0x0000000000000001\",\n    \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n    \"0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000\"\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://pharos-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_submitWork\",\n  \"params\": [\n    \"0x0000000000000001\",\n    \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n    \"0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://pharos-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_submitWork\",\n  \"params\": [\n    \"0x0000000000000001\",\n    \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n    \"0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: eth_submitWork
description: |
  Submit a proof-of-work solution (Ethash) consisting of a nonce, the header PoW hash, and the mix digest. **Not supported on post-Merge Ethereum clients**; many nodes will return JSON-RPC error -32601 (method not found).
params:
  - name: nonce
    required: true
    description: The 8-byte nonce found by the miner.
    schema:
      title: 8 hex encoded bytes
      type: string
      pattern: ^0x[0-9a-f]{16}$
  - name: hash
    required: true
    description: The block header's PoW hash (32-byte).
    schema:
      title: 32 byte hex value
      type: string
      pattern: ^0x[0-9a-f]{64}$
  - name: digest
    required: true
    description: The mix digest (32-byte).
    schema:
      title: 32 byte hex value
      type: string
      pattern: ^0x[0-9a-f]{64}$
result:
  name: Submission accepted
  description: Returns `true` if the provided solution is valid, otherwise `false`.
  schema:
    type: boolean
examples:
  - name: eth_submitWork — accepted
    params:
      - name: nonce
        value: '0x0000000000000001'
      - name: hash
        value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
      - name: digest
        value: '0xd1fe5700000000000000000000000000d1fe5700000000000000000000000000'
    result:
      name: Submission accepted
      value: true
```
