Skip to main content

dRNG API Methods

The dRNG APIs provide methods to retrieve basic info about dRNG committees and randomness as well as to broadcast collective randomness beacon.

HTTP APIs:

Client lib APIs:

/drng/collectiveBeacon

Method: POST

Sends the given collective beacon (payload) by creating a message in the backend.

Parameters

Parameterpayload
Required or Optionalrequired
Descriptioncollective beacon payload
Typebase64 serialized bytes

Body

{
"payload": "collectiveBeaconBytes"
}

Examples

cURL

curl --location --request POST 'http://localhost:8080/drng/collectiveBeacon' \
--header 'Content-Type: application/json' \
--data-raw '{"payload": "collectiveBeaconBytes"}'

Client lib - BroadcastCollectiveBeacon

Collective beacon can be broadcast using BroadcastCollectiveBeacon(payload []byte) (string, error).

msgId, err := goshimAPI.BroadcastCollectiveBeacon(payload)
if err != nil {
// return error
}

Response example

{
"id": "messageID"
}

Results

Return fieldTypeDescription
idstringMessage ID of beacon message. Omitted if error.
errorstringError message. Omitted if success.

/drng/info/committee

Returns the current dRNG committee used.

Parameters

None.

Examples

cURL

curl http://localhost:8080/drng/info/committee

Client lib - GetCommittee

Available committees can be retrieved using GetCommittee() (*jsonmodels.CommitteeResponse, error).

committees, err := goshimAPI.GetCommittee()
if err != nil {
// return error
}

// list committees
for _, m := range committees.Committees {
fmt.Println("committee ID: ", m.InstanceID, "distributed PK:", m.DistributedPK)
}

Response example

{
"committees": [
{
"instanceID": 1,
"threshold": 3,
"identities": [
"AheLpbhRs1XZsRF8t8VBwuyQh9mqPHXQvthV5rsHytDG",
"FZ28bSTidszUBn8TTCAT9X1nVMwFNnoYBmZ1xfafez2z",
"GT3UxryW4rA9RN9ojnMGmZgE2wP7psagQxgVdA4B9L1P",
"4pB5boPvvk2o5MbMySDhqsmC2CtUdXyotPPEpb7YQPD7",
"64wCsTZpmKjRVHtBKXiFojw7uw3GszumfvC4kHdWsHga"
],
"distributedPK": "884bc65f1d023d84e2bd2e794320dc29600290ca7c83fefb2455dae2a07f2ae4f969f39de6b67b8005e3a328bb0196de"
}
]
}

Results

Return fieldTypeDescription
committees[]CommitteeA list of DRNG committees.
errorstringError message. Omitted if success.
  • Type Committee
fieldTypeDescription
instanceIDstringThe identifier of the dRAND instance.
thresholdstringThe threshold of the secret sharing protocol.
identitiesfloat64The nodes' identities of the committee members.
distributedPKstringDistributed Public Key of the committee

/drng/info/randomness

Returns the current DRNG randomness used.

Parameters

None.

Examples

cURL

curl http://localhost:8080/drng/info/randomness

client lib - GetRandomness

Current randomness from known committees can be retrieved using GetRandomness() (*jsonmodels.RandomnessResponse, error).

randomness, err := goshimAPI.GetRandomness()
if err != nil {
// return error
}

// list randomness
for _, m := range randomness.Randomness {
fmt.Println("committee ID: ", m.InstanceID, "Randomness:", m.Randomness)
}

Response example

{
"randomness": [
{
"instanceID": 1,
"round": 2461530,
"timestamp": "2021-05-24T18:06:20.394849622+02:00",
"randomness": "Kr5buSEtgLuPxZrax0HfoiougcOXS/75JOBu2Ld6peO77qdKiNyjDueXQZlPE0UCTKkVhehEvfIXhESK9DF3aQ=="
}
]
}

Results

Return fieldTypeDescription
randomness[]RandomnessList of randomness
errorstringError message. Omitted if success.
  • Type Randomness
fieldTypeDescription
instanceIDuint32The identifier of the dRAND instance.
rounduint64The current DRNG round.
timestamptime.TimeThe timestamp of the current randomness message
randomness[]byteThe current randomness as a slice of bytes