2019-12-20 06:41:46 +00:00
|
|
|
from eth2spec.utils import bls
|
2019-05-15 17:31:02 +00:00
|
|
|
|
|
|
|
|
2019-05-30 20:57:18 +00:00
|
|
|
def sign_block_header(spec, state, header, privkey):
|
|
|
|
domain = spec.get_domain(
|
2019-05-15 17:31:02 +00:00
|
|
|
state=state,
|
|
|
|
domain_type=spec.DOMAIN_BEACON_PROPOSER,
|
|
|
|
)
|
2020-01-07 12:07:09 +00:00
|
|
|
signing_root = spec.compute_signing_root(header, domain)
|
|
|
|
signature = bls.Sign(privkey, signing_root)
|
2019-12-17 10:04:56 +00:00
|
|
|
return spec.SignedBeaconBlockHeader(message=header, signature=signature)
|