Connections
Connections API is used to query fields of connections between a given address and another address or a list of other addresses (5000 max).
You can find the step by step instructions on how to set up GraphQL client in your application and write a simple Get Connection query in the Read Connections section.
Structure
The general pattern of connection
query is:
connections(fromAddr: String!, toAddrList: [String!]!, network: Network) [Connection!]!
Field | Type | Description | Required/Optional |
---|---|---|---|
fromAddr | String! | The source address that you want to query connections about | Required |
toAddrList | [String!]! | A string list of addresses that you want to check if they have connections with fromAddr | Required |
network | Network | The blockchain network of the address you are querying about | Optional. Default value is ETH . |
With correct inputs, you will get a list of Connection
objects, consisting of the following fields:
Field | Type | Description |
---|---|---|
fromAddr | String | The source address that you want to query connections about |
toAddr | String | An address that is given in toAddrList |
followStatus | FollowStatus | The following and followed relationships between fromAddr and toAddr |
namespace | String | The namespace of this connection |
alias | String | The alias set by the fromAddress for toAddr . |
network | Network | The network that is given as the querying parameter |
createdAt | String | The creation time of this connection |
updatedAt | String | The latest update time of this connection |
latestEvent | ConnectionEvent | The latest event of this connection including the proof. Please see Proof of Connection for detail design and implementation. |
latestAnchorEvent | ConnectionEvent | The latest event of this connection which can be found on Arweave |
For followStatus
, there will be two boolean variables: isFollowed
and isFollowing
.
If isFollowed
is true, toAddr
has followed fromAddr
.
If isFollowing
is true, fromAddr
has followed toAddr
.
Examples
Fetch Proof Example
This is an example of a query to fetch proof
data that you can also test out in the Playground.
With arweaveTxHash
you can query it on Arweave to proof the connection.
- Query
- Response
query ProofQuery {
connections(fromAddr: "jiayi92.eth", toAddrList: ["cyberlab.eth"]) {
fromAddr
toAddr
latestEvent {
...event
}
latestAnchorEvent {
...event
}
}
}
fragment event on ConnectionEvent {
hash
parentHash
fromAddr
toAddr
network
namespace
createdAt
isAnchor
proof {
content
digest
signature
signingKey
signingKeyAuth {
message
signature
address
}
arweaveTxHash
}
}
{
"data": {
"connections": [
{
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"latestEvent": {
"hash": "0xf5b17780eea3c4131aec0ce903500fc8c0f36e925c0db6e2bae643bf20bc6c7e",
"parentHash": "0xfde6d16bcf9981612a356a9464a3c3546c2960c67fb3be3d9cb641634a75168d",
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"network": "ETH",
"namespace": "CyberConnect",
"createdAt": "2022-06-14T17:39:26Z",
"isAnchor": false,
"proof": {
"content": "{\"name\":\"follow\",\"from\":\"0x9dd481d6c1656816bfd564151e29d57e041d2c8f\",\"to\":\"0x148d59faf10b52063071eddf4aaf63a395f2d41c\",\"namespace\":\"CyberConnect\",\"network\":\"ETH\",\"alias\":\"\",\"timestamp\":1655228365995}",
"digest": "0x6fc5a86ecf3a579c2db0753e0ab5bbb58f4239572f67d40eff1c5a70bb426ffe",
"signature": "0x5edad7a53ba156a07d67cf0e27214cab6199d39e742183038e109e31f9a7a0226e5c03440c1b6a197f7109ff620e584f167f5f7656dbfc519b8219a348fbd755",
"signingKey": "SubjectPublicKeyInfo:MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErdNg/pAoMZ3U75Jksul0mQZ9nr/JdZ3DnpRU3z++4ryIq5HPTL3RHHkjReGUbL6Wg+hRe2MpDH9dBMV/Xxtxbg==",
"signingKeyAuth": {
"message": "I authorize CyberConnect from this device using signing key:\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErdNg/pAoMZ3U75Jksul0mQZ9nr/JdZ3DnpRU3z++4ryIq5HPTL3RHHkjReGUbL6Wg+hRe2MpDH9dBMV/Xxtxbg==",
"signature": "0xce8462674766b80f53d7b08b971b543ea2e7fc204ca62a986911c307f7147e6815dc0402b6b097eb04d8db53418c1f472bf6ce543286af87e44b449ac9ad9d1e1c",
"address": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f"
},
"arweaveTxHash": ""
}
},
"latestAnchorEvent": {
"hash": "0x630a18ca043271c78b16087e4c6dd853794aad0118cb1e2fc74ac0cdb0002dc9",
"parentHash": "0xd98417073a9d51e8b789122b5a4be7bbe860b06bcb37dbd1ba5150242f4aee2b",
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"network": "ETH",
"namespace": "Nifty-canvas",
"createdAt": "2022-06-02T02:46:44Z",
"isAnchor": true,
"proof": {
"content": "{\"name\":\"follow\",\"from\":\"0x9dd481d6c1656816bfd564151e29d57e041d2c8f\",\"to\":\"0x148d59faf10b52063071eddf4aaf63a395f2d41c\",\"namespace\":\"Nifty-canvas\",\"network\":\"ETH\",\"timestamp\":1654138003884,\"alias\":\"\"}",
"digest": "0x4ef9ed6a3dfd5d2145e8cb4e2e2e924483ccf4204e188206ef41d6d5600ecd58",
"signature": "0x510709f49a87637f9791f96ab55ba28d899171707316dcb41fa4da2f1105489ef7f63bd1126b45aec4974b1a7ba51f23bae14c74b63d2bc9e4cdecb8640e7638",
"signingKey": "SubjectPublicKeyInfo:MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdIkW7Se8/JGRlOOA7q8McUuaTw5wK4lIQplqEALXX4bKzSmRPGxmgAlPwXeraLqiVVDOlCpEnmmHNFFjsvJpjA==",
"signingKeyAuth": {
"message": "I authorize CyberConnect from this device using signing key:\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdIkW7Se8/JGRlOOA7q8McUuaTw5wK4lIQplqEALXX4bKzSmRPGxmgAlPwXeraLqiVVDOlCpEnmmHNFFjsvJpjA==",
"signature": "0xb8b6e8335b647ca6b5fbc83b187ebe9fb7f9670e0c0a5d3392b4226fb969614b5487a1fe7e4856fa4f039fea0c155f9d8a729e8d2c93f446ed3cc83c9e7cc1ac1b",
"address": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f"
},
"arweaveTxHash": "tRU4wwCeaACzm3Tub1JZ_7sh-dY7udt6polRti7oUlw"
}
}
}
]
}
}
Fetch followStatus Example
This is an example of a query to fetch the followStatus
that you can also test out in the Playground:
- Query
- Response
query FollowStatusQuery {
connections(
fromAddr: "51je9UThqqhcZbVgY9kZgASthAVCafgqNGDaW3vpyXrr"
toAddrList: ["EPBtp2MmAM68CBnt8KBCMoKzwpQtQ486hWehDhGrtKi8"]
network: SOLANA
) {
fromAddr
toAddr
followStatus {
isFollowed
isFollowing
}
}
}
{
"data": {
"connections": [
{
"fromAddr": "51je9UThqqhcZbVgY9kZgASthAVCafgqNGDaW3vpyXrr",
"toAddr": "EPBtp2MmAM68CBnt8KBCMoKzwpQtQ486hWehDhGrtKi8",
"followStatus": {
"isFollowed": false,
"isFollowing": true
}
}
]
}
}
Full Example
This is a full example for the Connections query that you can also test out in the Playground:
- Query
- Response
query ConnectionsQuery {
connections(fromAddr: "jiayi92.eth", toAddrList: ["cyberlab.eth"]) {
fromAddr
toAddr
followStatus {
isFollowed
isFollowing
}
namespace
alias
network
createdAt
updatedAt
latestEvent {
...event
}
latestAnchorEvent {
...event
}
}
}
fragment event on ConnectionEvent {
hash
parentHash
fromAddr
toAddr
network
namespace
createdAt
isAnchor
proof {
content
digest
signature
signingKey
signingKeyAuth {
message
signature
address
}
arweaveTxHash
}
}
{
"data": {
"connections": [
{
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"followStatus": {
"isFollowed": false,
"isFollowing": true
},
"namespace": "CyberConnect",
"alias": "",
"network": "ETH",
"createdAt": "2021-12-10T23:40:43Z",
"updatedAt": "2022-06-14T17:39:26Z",
"latestEvent": {
"hash": "0xf5b17780eea3c4131aec0ce903500fc8c0f36e925c0db6e2bae643bf20bc6c7e",
"parentHash": "0xfde6d16bcf9981612a356a9464a3c3546c2960c67fb3be3d9cb641634a75168d",
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"network": "ETH",
"namespace": "CyberConnect",
"createdAt": "2022-06-14T17:39:26Z",
"isAnchor": false,
"proof": {
"content": "{\"name\":\"follow\",\"from\":\"0x9dd481d6c1656816bfd564151e29d57e041d2c8f\",\"to\":\"0x148d59faf10b52063071eddf4aaf63a395f2d41c\",\"namespace\":\"CyberConnect\",\"network\":\"ETH\",\"alias\":\"\",\"timestamp\":1655228365995}",
"digest": "0x6fc5a86ecf3a579c2db0753e0ab5bbb58f4239572f67d40eff1c5a70bb426ffe",
"signature": "0x5edad7a53ba156a07d67cf0e27214cab6199d39e742183038e109e31f9a7a0226e5c03440c1b6a197f7109ff620e584f167f5f7656dbfc519b8219a348fbd755",
"signingKey": "SubjectPublicKeyInfo:MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErdNg/pAoMZ3U75Jksul0mQZ9nr/JdZ3DnpRU3z++4ryIq5HPTL3RHHkjReGUbL6Wg+hRe2MpDH9dBMV/Xxtxbg==",
"signingKeyAuth": {
"message": "I authorize CyberConnect from this device using signing key:\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErdNg/pAoMZ3U75Jksul0mQZ9nr/JdZ3DnpRU3z++4ryIq5HPTL3RHHkjReGUbL6Wg+hRe2MpDH9dBMV/Xxtxbg==",
"signature": "0xce8462674766b80f53d7b08b971b543ea2e7fc204ca62a986911c307f7147e6815dc0402b6b097eb04d8db53418c1f472bf6ce543286af87e44b449ac9ad9d1e1c",
"address": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f"
},
"arweaveTxHash": ""
}
},
"latestAnchorEvent": {
"hash": "0x630a18ca043271c78b16087e4c6dd853794aad0118cb1e2fc74ac0cdb0002dc9",
"parentHash": "0xd98417073a9d51e8b789122b5a4be7bbe860b06bcb37dbd1ba5150242f4aee2b",
"fromAddr": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f",
"toAddr": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"network": "ETH",
"namespace": "Nifty-canvas",
"createdAt": "2022-06-02T02:46:44Z",
"isAnchor": true,
"proof": {
"content": "{\"name\":\"follow\",\"from\":\"0x9dd481d6c1656816bfd564151e29d57e041d2c8f\",\"to\":\"0x148d59faf10b52063071eddf4aaf63a395f2d41c\",\"namespace\":\"Nifty-canvas\",\"network\":\"ETH\",\"timestamp\":1654138003884,\"alias\":\"\"}",
"digest": "0x4ef9ed6a3dfd5d2145e8cb4e2e2e924483ccf4204e188206ef41d6d5600ecd58",
"signature": "0x510709f49a87637f9791f96ab55ba28d899171707316dcb41fa4da2f1105489ef7f63bd1126b45aec4974b1a7ba51f23bae14c74b63d2bc9e4cdecb8640e7638",
"signingKey": "SubjectPublicKeyInfo:MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdIkW7Se8/JGRlOOA7q8McUuaTw5wK4lIQplqEALXX4bKzSmRPGxmgAlPwXeraLqiVVDOlCpEnmmHNFFjsvJpjA==",
"signingKeyAuth": {
"message": "I authorize CyberConnect from this device using signing key:\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdIkW7Se8/JGRlOOA7q8McUuaTw5wK4lIQplqEALXX4bKzSmRPGxmgAlPwXeraLqiVVDOlCpEnmmHNFFjsvJpjA==",
"signature": "0xb8b6e8335b647ca6b5fbc83b187ebe9fb7f9670e0c0a5d3392b4226fb969614b5487a1fe7e4856fa4f039fea0c155f9d8a729e8d2c93f446ed3cc83c9e7cc1ac1b",
"address": "0x9dd481d6c1656816bfd564151e29d57e041d2c8f"
},
"arweaveTxHash": "tRU4wwCeaACzm3Tub1JZ_7sh-dY7udt6polRti7oUlw"
}
}
}
]
}
}