code: func (e *Envelope) Seal(options *MessageParams) error {
  	if options.PoW == 0 {
  		// PoW is not required
  		return nil
  	}
  
  	var target, bestLeadingZeros int
  	if options.PoW < 0 {
  		// target is not set - the function should run for a period
  		// of time specified in WorkTime param. Since we can predict
  		// the execution time, we can also adjust Expiry.
  		e.Expiry += options.WorkTime
  	} else {
  		target = e.powToFirstBit(options.PoW)
  	}
  
  	buf := make([]byte, 64)
  	h := crypto.Keccak256(e.rlpWithoutNonce())
  	copy(buf[:32], h)
  
  	finish := time.Now().Add(time.Duration(options.WorkTime) * time.Second).UnixNano()
  	for nonce := uint64(0); time.Now().UnixNano() < finish; {
  		for i := 0; i < 1024; i++ {
  			binary.BigEndian.PutUint64(buf[56:], nonce)
  			d := new(big.Int).SetBytes(crypto.Keccak256(buf))
  			leadingZeros := 256 - d.BitLen()
  			if leadingZeros > bestLeadingZeros {
  				e.Nonce, bestLeadingZeros = nonce, leadingZeros
  				if target > 0 && bestLeadingZeros >= target {
  					return nil
  				}
  			}
  			nonce++
  		}
  	}
  
  	if target > 0 && bestLeadingZeros < target {
  		return fmt.Errorf("failed to reach the PoW target, specified pow time (%d seconds) was insufficient", options.WorkTime)
  	}
  
  	return nil
  }
docs: // Seal closes the envelope by spending the requested amount of time as a proof
  // of work on hashing the data.