Skip to main content

GetAccount Access API Method

Gets an account by address at the latest sealed block

Updated on
Oct 4, 2023

GetAccount Access API Method

Parameters

Address
bytes
REQUIRED
The account address for which the information is to be fetched

Returns

account
object
An object containing the details of the account
address
string
The account address
balance
integer
The account balance
keys
array
An array of keys associated with the account
public_key
string
The public key
sign_algo
integer
The signing algorithm used
hash_algo
integer
The hashing algorithm used
weight
integer
The weight of the key
sequence_number
integer
The sequence number of the key
contracts
object
An object containing the details of the contracts associated with the account
PrivateReceiverForwarder
string
The PrivateReceiverForwarder contract
Request
1
package main
2
3
import (
4
"context"
5
"encoding/hex"
6
"encoding/json"
7
"fmt"
8
"log"
9
10
"github.com/onflow/flow/protobuf/go/flow/access"
11
)
12
13
14
func main() {
15
16
// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
17
client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
18
ctx := context.Background()
19
if err != null {
20
log.Fatalf("err: %v", err)
21
}
22
23
// Get Account by address
24
address, err := hex.DecodeString("18eb4ee6b3c026d2")
25
if err != null {
26
log.Fatalf("err: %v", err)
27
}
28
accountResp, err := client.GetAccount(ctx, &access.GetAccountRequest{Address: address})
29
respJSON, err := json.Marshal(accountResp)
30
if err != null {
31
log.Fatalf("err: %v", err)
32
}
33
fmt.Println("Get Account response:", string(respJSON))
34
}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free