Overview
The Membership API allows users to connect their wallets (EVM, Solana, or TON) and become members of Turtle. This API follows a secure three-step flow to ensure wallet ownership verification.
Authentication Flow
Check Membership Status
Verify if a wallet address is already associated with a Turtle account
Request Signature Agreement
Generate a message that must be signed by the wallet to prove ownership
Create Membership
Submit the signed message to create a new user account and associate the wallet
Endpoints
Check Membership Status
curl -X GET "https://earn.turtle.xyz/v1/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
Query Parameters
The wallet address to check
The blockchain ecosystem. Supported values: evm, solana, ton
Response
Request Signature Agreement
curl -X POST https://earn.turtle.xyz/v1/membership/agreement \
-H "Content-Type: application/json" \
-d '{
"address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
"walletEcosystem": "evm",
"url": "https://turtle.xyz",
"chainId": "1"
}'
Request Body
The wallet address requesting membership
The blockchain ecosystem. Supported values: evm, solana, ton
The URL of the application (used in the signature message)
The chain ID for EVM wallets. Not required for Solana or TON
Response
{
"nonce" : "550e8400-e29b-41d4-a716-446655440000" ,
"message" : "turtle.xyz wants you to sign in with your Ethereum account: \n 0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D \n\n Sign Up to Turtle \n\n URI: https://turtle.xyz \n Version: 1 \n Chain ID: 1 \n Nonce: 550e8400-e29b-41d4-a716-446655440000 \n Issued At: 2024-01-15T10:00:00Z"
}
Create Membership
curl -X POST https://earn.turtle.xyz/v1/membership \
-H "Content-Type: application/json" \
-d '{
"address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
"walletEcosystem": "evm",
"signature": "0x1234567890abcdef...",
"nonce": "550e8400-e29b-41d4-a716-446655440000",
"distributorId": "your-distributor-id"
}'
Request Body
The wallet address creating the membership
The blockchain ecosystem. Supported values: evm, solana, ton
The signature of the message returned by the agreement endpoint
The nonce returned by the agreement endpoint
The distributor ID to associate the membership with. When provided, the user will be tracked as having signed up through the distributor’s integration.
Response
{
"isMember" : true ,
"error" : ""
}
Complete Flow Example
Here’s a complete example of the membership creation flow:
# Step 1: Check if wallet is already a member
curl -X GET "https://earn.turtle.xyz/v1/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
# Response: {"isMember": false}
# Step 2: Request signature agreement
curl -X POST https://earn.turtle.xyz/v1/membership/agreement \
-H "Content-Type: application/json" \
-d '{
"address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
"walletEcosystem": "evm",
"url": "https://turtle.xyz",
"chainId": "1"
}'
# Response: {"nonce": "550e8400...", "message": "turtle.xyz wants you to sign..."}
# Step 3: Sign the message with your wallet (using web3 library or wallet app)
# This step happens client-side
# Step 4: Submit the signature to create membership
curl -X POST https://earn.turtle.xyz/v1/membership \
-H "Content-Type: application/json" \
-d '{
"address": "0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D",
"walletEcosystem": "evm",
"signature": "0x1234567890abcdef...",
"nonce": "550e8400-e29b-41d4-a716-446655440000"
}'
# Response: {"isMember": true, "error": ""}
# Step 5: Verify membership was created
curl -X GET "https://earn.turtle.xyz/v1/membership?address=0xaD595ba34B6BEdCdFDecCe0C0cDe6A2Dc7Ad658D&walletEcosystem=evm"
# Response: {"isMember": true}
Error Handling
Common Errors
Status Code: 400 Bad RequestResponse: {
"error" : {
"status" : "INVALID_ARGUMENT" ,
"error" : "invalid wallet ecosystem"
}
}
Solution: Use one of the supported ecosystems: evm, solana, or ton
Status Code: 400 Bad RequestResponse: {
"error" : {
"status" : "INVALID_ARGUMENT" ,
"error" : "invalid wallet address"
}
}
Solution: Ensure the wallet address is valid for the specified ecosystem
Status Code: 409 ConflictResponse: {
"error" : {
"status" : "ALREADY_EXISTS" ,
"error" : "wallet already exists"
}
}
Solution: This wallet is already associated with an account. Is not necessary to create a new membership.
Status Code: 400 Bad RequestResponse: {
"error" : {
"status" : "INVALID_ARGUMENT" ,
"error" : "invalid nonce or expired"
}
}
Solution: Request a new agreement and sign it promptly. Nonces expire after a short period
Security Considerations
Never share your private keys or seed phrases. The API only requires signatures, not private keys.
Nonces are single-use and expire after a short period
Messages follow the EIP-4361 standard for EVM wallets
All signatures are verified server-side before creating accounts