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.
post
https://api.phalcon.xyz/v1/project
Create a Project
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project' \
--header 'Access-Key: $AccessKey' \
--header 'Content-Type: application/json' \
--data '{
"name":"testApiProject"
}'
{
"code": 0,
"message": "OK",
"data": {
"projectId": "p_516xxxxxxxxxxxxxxxxc6d8c",
"name": "testApiProject",
"createTime": "2023-06-25 03:40:50"
}
}

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.
get
https://api.phalcon.xyz/v1/projects
Query Project List
Request
Response
curl --location 'https://api.phalcon.xyz/v1/projects' \
--header 'Access-Key: $AccessKey'
{
"code": 0,
"message": "ok",
"data": [
{
"projectId": "p_1da225a5xxxxxxxxxxxxxxxxxxxxd885",
"name": "Project_1",
"createTime": "2023-06-20 10:37:06"
},
{
"projectId": "p_b16004dxxxxxxxxxxxxxxxxxxxx13d",
"name": "Project_2",
"createTime": "2023-06-25 03:11:09"
},
{
"projectId": "p_516b2bxxxxxxxxxxxxxxxxxxxxd8c",
"name": "Project_3",
"createTime": "2023-06-25 03:40:50"
}
]
}

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.
get
https://api.phalcon.xyz/v1/project/$projectId
Query a Project's Detail
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project/$projectId' \
--header 'Access-Key: $AccessKey'
{
"code": 0,
"message": "ok",
"data": {
"projectId": "p_0eefxxxxxxxxxx5f",
"name": "Learn Blockchain",
"createTime": "2023-06-20 15:21:57",
"collaboratorDetail": {
"collaboratorNum": 1,
"collaborators": [{
"email": "[email protected]",
"name": "Raymond"
}]
},
"fokDetail": {
"forkNum": 2,
"forks": [{
"forkId": "132-xxxx-xxxx-eae",
"chainId": 1,
"name": "TryUniswap",
"url": "https://rpc.phalcon.xyz/b0bb52xxxxxxfxxxxxxx10"
}, {
"forkId": "433xxxxx-yyyy-zzzz-aaaa-78811c05f471",
"chainId": 56,
"name": "Hello BSC",
"url": "https://rpc.phalcon.xyz/5d1a1exxxxxxxxxda7c4f"
}],
"stats": {
"dailyTransactionQuantity": 0,
"monthlyTransactionQuantity": 9
}
}
}
}

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
https://api.phalcon.xyz/v1/project/delete
/$projectId
Delete a Project
Request
Response
curl --location --request DELETE 'https://api.phalcon.xyz/v1/project/$projectId' \
--header 'Access-Key: $AccessKey'
{
"code": 0,
"message": "OK"
}

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.
post
https://api.phalcon.xyz/v1/project/$projectId/fork
Create a Fork
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project/$projectId/fork' \
--header 'Access-Key: $AccessKey' \
--header 'Content-Type: application/json' \
--data '{
"chainId":1,
"height": "safe",
"name":"testApiFork",
"position":20,
"antiReplay": true
}'
{
"code": 0,
"message": "OK",
"data": {
"forkId": "b480224a-8e0f-4e90-9e47-6017c7bdxxxx",
"chainId": 9991,
"name": "testApiFork111",
"snapshotId": "b480224a-8e0f-4e90-9e47-6017c7bdadaa",
"rpc": "https://rpc.phalcon.xyz/xxxxxxxxfd2a4e5ca1179785xxxxxxxx"
}
}

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
https://api.phalcon.xyz/v1/project/$projectId/fork/$forkId
Delete a Fork
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project/$projectId/fork/$forkId' \
--header 'Access-Key: $AccessKey' \
--header 'Content-Type: application/json' \
--data '{
"forkId": "296b480c-6d61-4b46-8a4c-8ae0d2d3xxxx"
}'
{
"code": 0,
"message": "OK"
}

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.
get
https://api.phalcon.xyz/v1/project/$projectId/forks
Query Fork List
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project/$projectId/forks' \
--header 'Access-Key: $AccessKey'
{
"code": 0,
"data": [
{
"forkId": "621bf83d-9741-xxx-92c7-acdcc1399055",
"name": "1",
"rpc": "https://rpc.phalcon.xyz/xxx",
"chainId": 9991
},
{
"forkId": "3dbeb3a1-b3b4-xxx-91ea-c160a347a781",
"name": "ETH1",
"rpc": "https://rpc.phalcon.xyz/xxx",
"chainId": 1
},
{
"forkId": "f11f7186-a57a-xxx-b849-177577a1c130",
"name": "eth",
"rpc": "https://rpc.phalcon.xyz/xxx",
"chainId": 1
}
]
}

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.
get
https://api.phalcon.xyz/v1/project/$projectId/fork/$forkId
Query Fork Usage Status
Request
Response
curl --location 'https://api.phalcon.xyz/v1/project/$projectId/fork/$forkId' \
--header 'Access-Key: $AccessKey' \
{
"code": 0,
"data": {
"forkId": "621bf83d-xxxx-xxx-92c7-zzzzzz",
"name": "forkName",
"rpc": "https://rpc.phalcon.xyz/xxx",
"chainId": 9991
}
}

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.
  • rpc:String. The RPC of this Fork.
Last modified 1mo ago