Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
common
doc
Commits
9c5c461a
Unverified
Commit
9c5c461a
authored
7 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
add requests part
parent
a9e2abd8
No related branches found
No related tags found
1 merge request
!4
RFC 4 : Duniter WS2P API v1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rfc/0004_ws2p_v1.md
+187
-0
187 additions, 0 deletions
rfc/0004_ws2p_v1.md
with
187 additions
and
0 deletions
rfc/0004_ws2p_v1.md
+
187
−
0
View file @
9c5c461a
...
@@ -19,6 +19,13 @@ This document details the current specifications of WS2P v1 as they are already
...
@@ -19,6 +19,13 @@ This document details the current specifications of WS2P v1 as they are already
*
[
Rebound policy
](
#rebound-policy
)
*
[
Rebound policy
](
#rebound-policy
)
*
[
HEAD Rebound policy
](
#head-rebound-policy
)
*
[
HEAD Rebound policy
](
#head-rebound-policy
)
*
[
Documents rebound policy
](
#documents-rebound-policy
)
*
[
Documents rebound policy
](
#documents-rebound-policy
)
*
[
WS2P requests
](
#ws2p-requests
)
*
[
getCurrent
](
#getcurrent
)
*
[
getBlock
](
#getblock
)
*
[
getBlocks
](
#getBlocks
)
*
[
getRequirementsPending
](
#getrequirementspending
)
*
[
List of error messages
](
#list-of-error-messages
)
## What is WS2P ?
## What is WS2P ?
...
@@ -392,3 +399,183 @@ Each time Duniter receives a new document, either via the client api or via ws2p
...
@@ -392,3 +399,183 @@ Each time Duniter receives a new document, either via the client api or via ws2p
3.
Verification of compliance with all local index rules
3.
Verification of compliance with all local index rules
If all conditions are satisfied, then the document is saved in the local bdd of the node and is transmitted to all active ws2p connections.
If all conditions are satisfied, then the document is saved in the local bdd of the node and is transmitted to all active ws2p connections.
## WS2P requests
Specific queries can be sent via ws2p to obtain specific blocks or sandbox data.
Each type of query has a unique identifier called "name" (Realy it's an integer).
### getCurrent
name = 3
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 3,
params: {}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: BLOCK_IN_JSON_FORMAT
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: error_message_in_string_format
}
### getBlock
name = 2
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 2,
params: {
number: BLOCK_NUMBER
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: BLOCK_IN_JSON_FORMAT
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: error_message_in_string_format
}
### getBlocks
name = 1
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 1,
params: {
count: *number of blocks requested*,
fromNumber: *number of the 1st block of the requested interval*
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: [
BLOCK_1_IN_JSON_FORMAT,
BLOCK_2_IN_JSON_FORMAT,
...
]
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: *error message in string format*
}
### getRequirementsPending
Requests the "requirements" of all identities that have received at least
`minCert`
certifications.
name = 0
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 0,
params: {
minCert: *integer*
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: {
identities: [
{
hash: IDTY1_HASH,
member: *boolean*,
wasMember: *boolean*,
pubkey: IDTY1_PUBKEY,
uid: IDTY1_UID,
buid: IDTY1_BUID,
sig: IDTY1_SIG,
revocation_sig: IDTY1_REVOCATION_SIG,
revoked: *boolean*,
revoked_on: *integer*
},
IDTY2,
...
]
}
}
Fields details:
hash := sha256 of the identity document.
member :=
`true`
if the identity is a member,
`false`
otherwise.
wasMember :=
`true`
if the identity has already been a member at least once in the past,
`false`
otherwise.
pubkey := public key ed25519 of the identity
uid := Human name of identity
buid := identity document creation blockstamp
sig := signature of the identity document
revocation_sig := signature of revocation document (empty string if the revocation document has not been published)
revoked :=
`true`
if the member has been revoked,
`false`
otherwise.
revoked_on := Blockstamp when identity was revoked, or
`0`
if identity has not yet been revoked.
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: *error message in string format*
}
### List of error messages
*
"Wrong param
`number`
"
*
"Wrong param
`count`
"
*
"Wrong param
`fromNumber`
"
*
"Wrong param
`minCert`
"
*
"Unknow request"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment