# Sync committee API proposal
## GET /eth/v1/beacon/states/_{state_id}_/sync_committees
Obtain the sync committee for the given state ID.
### Parameters
- epoch (query, string, optional) fetch sync committees for the given epoch. If not present then the sync committees for the epoch of the state will be obtained
### Returns
```
{
"data": {
"validators": [
1,
2,
3,
4,
5,
6,
7,
8
],
"aggregate_validators": [
[
1,
2,
3,
4,
],
[
5,
6,
7,
8,
]
]
}
}
```
### Open questions
- do we need to return `aggregate_validators`? This is a simple set of slices of `validators` so seems to be overkill, but reflects more closely the spec data structure.
## POST /eth/v1/validator/duties/sync/_{epoch}_
Obtain the sync committee duties for the provided validators.
### Parameters
- validators (body,string array) an array of the validator indices for which to obtain the duties.
### Returns
```
{
"dependent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"data": [
{
"pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
"validator_index": "1",
"sync_committee_index": "2",
}
]
}
```
### Notes
- although pubkey can be inferred from the index we return it to keep this call analogous with the one that fetches attester duties
- `sync_committee_index` is the index of the validator in the sync committee. This can be used to infer the subnet to which the contribution should be broadcast
## GET /eth/v1/validator/sync_committee_contribution
Aggregates all sync comittee signatures matching given beacon block root.
## POST /eth/v1/beacon/pool/sync_committees
Submit sync committee signatures to node.
### Body
```
[
{
"slot": 1,
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"validator_index": "1",
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
}
]
```
## POST /eth/v1/validator/sync_committee_subscriptions
Signal beacon node to prepare a sync committee subnet.
### Body
```
[
{
"validator_index": "1",
"sync_committee_index": "2",
"is_aggregator": true
}
]
```
### Notes
- we do not send the actual subnet to which we want to subscribe. This can be calculated by the beacon node given `sync_committee_index`
## GET /eth/v1/validator/sync_committee_contribution
Request a sync committee contribution.
### Parameters
- slot (query, string, required) the slot for which to fetch the contribution
- subcommittee_index (query, string, required) the subcommittee index for which to fetch the contribution
- beacon_block_root (query, string, required) the beacon block root for which to fetch the contribution
### Returns
```
{
"data": {
"slot": 1,
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"subcommittee_index": "3",
"aggregation_bits": "0x01"
}
}
```
## POST /eth/v1/validator/contribution_and_proofs
Publish multiple contribution and proofs.
### Body
```
[
{
"message": {
"aggregator_index": "1",
"contribution": {
"slot": 1,
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"subcommittee_index": "3",
"aggregation_bits": "0x01",
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
},
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
},
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
}
]
```