REST APIs

Projects and Forks can be managed through API.

Access Token

The request is in HTTP POST with an access key embedded in the header. The Access key used in the API is shown in the Account Settings of the Dashboard.

The Project ID and Fork ID can be obtained from the API response or viewed in the Fork Panel.

Request and Response

The requested data is packed in the data field of the body. The response is in JSON format, with the following common 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.

Managing Forks of a Project

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

  Dashboard
    |
    +---[Project 1]
    |
    +---[Project 2]
    |
    +---[Project 3]
         |
         +---[Fork 1]
         |
         +---[Fork 2]

Create a Project

This API is used to create a Project.

Create a Project

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

Headers

Request Body

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

Request

  • name: String. The name of the project.

Response

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

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

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

Query Project List

This API is used to retrieve a list of Projects.

Query Project List

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

Headers

Request Body

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

Response

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

  • name: String. The name of the Project.

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

Query a Project's Detail

This API is used to query a Project's detail.

Query a Project's Detail

GET https://api.phalcon.xyz/v1/project/$projectId

Delete a Fork

Headers

Request Body

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

Request

  • projectId: String. The id of the Project that is to be query.

Response

  • projectId: String. The id of the created Project. This id is used to manipulate a Project (e.g., delete a Project/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 of 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 collaborator.

    • collaboratorNum: Integer.The number of collaborators

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

Delete a Project

This API is used to delete a Project.

Delete a Project

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

Delete a Fork

Headers

Request Body

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

Request

  • projectId: String. The id of the Project that is to be deleted.

Create a Fork

This API is used to create a Fork, and please note that a Fork needs to belong to a specific project.

Create a Fork

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

Headers

Request Body

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

Request

  • height: It specifies the block height that the chain is forked from. 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.

  • 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

This API is used to delete a Fork.

Delete a Fork

DELETE https://api.phalcon.blocksec.com/v1/project/$projectId/fork/$forkId

Delete a Fork

Headers

Request Body

curl --location  --request DELETE 'https://api.phalcon.blocksec.com/v1/project/$projectId/fork/$forkId' \
--header 'Access-Key: $AccessKey'

Request

  • forkId: String. The id of the Fork that is to be deleted.

Query Fork List

This API is used to retrieve a list of Forks.

Query Fork List

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

Headers

Request Body

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

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.

Query Fork Usage Status

This API is used to retrieve the usage status of a Fork.

Query Fork Usage Status

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

Delete a Fork

Headers

Request Body

curl --location 'https://api.phalcon.blocksec.com/v1/project/$projectId/fork/$forkId' \
--header 'Access-Key: $AccessKey' \

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.

Last updated