GetBlock()

Retrieving a blockchain block is not a transaction; it's simply a request executed by a single node. Sometimes, it might be necessary to send the same request multiple times to obtain the right copy

Method Signature

func GetBlock(blockchain string, number int) map[string]interface{}

Parameters

Name
Type
Description

blockchain

String

Blockchain address in hex

blockNumber

int

The number of the block you're looking for

Example

package main

import (
	"fmt"

	"github.com/circular-protocol/circular-go/circular_protocol_api"
)

func main() {
	var blockchain = "0x8a20baa40c45dc5055aeb26197c203e576ef389d9acb171bd62da11dc5ad72b2"

	result := circular_protocol_api.GetBlock(blockchain, 2)
	fmt.Println(result)
}

Result

The result will be of type Map, but for easier readability, here is the equivalent in JSON.

Last updated