Yes, It is viewScript and i am currently doing something like below in render.php
but it is not ideal for large amount of attributes.
<div <?php echo get_block_wrapper_attributes(); ?> data-attributes='<?php echo json_encode($attributes); ?>'></div>
as for another approach there is something like below but it would not work properly for multiple blocks
<script type="application/json" id="block-attributes-json">
<?php echo json_encode($attributes); ?>
</script>
I want some solution like i can pass some id and then fetch attributes using that id but using clientId is not ideal as whenever i load the edit screen clientId is going to be changed everytime.