Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to calculate the block size ? #241

Open
s-nadesh opened this issue Jul 18, 2022 · 2 comments
Open

How to calculate the block size ? #241

s-nadesh opened this issue Jul 18, 2022 · 2 comments

Comments

@s-nadesh
Copy link

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

Is it possible ? Kindly guide me.

Thank you !!

@iamlzw
Copy link

iamlzw commented Feb 8, 2023

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.

@s-nadesh
Copy link
Author

s-nadesh commented Feb 9, 2023

Okay Thank you . I will check this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants