Query Mina GraphQL API
Learn how to query the Mina GraphQL API using DataHub
You don't need any tooling or clients to communicate with Mina GraphQL API. Simply head over to DataHub service page and grab your API token, then open up GraphQL UI:
Make sure to replace the API key in the link!

Network status

We can check out the node/network status by running the following query:
1
query status {
2
daemonStatus {
3
syncStatus
4
stateHash
5
numAccounts
6
chainId
7
commitId
8
catchupStatus
9
blockchainLength
10
}
11
}
Copied!
You'll get an output like:
1
{
2
"data": {
3
"daemonStatus": {
4
"syncStatus": "SYNCED",
5
"stateHash": "3NKQhPYhJgxvzjrnGYfcYx4azdashoU4HKa5kSRoqVEh8i36o9mm",
6
"numAccounts": 1954,
7
"chainId": "5f704cc0c82e0ed70e873f0893d7e06f148524e3f0bdae2afb02e7819a0c24d1",
8
"commitId": "a8893ab6dd8a68171e7b99a5dc6b76940411350b",
9
"catchupStatus": [
10
"to_build_breadcrumb",
11
"to_initial_validate",
12
"finished",
13
"to_verify",
14
"to_download",
15
"wait_for_parent"
16
],
17
"blockchainLength": 4778
18
}
19
}
20
}
Copied!

Latest Blocks

Pull information about latest 10 blocks:
1
query blocks {
2
bestChain(maxLength: 10) {
3
stateHash
4
protocolState {
5
consensusState {
6
blockHeight
7
}
8
}
9
}
10
}
Copied!
Example output:
1
{
2
"data": {
3
"bestChain": [
4
{
5
"stateHash": "3NKVcbeedJ6tHUb9GAD7hucwK8vfupnTfa9KNpZPWAdjy18aV8AS",
6
"protocolState": {
7
"consensusState": {
8
"blockHeight": "4770"
9
}
10
}
11
},
12
{
13
"stateHash": "3NLjoNzTnTWSB1G4E2Twf9tVhqPicn3K3UsQ8NJmUmFKvpVsU7fe",
14
"protocolState": {
15
"consensusState": {
16
"blockHeight": "4771"
17
}
18
}
19
},
20
{
21
"stateHash": "3NLRbB6KPZrQmvhe4GHobWscid7CEH5B5xv33rn4gJNkjasprPRm",
22
"protocolState": {
23
"consensusState": {
24
"blockHeight": "4772"
25
}
26
}
27
},
28
{
29
"stateHash": "3NK9drYacgJJKZLuyBkd5wFuBNmqAmTWRs6sNfuB8KfMsJqQAQtW",
30
"protocolState": {
31
"consensusState": {
32
"blockHeight": "4773"
33
}
34
}
35
},
36
{
37
"stateHash": "3NKSRCsANY2hi9d1mNm15CSGfP6gFwWezzQ4eKrrChaKc3qMv4hf",
38
"protocolState": {
39
"consensusState": {
40
"blockHeight": "4774"
41
}
42
}
43
},
44
{
45
"stateHash": "3NLVTRP2YpyiFZ1rE7vuD84myiEBwQHxDLrppW48VWGdz9maH9mb",
46
"protocolState": {
47
"consensusState": {
48
"blockHeight": "4775"
49
}
50
}
51
},
52
{
53
"stateHash": "3NK8z2vszqRFdnVCoefnZN1b8RQfmyAR5aAN8pqBM7Y7gqQSGbUb",
54
"protocolState": {
55
"consensusState": {
56
"blockHeight": "4776"
57
}
58
}
59
},
60
{
61
"stateHash": "3NL5bpevCpb9UihrXDV1x3urMnWVyUrsEYqoJJtRZogXd5oUQrZU",
62
"protocolState": {
63
"consensusState": {
64
"blockHeight": "4777"
65
}
66
}
67
},
68
{
69
"stateHash": "3NKQhPYhJgxvzjrnGYfcYx4azdashoU4HKa5kSRoqVEh8i36o9mm",
70
"protocolState": {
71
"consensusState": {
72
"blockHeight": "4778"
73
}
74
}
75
},
76
{
77
"stateHash": "3NKfgwKwq3qWFFMNcr6BcAzv1BkZip3m6ADtr9htfjD6WftD3TrS",
78
"protocolState": {
79
"consensusState": {
80
"blockHeight": "4779"
81
}
82
}
83
}
84
]
85
}
86
}
Copied!

Current Block

We can obtain the latest canonical block and it's information with:
1
query block {
2
bestChain(maxLength: 1) {
3
creator
4
stateHash
5
stateHashField
6
protocolState {
7
blockchainState {
8
date
9
snarkedLedgerHash
10
}
11
previousStateHash
12
consensusState {
13
blockHeight
14
blockchainLength
15
epoch
16
slot
17
totalCurrency
18
}
19
}
20
transactions {
21
userCommands {
22
amount
23
fee
24
from
25
hash
26
}
27
coinbase
28
}
29
}
30
}
Copied!
Example output:
1
{
2
"data": {
3
"bestChain": [
4
{
5
"creator": "B62qjCuPisQjLW7YkB22BR9KieSmUZTyApftqxsAuB3U21r3vj1YnaG",
6
"stateHash": "3NKfgwKwq3qWFFMNcr6BcAzv1BkZip3m6ADtr9htfjD6WftD3TrS",
7
"stateHashField": "21538604359563529269247680765381984336006730725137316435164719777253393337427",
8
"protocolState": {
9
"blockchainState": {
10
"date": "1617151320000",
11
"snarkedLedgerHash": "jx1obrfdK5zczX6bKZ8YkezJRq1PENhCA6SYbTRCdvpgsaJbSEN"
12
},
13
"previousStateHash": "3NKQhPYhJgxvzjrnGYfcYx4azdashoU4HKa5kSRoqVEh8i36o9mm",
14
"consensusState": {
15
"blockHeight": "4779",
16
"blockchainLength": "4779",
17
"epoch": "0",
18
"slot": "6734",
19
"totalCurrency": "808566652840039233"
20
}
21
},
22
"transactions": {
23
"userCommands": [
24
{
25
"amount": "1000",
26
"fee": "10000000",
27
"from": "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4",
28
"hash": "CkpYREaq17zXtxxnLJBdnfVQ2BqjMTp3aE7CgxLk2yGwWi1WkjM7w"
29
},
30
{
31
"amount": "1000",
32
"fee": "10000000",
33
"from": "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4",
34
"hash": "CkpZKJXFdeTk6UN8EaML5CAo9KPkYWcgvtn8CGHkiYix94vqn8t8D"
35
},
36
{
37
"amount": "1000",
38
"fee": "10000000",
39
"from": "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4",
40
"hash": "CkpaLPq63CJsjtPxqfdAZFR8E9DadJ2e57GjoEpt6aq3CSLot9MP7"
41
},
42
{
43
"amount": "1000",
44
"fee": "10000000",
45
"from": "B62qre3erTHfzQckNuibViWQGyyKwZseztqrjPZBv6SQF384Rg6ESAy",
46
"hash": "Ckpa8USvMbVNANow4NGeoSfeFKfGhb1TjJNYTAFCh9dYLyKwFJoRg"
47
},
48
{
49
"amount": "1000",
50
"fee": "10000000",
51
"from": "B62qre3erTHfzQckNuibViWQGyyKwZseztqrjPZBv6SQF384Rg6ESAy",
52
"hash": "CkpZGkGQcYC4X2a7VGT2oRZGph3KSoajxnUkRz6hiHJ8MHDfY23Am"
53
},
54
{
55
"amount": "1000",
56
"fee": "10000000",
57
"from": "B62qre3erTHfzQckNuibViWQGyyKwZseztqrjPZBv6SQF384Rg6ESAy",
58
"hash": "CkpYRm7RcwgR5ivEFLWaa1vJnzdUuh9VRmrTiG83wSsLS6EarjJ8z"
59
}
60
],
61
"coinbase": "720000000000"
62
}
63
}
64
]
65
}
66
}
Copied!

Snark Pool

See a list of pending snark jobs with:
1
query snarkPool {
2
snarkPool {
3
fee
4
prover
5
workIds
6
}
7
}
Copied!
Example output:
1
{
2
"data": {
3
"snarkPool": [
4
{
5
"fee": "0",
6
"prover": "B62qpLeuZDL7PxNsCqsJwWFPAmnixi5ay8Kz9NcNGBQU8jK19VpJQaY",
7
"workIds": [
8
343409785,
9
151173040
10
]
11
}
12
]
13
}
14
}
Copied!

Account Details

We can get account balance with:
1
query accDetails {
2
account(publicKey: "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4") {
3
delegate
4
balance {
5
blockHeight
6
liquid
7
locked
8
stateHash
9
total
10
unknown
11
}
12
delegators {
13
publicKey
14
}
15
publicKey
16
stakingActive
17
votingFor
18
isDisabled
19
}
20
}
Copied!
Example output:
1
{
2
"data": {
3
"account": {
4
"delegate": "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4",
5
"balance": {
6
"blockHeight": "4779",
7
"liquid": "787133086000",
8
"locked": "0",
9
"stateHash": "3NKfgwKwq3qWFFMNcr6BcAzv1BkZip3m6ADtr9htfjD6WftD3TrS",
10
"total": "787133086000",
11
"unknown": "787133086000"
12
},
13
"delegators": [],
14
"publicKey": "B62qix9vooX5NqJYo8nT6xWqCeQu5AJoS1ng6FRnUpVAra6PAZZ1CU4",
15
"stakingActive": false,
16
"votingFor": "3NK2tkzqqK5spR2sZ7tujjqPksL45M3UUrcA4WhCkeiPtnugyE2x",
17
"isDisabled": false
18
}
19
}
20
}
Copied!