how to get the bid ( id from multi-instances of block )? is it possible to get and render the bid from a plugin block class build method ?

class HalPublicationBlock extends BlockBase implements BlockPluginInterface
{

  /**
   * {@inheritdoc}
   */
  public function build()
  {
        //do contain id but not bid 
        $config = $this-&gt;getConfiguration();
        //$bid=$this-&gt;get-&gt;?


EDIT : i'd like to pass the bid (or values that will be used by drupal as block css indentifier) to JS object and or twig templates , along with the same bloc instance configuration values
You receive the block id via a form value in the blockSubmit function, so if you save it as configuration, you can use it in the build() function. Seems a bit weird to save the block id as another config value, but otherwise you can't access it. Also note that it is possible to use a block plugin without an actual block entity, see https://drupal.stackexchange.com/a/181458/11500

/**
 * {@inheritdoc}
 */
public function blockSubmit($form, FormStateInterface $form_state) {
  $block_id = $form['id']['#default_value'];
  $this-&gt;configuration['block_class'] = $block_id;
}


You should probably add it to the BlockBase::defaultConfiguration() function as well. Because this changes the configuration, you will have to save the blocks manually once (to activate the change).