hyperledger/fabric-sdk-go

How to calculate the block size ?

s-nadesh opened this issue · 2 comments

One block can have multiple transactions. So i want to calculate the size of the block.

Is it possible ? Kindly guide me.

Thank you !!

I think it's a viable solution

		block ,err := ledgerClient.QueryBlock(uint64(0))
		if err != nil{
			fmt.Println(err)
		}
		buf := new (bytes.Buffer)
		err = protolator.DeepMarshalJSON(buf, block)
		fmt.Println(len(buf.Bytes()))

more detail you can refer https://github.com/iamlzw/fabric-sdk-go-samples/blob/master/setup.go queryLedger function.

Okay Thank you . I will check this.