> For the complete documentation index, see [llms.txt](https://docs.startrail.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.startrail.io/ethereum-signature-validator-api/ethereum-signature-validator-api.md).

# Ethereum Signature Validator API

Authenticates SDK users from their EOAs

### **Features**

* Provide HTTP API endpoint
* Return the result of validation with error message

### **How to use API**

* Call HTTP API endpoint with arguments set in request body

## Authenticates SDK users from their EOAs

<mark style="color:orange;">`PUT`</mark> `https://asia-northeast1-startrail-api-prod.cloudfunctions.net/ethereum-signature-validator`

This module recovers Ethereum address (EOA) from message and signature, and validates that the recovered address is equal to the signer's address.

#### Request Body

| Name                                        | Type   | Description                                                                                                                                                                                                                                  |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message<mark style="color:red;">\*</mark>   | String | raw message that signature is generated from (it does not have to be hashing)                                                                                                                                                                |
| signature<mark style="color:red;">\*</mark> | String | 0x prefixed signature that is generated by secp256k1 algorithm such as eth\_sign function                                                                                                                                                    |
| address<mark style="color:red;">\*</mark>   | String | Ethreum Address(EOA) of the signer(Both lowercase and mixed case which is compatible with EIP55 are accepted)                                                                                                                                |
| signMethod                                  | String | <p><code>eth\_sign</code>or <code>personal\_sign</code><br></p><p>A specific sign method with which signature is generated. If not specified, both <code>eth\_sign</code> and <code>personal\_sign</code> method is used to validate EOA</p> |

{% tabs %}
{% tab title="200: OK Validation has succeeded with valid input. Check `isValid` field in the response." %}

```javascript
// Validation Success
{ isValid: true, invalidReason: null, triedSignMethods: ['eth_sign'] }

// Validation Failure
{ isValid: false, invalidReason: 'Signature is invalid', triedSignMethods: ['eth_sign', 'personal_sign'] }
```

{% endtab %}

{% tab title="400: Bad Request Validation has failed with invalid input" %}

```javascript
// Validation Failure
{ isValid: false, invalidReason: 'Request parameters are not properly set' }

{ isValid: false, invalidReason: 'Signature format is invalid' }

{ isValid: false, invalidReason: 'Ethereum address is invalid' }
```

{% endtab %}
{% endtabs %}

## **Sample Request command**

```javascript
curl -X PUT \
  -H "Content-type: application/json" \
  --data '{"message": "test-message", "signature": "0x633bc7c201cf45fff0c1724b77c90c825a04c1b818f043915e2fedd55b4cfe681b425fe844ea3684a3860dc250527e318d3225b2d21ad0f75e419db4f0939a1b1c", "address": "0xBFC1331F8111102A51588b3b4A3E2F317B3a0363"}' \
 https://asia-northeast1-startrail-api-prod.cloudfunctions.net/ethereum-signature-validator
```

```javascript
curl -X PUT \
  -H "Content-type: application/json" \
  --data '{"message": "test-message", "signature": "0x7cdf2aa9dfb2da8c6f8fe63269b4dbfb923451f0e36087479e7f2897718a6d0b6438bd44e367907e30c65a4b950c9e11f94049d38a0ca1dd4d419e107a3dade31c", "address": "0xBFC1331F8111102A51588b3b4A3E2F317B3a0363", "signMethod": "personal_sign"}' \
  https://asia-northeast1-startrail-api-prod.cloudfunctions.net/ethereum-signature-validator
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.startrail.io/ethereum-signature-validator-api/ethereum-signature-validator-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
