Satori Finance Docs
  • ✨About Satori Finance
  • 👉Beginner's Guide
    • Deposit & Withdrawal
    • Trading
  • 💸Perpetual Trading
    • Matchmaking
    • Margin
    • Isolated/Cross Margin
    • Funding Costs
    • Trading fees
    • Index Price
    • Mark Price
    • Liquidations
    • Insurance Funds
    • Automatic Deleveraging
  • 🌽Vaults
  • 📲Telegram Mini APP
  • 🚀Liquid Restaked Tokens (LRT)
  • 🔥Points
  • 🎉Trading Competition
    • Satori Season2 Trading Competition Backed by Hemi
  • 🎭Referrals
  • 🦄Ecosystem Partner Incentives
  • API DOCS
    • 👨‍💻OpenAPI
      • Introduce
      • Auth
      • URL
      • Response Code
      • Rest API
        • A complete example
        • Order Operation 【Private Operation】
          • Create order
          • Batch create orders
          • Cancel order
          • Batch Cancel orders
        • Position Operation 【private operation】
          • Add/reduce margin
        • 【Private Query】
          • [Account] Query account balance
          • [Order] Query current order list
          • [Trade] Query match result
          • [Position] Query position list
        • 【Public Query】
          • System time
          • Index price
          • Mark price
          • Last trade
          • Pair list
      • WebSocket
        • Events
        • Subscription
          • Basic parameters
          • Example
          • Account
          • Orders
          • Positions
          • Trades
Powered by GitBook
On this page
  1. API DOCS
  2. OpenAPI

Auth

We use the secp256k1 signature algorithm with the Private Key as the app_secret to sign the string to be signed.

Java code 【secp256k1 signature algorithm】

import org.web3j.crypto.Credentials;
import org.web3j.crypto.Sign;
import org.web3j.utils.Numeric;
import java.nio.charset.StandardCharsets;
​
public class CryptoUtils {
    public static String createSign(String message, String privateKey) {
        Credentials credentials = Credentials.create(privateKey);
        byte[] hash = message.getBytes(StandardCharsets.UTF_8);
        Sign.SignatureData signatureData = Sign.signPrefixedMessage(hash, credentials.getEcKeyPair());
        String r = Numeric.toHexString(signatureData.getR());
        String s = Numeric.toHexString(signatureData.getS()).substring(2);
        String v = Numeric.toHexString(signatureData.getV()).substring(2);
        return r + s + v;
    }
}

⚠️ Special Note: All signatures here are in string format.

Strings to be signed

  • The string to be signed does not include the data of the signature field;

  • If there are spaces in the parameters, the spaces will also be included in the signature;

  • For JSON request bodies, convert to a JSON format string for signing;

Signature for POST request with application/json format body: String to be signed = Request body JSON string
Example: "{"symbol":"ETH","timestamp":"1679638652028"}"
  • For URL parameter requests, directly convert to a string for signing

1. For POST requests with application/x-www-form-urlencoded format: String to be signed = Parameters & concatenation
   Example: "symbol=ETH&timestamp=1679638652028"
2. For GET request parameter signature: String to be signed = Data after the request path's "?"
   Example: "symbol=ETH&timestamp=1679638652028"

PreviousIntroduceNextURL

Last updated 7 months ago

👨‍💻