Description
At the moment, the only options for retrieving logs generated by private contracts are using prig_getLogs or private filters.
It would be nice to also offer support for subscribing to private events.
This subscription would be similar to eth_subscribe (we should name it priv_susbscribe).
Acceptance Criteria
- User can use priv_subscribe and priv_unsuibscribe to create subscriptions to private logs.
- This should only support logs subscription.
- The request to create a private logs subscription should be similar to creating a "public" log subscription. The only difference is that the privacyGroupId will be added as parameter index 0.
Definition:
# Subscribe request
{
"id": 1,
"method": "priv_subscribe",
"params": [
"<privacy_group_id>",
"logs",
<filter_parameter_object>
]
}
# Unsubscribe request
{
"id": 1,
"method": "priv_unsubscribe",
"params": [
"<privacy_group_id>",
"<subscription_id>"
]
}
# Subscription notification
{
"jsonrpc": "2.0",
"method": "priv_subscription",
"params": {
"subscription": "<subscription_id>",
"privacyGroupId": "<privacy_group_id>",
"result": <log_entry_object>
}
}
Example:
# Subscribe request
{
"id": 1,
"method": "priv_subscribe",
"params": [
"OGD/1dkDZWb9VqgDfElovjYMDAcSiRUiB6fLtFRmugU=",
"logs",
{
"address": "0x8320fe7702b96808f7bbc0d4a888ed1468216cfd",
"topics": [
"0xd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902"
]
}
]
}
# Unsubscribe request
{
"id": 1,
"method": "priv_unsubscribe",
"params": [
"OGD/1dkDZWb9VqgDfElovjYMDAcSiRUiB6fLtFRmugU=",
"0xcd0c3e8af590364c09d0fa6a1210faf5"
]
}
# Subscription notification
{
"jsonrpc": "2.0",
"method": "priv_subscription",
"params": {
"subscription": "0x1",
"privacyGroupId": "awEvxROVE0ydIgZyVFOfjvZKxaUwtOcWha/CJFHJ4Lw=",
"result": {
"logIndex": "0x0",
"removed": false,
"blockNumber": "0x2de",
"blockHash": "0xe4657882a821af048bafbe64a6a0d40e61229c2ad1ef70bc9627e3adf0c941f7",
"transactionHash": "0xd3e7c320a3d3a8a28fa722611b12c52452dc1ed9e6b0400f7421628f1360b064",
"transactionIndex": "0x0",
"address": "0xd9104a5e123c0a026e35eaf7b500bd026921dbde",
"data": "0x",
"topics": [
"0x85bea11d86cefb165374e0f727bacf21dc2f4ea816493981ecf72dcfb212a410",
"0x0000000000000000000000000000000000000000000000000000000000000002"
]
}
}
}
Description
At the moment, the only options for retrieving logs generated by private contracts are using prig_getLogs or private filters.
It would be nice to also offer support for subscribing to private events.
This subscription would be similar to eth_subscribe (we should name it priv_susbscribe).
Acceptance Criteria
Definition:
Example: