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

# Start Crypto Wallet Authentication

> Initiate the authentication of a crypto wallet.

After calling this endpoint, the user will need to sign a message containing the returned challenge field.

For Ethereum crypto wallets, you can optionally use the Sign In With Ethereum (SIWE) protocol for the message by passing in the `siwe_params`. The only required fields are `domain` and `uri`. If the crypto wallet detects that the domain in the message does not match the website's domain, it will display a warning to the user.

If not using the SIWE protocol, the message will simply consist of the project name and a random string.


## OpenAPI

````yaml POST /v1/crypto_wallets/authenticate/start
openapi: 3.0.3
info:
  title: Stytch API
  description: The Stytch API provides endpoints for authentication and user management.
  version: 2.1.1
  contact:
    name: Stytch Support
    url: https://stytch.com/docs
    email: support@stytch.com
servers:
  - url: https://api.stytch.com
    description: Production server
  - url: https://test.stytch.com
    description: Test server
security:
  - basicAuth: []
paths:
  /v1/crypto_wallets/authenticate/start:
    post:
      tags:
        - Crypto Wallet
      summary: Authenticatestart
      description: >-
        Initiate the authentication of a crypto wallet. After calling this
        endpoint, the user will need to sign a message containing the returned
        `challenge` field.


        For Ethereum crypto wallets, you can optionally use the Sign In With
        Ethereum (SIWE) protocol for the message by passing in the
        `siwe_params`. The only required fields are `domain` and `uri`.

        If the crypto wallet detects that the domain in the message does not
        match the website's domain, it will display a warning to the user.


        If not using the SIWE protocol, the message will simply consist of the
        project name and a random string.
      operationId: api_crypto_wallet_v1_AuthenticateStart
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/api_crypto_wallet_v1_AuthenticateStartRequest
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_crypto_wallet_v1_AuthenticateStartResponse
        '400':
          description: Bad request
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                status_code: 401
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: unauthorized_credentials
                error_message: Unauthorized credentials.
                error_url: https://stytch.com/docs/api/errors/401
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                status_code: 429
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: too_many_requests
                error_message: Too many requests have been made.
                error_url: https://stytch.com/docs/api/errors/429
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                status_code: 500
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: internal_server_error
                error_message: >-
                  Oops, something seems to have gone wrong, please reach out to
                  support@stytch.com to let us know what went wrong.
                error_url: https://stytch.com/docs/api/errors/500
      x-code-samples:
        - lang: csharp
          label: C#
          source: |-
            // POST /v1/crypto_wallets/authenticate/start
            const stytch = require('stytch');

            const client = new stytch.Client({
              project_id: '${projectId}',
              secret: '${secret}',
            });

            const params = {
              crypto_wallet_type: "ethereum",
              crypto_wallet_address: "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
            };

            client.CryptoWallets.AuthenticateStart(params)
              .then(resp => { console.log(resp) })
              .catch(err => { console.log(err) });
        - lang: go
          label: Go
          source: "// POST /v1/crypto_wallets/authenticate/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v18/stytch/consumer/cryptowallets\"\n\t\"github.com/stytchauth/stytch-go/v18/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &cryptowallets.AuthenticateStartParams{\n\t\tCryptoWalletType:    \"ethereum\",\n\t\tCryptoWalletAddress: \"0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1\",\n\t}\n\n\tresp, err := client.CryptoWallets.AuthenticateStart(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
        - lang: java
          label: Java
          source: >-
            // POST /v1/crypto_wallets/authenticate/start

            package com.example;


            import com.stytch.java.common.StytchResult;

            import
            com.stytch.java.consumer.models.cryptowallets.AuthenticateStartRequest;

            import com.stytch.java.consumer.StytchClient;


            public class Main {
                public static void main(String[] args) {
                    StytchClient.configure("${projectId}", "${secret}");

                    AuthenticateStartRequest params = new AuthenticateStartRequest();
                    params.setCryptoWalletType("ethereum");
                    params.setCryptoWalletAddress("0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1");

                    Object result = StytchClient.getCryptoWallets().authenticateStart(params);
                    if (result instanceof StytchResult.Success) {
                      System.out.println(((StytchResult.Success) result).getValue());
                    } else {
                      System.out.println(((StytchResult.Error) result).getException());
                    }
                }
            }
        - lang: kotlin
          label: Kotlin
          source: >
            // POST /v1/crypto_wallets/authenticate/start

            package com.example


            import com.stytch.java.consumer.StytchClient

            import
            com.stytch.java.consumer.models.cryptowallets.AuthenticateStartRequest


            fun main() {
                StytchClient.configure(
                    projectId = "${projectId}",
                    secret = "${secret}",
                )

                when (
                    val result =
                        StytchClient.cryptoWallets.authenticateStart(
                            AuthenticateStartRequest(
                                cryptoWalletType = "ethereum",
                                cryptoWalletAddress = "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
                            ),
                        )
                ) {
                    is StytchResult.Success -> println(result.value)
                    is StytchResult.Error -> println(result.exception)
                }
            }
        - lang: javascript
          label: Node.js
          source: |-
            // POST /v1/crypto_wallets/authenticate/start
            const stytch = require('stytch');

            const client = new stytch.Client({
              project_id: '${projectId}',
              secret: '${secret}',
            });

            const params = {
              crypto_wallet_type: "ethereum",
              crypto_wallet_address: "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
            };

            client.cryptoWallets.authenticateStart(params)
              .then(resp => { console.log(resp) })
              .catch(err => { console.log(err) });
        - lang: php
          label: PHP
          source: |-
            $response = $client->crypto_wallets->authenticate_start([
                'crypto_wallet_type' => 'ethereum',
                'crypto_wallet_address' => '0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1',
            ]);
        - lang: python
          label: Python
          source: |
            # POST /v1/crypto_wallets/authenticate/start
            from stytch import Client

            client = Client(
                project_id="${projectId}",
                secret="${secret}",
            )

            resp = client.crypto_wallets.authenticate_start(
                crypto_wallet_type="ethereum",
                crypto_wallet_address="0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
            )

            print(resp)
        - lang: ruby
          label: Ruby
          source: |-
            # frozen_string_literal: true

            # POST /v1/crypto_wallets/authenticate/start
            require 'stytch'

            client = Stytch::Client.new(
              project_id: "${projectId}",
              secret: "${secret}"
            )

            resp = client.crypto_wallets.authenticate_start(
              crypto_wallet_type: "ethereum",
              crypto_wallet_address: "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1"
              
            )

            puts resp
        - lang: rust
          label: Rust
          source: |-
            // POST /v1/crypto_wallets/authenticate/start
            use stytch::consumer::client::Client;
            use stytch::consumer::crypto_wallets::AuthenticateStartRequest;

            fn main() {
                let client = Client::new("${projectId}", "${secret}").unwrap();
                let resp = client.crypto_wallets.authenticate_start(
                    AuthenticateStartRequest{
                        crypto_wallet_type: "ethereum",
                        crypto_wallet_address: "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
                        ..Default::default()
                    }
                ).await;
                println!("The response is {:?}", resp);
            }
        - lang: bash
          label: cURL
          source: |-
            # POST /v1/crypto_wallets/authenticate/start
            curl --request POST \
              --url https://test.stytch.com/v1/crypto_wallets/authenticate/start \
              -u '${projectId}:${secret}' \
              -H 'Content-Type: application/json' \
              -d '{
                "crypto_wallet_type": "ethereum",
                "crypto_wallet_address": "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1"
              }'
components:
  schemas:
    api_crypto_wallet_v1_AuthenticateStartRequest:
      type: object
      properties:
        crypto_wallet_type:
          type: string
          description: >-
            The type of wallet to authenticate. Currently `ethereum` and
            `solana` are supported. Wallets for any EVM-compatible chains (such
            as Polygon or BSC) are also supported and are grouped under the
            `ethereum` type.
        crypto_wallet_address:
          type: string
          description: The crypto wallet address to authenticate.
        user_id:
          type: string
          description: >-
            The unique ID of a specific User. You may use an `external_id` here
            if one is set for the user.
        session_token:
          type: string
          description: The `session_token` associated with a User's existing Session.
        session_jwt:
          type: string
          description: The `session_jwt` associated with a User's existing Session.
        siwe_params:
          $ref: '#/components/schemas/api_crypto_wallet_v1_SIWEParams'
          description: >-
            The parameters for a Sign In With Ethereum (SIWE) message. May only
            be passed if the `crypto_wallet_type` is `ethereum`.
      description: Request type
      required:
        - crypto_wallet_type
        - crypto_wallet_address
    api_crypto_wallet_v1_AuthenticateStartResponse:
      type: object
      properties:
        request_id:
          type: string
          description: >-
            Globally unique UUID that is returned with every API call. This
            value is important to log for debugging purposes; we may ask for
            this value to help identify a specific API call when helping you
            debug an issue.
        user_id:
          type: string
          description: The unique ID of the affected User.
        challenge:
          type: string
          description: >-
            A challenge string to be signed by the wallet in order to prove
            ownership.
        user_created:
          type: boolean
          description: >-
            In `login_or_create` endpoints, this field indicates whether or not
            a User was just created.
        status_code:
          type: integer
          format: int32
          description: >-
            The HTTP status code of the response. Stytch follows standard HTTP
            response status code patterns, e.g. 2XX values equate to success,
            3XX values are redirects, 4XX are client errors, and 5XX are server
            errors.
      required:
        - request_id
        - user_id
        - challenge
        - user_created
        - status_code
    api_crypto_wallet_v1_SIWEParams:
      type: object
      properties:
        domain:
          type: string
          description: >-
            Only required if `siwe_params` is passed. The domain that is
            requesting the crypto wallet signature. Must be an RFC 3986
            authority.
        uri:
          type: string
          description: >-
            Only required if `siwe_params` is passed. An RFC 3986 URI referring
            to the resource that is the subject of the signing.
        resources:
          type: array
          items:
            type: string
          description: ' A list of information or references to information the user wishes to have resolved as part of authentication. Every resource must be an RFC 3986 URI.'
        chain_id:
          type: string
          description: >-
            The EIP-155 Chain ID to which the session is bound. Defaults to 1.
            Must be the string representation of an integer between 1 and
            9,223,372,036,854,775,771, inclusive.
        statement:
          type: string
          description: >-
            A human-readable ASCII assertion that the user will sign. The
            statement may only include reserved, unreserved, or space characters
            according to RFC 3986 definitions, and must not contain other forms
            of whitespace such as newlines, tabs, and carriage returns.
        issued_at:
          type: string
          description: >-
            The time when the message was generated. Defaults to the current
            time. All timestamps in our API conform to the RFC 3339 standard and
            are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
        not_before:
          type: string
          description: >-
            The time when the signed authentication message will become valid.
            Defaults to the current time. All timestamps in our API conform to
            the RFC 3339 standard and are expressed in UTC, e.g.
            `2021-12-29T12:33:09Z`.
        message_request_id:
          type: string
          description: >-
            A system-specific identifier that may be used to uniquely refer to
            the sign-in request. The `message_request_id` must be a valid pchar
            according to RFC 3986 definitions.
      required:
        - domain
        - uri
        - resources
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````