@Override
    public DeterministicKeyChain toEncrypted(CharSequence password) {
        Objects.requireNonNull(password);
        checkArgument(password.length() > 0);
        checkState(seed != null, () ->
                "attempt to encrypt a watching chain");
        checkState(!seed.isEncrypted());
        KeyCrypter scrypt = new KeyCrypterScrypt();
        AesKey derivedKey = scrypt.deriveKey(password);
        return toEncrypted(scrypt, derivedKey);
    }
@Test(expected = IllegalStateException.class)
    public void encryptTwice() {
        chain = chain.toEncrypted("once");
        chain = chain.toEncrypted("twice");
    }