Consent RPC
This article will focus on how to build the serialized RPC for the consent actions. The RPC is the input to the smart contract. From a user perspective, it is the RPC that you send that will specify if you want to give or withdraw consent. A service provider can request or utilize consent from a specific user ID.
The RPC is a part of the signed transaction. If you want to see how to build the rest of the signed transaction, you can see that here.
Signed transactions are sent to the blockchain in base64 format, but in this document, the RPC is translated to hex to make it more readable. A Hex format can be converted directly to a base64 format, therefore we can use the formats interchangeable.
Give consent
The RPC to give a consent will always be the same. It is sent to the contract (consent ID) that you want to consent to, and it is the sender of the transaction, that is registered as having given the consent.
0000000100
Withdraw consent
Just like when giving consent, this RPC will at all times be this.
0000000101
Request consent
When requesting consent, we need to supply the ID of the user we want to request the consent from.
0000001602{userID}
Example: If we want to request a consent from 00cbb82f722528a63cc77abef0737ee693efecc995
the RPC
would look like this:
000000160200cbb82f722528a63cc77abef0737ee693efecc995
Utilize consent
When utilizing a consent, we need to supply the ID of the user for who's consent we want to utilize.
0000001603{userID}
Example: If we want to utilize a consent from 005b9594e9cfcbeba3f3f6662386af277d231421a1
the RPC
would look like this:
0000001603005b9594e9cfcbeba3f3f6662386af277d231421a1