REST APIs

APIs to manage projects and Forks

The instructions on how to get the API Key, Fork ID, RPC_ID, Project ID, and FORK_RPC can be found in this document.

We use API_KEY, FORK_ID, RPC_ID, PROJECT_ID, and FORK_RPCin the following to denote the concrete value.

Users can create their Forks under a project; each fork must belong to a project. After registering, a default project named 'default' will be made. Subsequently, users can create additional projects of their own.

  BlockSec App Suite
    |
    +---[Project 1]
    |
    +---[Project 2]
    |
    +---[Project 3]
         |
         +---[Fork 1]
         |
         +---[Fork 2]

Request and Response Format

The requested data is packed in the data field of the body. The response is in JSON format, with the following standard structure.

  • code: Integer. Error code.

    • 0: No error.

    • other: Error occurs.

  • message: String

    • If the code is not 0, this field denotes the detailed error information.

  • data: JSON

    • This is the detailed response data.

Create a new project.

POST https://api.phalcon.blocksec.com/v1/project

Create a new project.

Headers

Body

curl --location 'https://api.phalcon.blocksec.com/v1/project'
--header 'Access-Key: $API_KEY'
--header 'Content-Type: application/json'
--data '{ "name":"testApiProject" }'

Get project list

GET https://api.phalcon.blocksec.com/v1/projects

Get the project list.

Headers

curl --location 'https://api.phalcon.blocksec.com/v1/projects'
--header 'Access-Key: $API_KEY'

Response

  • projectId: String. The ID of the created Project. This ID is used to manipulate a Project (e.g., delete a Project or create a Fork in this project).

  • name: String. The name of the Project.

  • createTime:String. The time of the project was created.

Get a project's detailed information.

GET https://api.phalcon.blocksec.com/v1/project/$projectId

Get a project's details, including the collaborators, forked created, and usage information.

Headers

curl --location 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID' \
--header 'Access-Key: $API_KEY'

Request

  • PROJECT_ID: String. The ID of the Project that is to be queried ($PROJECT_ID)

Response

  • projectId: String. The ID of the created Project. This ID is used to manipulate a Project (e.g., delete a Project or create a Fork in this project).

  • name: String. The name of the Project.

  • createTime:String. The time of the project was created.

  • stats:Json. The statistics of the simulated transactions for this project.

    • dailyTransactionQuantity:Integer.Daily usage statistics (UTC)

    • monthlyTransactionQuantity:Integer.Monthly usage statistics from 1st of the month until now).

  • fokDetail:Json. The detailed information on this project's forks.

    • forkId: String. The id of the created Fork. This id is used to manipulate a Fork (e.g., delete a Fork).

    • chainId: Integer. The id of the chain that is forked. It should be the same as the chainId passed in the request.

    • name: String. The name of the Fork. It should be the same as the name passed in the request.

  • collaboratorDetail: Json. The detailed information of this project's collaborators.

    • collaboratorNum: Integer.The number of collaborators

    • collaborators:Json. The collaborator information includes their nickname and email address.

Delete a Project

DELETE https://api.phalcon.blocksec.com/v1/project/delete/$PROJECT_ID

Delete a project.

Headers

curl --location  --request DELETE 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID' \
--header 'Access-Key: $API_KEY'

Request

  • PROJECT_ID: String. The ID of the Project that is to be deleted.

Create a Fork

POST https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork

Create a Fork inside the project specified by $PROJECT_ID.

Headers

curl --location 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork' \
--header 'Access-Key: $API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "chainId":1,
    "height": "safe",
    "name":"testApiFork",
    "position":20,
    "antiReplay": true
}'

Request

  • height: It specifies the block height from which the chain is forked. It accepts the following options.

    • HEX String - an integer block number

    • String "safe" - for the latest safe head block

  • position: Integer. The position in the block (specified by height) that the Forked chain starts. Read more about the height and position.

  • name: String. The name of the created Fork.

  • `antiReplay`: Boolean. It specifies whether the anti-replay feature is enabled for this Fork.

Response

  • forkId: String. The id of the created Fork. This id is used to manipulate a Fork (e.g., delete a Fork).

  • chainId: Integer. The id of the chain that is forked. It should be the same as the chainId passed in the request.

  • name: String. The name of the Fork. It should be the same as the name passed in the request.

  • snapshotId: String. The ID of the default snapshot of this Fork.

Delete a Fork

DELETE https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork/$FORK_ID

Delete a Fork

Headers

curl --location  --request DELETE 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork/$FORK_ID' \
--header 'Access-Key: $API_KEY'

Request

  • PROJECT_ID: String. The ID of the project that contains the Fork is to be deleted.

  • FORK_ID: String. The ID of the Fork is to be deleted.

Get Fork List

GET https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/forks

Get a list of Forks inside the project specified by $PROJECT_ID.

Headers

curl --location 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/forks' \
--header 'Access-Key: $API_KEY'

Request

  • PROJECT_ID: String. The ID of the project.

Response

  • forkId: String. The id of the Fork. This ID is used to manipulate a Fork (e.g., delete a Fork).

  • chainId: Integer. The id of the chain that is forked. It should be the same as the chainId passed in the request.

  • name: String. The name of the Fork. It should be the same as the name passed in the request.

Get Fork Information

GET https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork/$FORK_ID

Given a FORK_ID, return the Fork information.

Headers

curl --location 'https://api.phalcon.blocksec.com/v1/project/$PROJECT_ID/fork/$FORK_ID' \
--header 'Access-Key: $API_KEY'  

Request

  • PROJECT_ID: String. The ID of the project.

  • FORK_ID: String. The ID of the Fork.

Response

  • forkId: String. The id of the Fork. This ID is used to manipulate a Fork (e.g., delete a Fork).

  • chainId: Integer. The id of the chain that is forked. It should be the same as the chainId passed in the request.

  • name: String. The name of the Fork. It should be the same as the name passed in the request.

Last updated