---
# System prepended metadata

title: StarkWare JSON-RPC Spec

---

# StarkWare JSON-RPC Spec

JSON-RPC specification for wallet interaction for starkware methods

## Get Accounts

The method `stark_accounts` will return an array of StarkKeys registered by the wallet.

```typescript
// request
interface StarkAccountsRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_accounts";
  params: {
      contractAddress: string;
  };
}

// response
interface StarkAccountsResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    accounts: string[];
  };
}
```

## Register Account

The method `stark_register` will register the active Ethereum wallet to the StarkExchange and return the transaction hash of the submitted registration on-chain.

```typescript
// request
interface StarkRegisterRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_register";
  params: {      
    contractAddress: string;
    starkPublicKey: string;
    signature: string
  };
}

// response
interface StarkRegisterResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    txhash: string;
  };
}
```

## Deposit Asset

This method `stark_deposit` will request a deposit of an asset into provided vaultId and will return the transaction hash of the submitted deposit on-chain.

```typescript
// request
interface StarkDepositRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_deposit";
  params: {
    contractAddress: string;
    starkPublicKey: string;
    amount: string;
    tokenID: object; 
    vaultId: string;
  };
}

// response
interface StarkDepositResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    txhash: string;
  };
}
```

## Transfer Asset

This method `stark_transfer` will request an asset transfer off-chain and will return a stark signature approved by the wallet.

```typescript
//request
interface StarkTransferRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_transfer";
  params: {
    contractAddress: string;
    starkPublicKeyFrom: string;    
    vaultFrom: string;
    amount: string;
    tokenID: object; 
    starkPublicKeyTo: string;
    vaultTo: string;
    nonce: string;
    expirationTimestamp: string;
  };
}

// response
interface StarkTransferResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    signature: string;
  };
}
```

## Create Limit Order

This method `stark_createOrder` will request the creation of a limit order off-chain and will return a stark signature approved by the wallet.

```typescript
// request
interface StarkCreateOrderRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_createOrder";
  params: {
    contractAddress: string;
    starkPublicKey: string;
    vaultSell: string;
    vaultBuy: string;
    amountSell: string;
    amountBuy: string;
    tokenIDSell: object;
    tokenIDBuy: object;
    nonce: string;
    expirationTimestamp: string;
  };
}
interface StarkCreateOrderResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    signature: string;
  };
}

```

## Withdraw Asset

This method `stark_withdraw` will request the withdrawal of an asset off-chain and will return a stark signature approved by the wallet.

```typescript
// request
interface StarkWithdrawRequest {
  id: 1;
  jsonrpc: "2.0";
  method: "stark_withdraw";
  params: {
    contractAddress: string;
    tokenID: object; 
  };
}

// response
interface StarkWithdrawResponse {
  id: 1;
  jsonrpc: "2.0";
  result: {
    txhash: string;
  };
}
```