# RaaS API

## Sign up

```
POST https://raas.bvm.network/api/account/sign-up 

payload: 
{
   "tcAddress": string,
   "password": string
}

response:
{
   "error": string,
   "result": string // bearer token string
}
```

\
Example:

```
POST https://raas.bvm.network/api/account/sign-up 

payload: 
{
   "tcAddress": "0x7f4e115041c5a0985458911bc8f2d5eb24e8b987,
   "password": "BVM12345"
}

response:
{
   "error": "",
   "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjU1MzMyNjIsInRjX2FkZHJlc3MiOiIweDdGNGUxMTUwNDFDNWE1MUE1NDU4OTExYkM4ZjJENUViMjRlOGJGOTcifQ.qX-Q5HQqLVfU5bm9e1HXlsxqjKaJnYRGV9U9_XY6LYA"
}
```

## Log in&#x20;

To re-obtain the access token if needed.

```
POST https://raas.bvm.network/api/account/login

payload: 
{
   "tcAddress": string,
   "password": string
}

response:
{
   "error": ””,
   "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjU1MzMyNjIsInRjX2FkZHJlc3MiOiIweDdGNGUxMTUwNDFDNWE1MUE1NDU4OTExYkM4ZjJENUViMjRlOGJGOTcifQ.qX-Q5HQqLVfU5bm9e1HXlsxqjKaJnYRGV9U9_XY6LYA"
}
```

Example:

```
POST https://raas.bvm.network/api/account/login

payload: 
{
   "tcAddress": "0x7f4e115041c5a0985458911bc8f2d5eb24e8b987",
   "password": "BV1!2345"
}

response:
{
   "error": “”,
   "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjU1MzMyNjIsInRjX2FkZHJlc3MiOiIweDdGNGUxMTUwNDFDNWE1MUE1NDU4OTExYkM4ZjJENUViMjRlOGJGOTcifQ.qX-Q5HQqLVfU5bm9e1HXlsxqjKaJnYRGV9U9_XY6LYA"
}
```

## Get user information to obtain the payment address&#x20;

You will need to send BVM to that address to pay for rollups you launch on the BVM platform.

```
GET https://raas.bvm.network/api/account/info

Auth: Bearer Token required
response:
{
   "error": string,
   "status": bool,
   "result": {
       "createdAt": datetime,
       "tcAddress": string,
       "topupWalletAddress": string
       }
}
```

Example:

```
GET https://raas.bvm.network/api/account/info

Auth: Bearer Token required
response:
{
   "error": ””,
   "result": {
       "createdAt": "2024-08-06T10:04:21.379Z",
       "tcAddress": "0x7f4e115041c5a0985458911bc8f2d5eb24e8b987",
       "topupWalletAddress": "0xb59b7a2898c6fc9b8e03f7e6bd31355532da0665"
       }
}
```

## Launch a rollup

Make sure you have sufficiently deposited BVM into the payment address you obtained in the previous step.

```
POST: https://raas.bvm.network/api/rollup/launch 

Auth: Bearer Token required
payload:
{
   "domain": string,
   "chainId": number,
   "chainName": string,
   "network": string, // options: ["testnet", “mainnet”]
   "withdrawalTime": number, // options:  [86400, 43200, 21600]
   "layer": string, // options: ["layer2", “layer3”]
   "hardware": string, // options: ["hardware1", “hardware2”, “hardware3”] where 
   "dataAvaibility": string, // options: ["celestia", “polygon”, “near”, “avail”]
   "blockGasLimit": number, // options: [1000000000, 2000000000, 4000000000]
   "prover": bool,
}

response: 
{
   "error": string,
   "result": {
       "createAt": number,
       "orderId": string,
       "tcAddress": string,
       "serviceType": number,
        "status": number, // 0: wait for payment, 1: setting up, 2: running.
       "dataAvaibilityChain": number, 
       "domain": string,
       "chainId": string,
       "chainName": string,
       "finalizationPeriod": number,
       "blockTime": number,
       "isMainnet": bool,
       "gasLimit": number,
        "prover": number,
       "cpuCore": number,
       "memory": number,
       "storage": number   
   }
}
```

Example:

```
POST: https://raas.bvm.network/api/rollup/launch

Auth: Bearer Token required
payload:
{
   "domain": "my-rollup",
   "chainId": 123457,
   "chainName": "My Rollup",
   "network": "mainnet",
   "withdrawalTime": 86400,
   "layer": "layer2", 
   "hardware": "hardware1",
   "dataAvaibility": "celestia",
   "blockGasLimit": 1000000000,
   "prover": false
}

response: 
{
   "error": null,
   "result": {
       "createAt": 1722947114,
       "orderId": "66b2162adc70434c295a8379",
       "tcAddress": "0x7f4e115041c5a51a5458911bc8f2d5eb24e8bf97",
       "serviceType": 21,
        "status": 0,
       "dataAvaibilityChain": 10, 
       "domain": “my-rollup",
       "chainId": "123456",
       "chainName": "My Rollup",
       "finalizationPeriod": 86400,
       "blockTime": 1,
       "isMainnet": false,
       "gasLimit": 1000000000,
        "prover": 0,
       "cpuCore": 8,
       "memory": 16,
       "storage": 320    
   }
}
```

In case the payment wallet address doesn’t have sufficient BVM, the api will return an error along with topup information as follows:

```
response example with error:

{
   "error": “Insufficient balance. Please top up 200 BVM (ethereum) to 0xb59b7a2898c6fc9b8e03f7e6bd31355532da0665 address.”
}
```

## Get rollup info

```
GET: https://raas.bvm.network/api/rollup/:chainID  

response: 
{
   "error": string,
   "result": {
       "createAt": number,
       "orderId": string,
       "tcAddress": string,
       "serviceType": number,
        "status": number, // 0: wait for payment, 1: setting up, 2: running.
       "dataAvaibilityChain": number, 
       "domain": string,
       "chainId": string,
       "chainName": string,
       "finalizationPeriod": number,
       "blockTime": number,
       "isMainnet": bool,
       "gasLimit": number,
        "prover": number,
       "cpuCore": number,
       "memory": number,
       "storage": number   
   }
}
```

Example:

```
GET: https://raas.bvm.network/api/rollup/:chainID  

response: 
{
   "error": null,
   "result": {
       "createAt": 1722947114,
       "orderId": "66b2162adc70434c295a8379",
       "tcAddress": "0x7f4e115041c5a51a5458911bc8f2d5eb24e8bf97",
       "serviceType": 21,
        "status": 2,
       "dataAvaibilityChain": 10, 
       "domain": “my-rollup",
       "chainId": "123456",
       "chainName": "My Rollup",
       "finalizationPeriod": 86400,
       "blockTime": 1,
       "isMainnet": false,
       "gasLimit": 1000000000,
        "prover": 0,
       "cpuCore": 8,
       "memory": 16,
       "storage": 320    
   }
}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bvm.network/bvm/bitcoin-api/raas-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
