Java Code Examples for org.bitcoinj.script.ScriptBuilder#createRedeemScript()

The following examples show how to use org.bitcoinj.script.ScriptBuilder#createRedeemScript() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarriedKeyChain.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a new married key and return the matching output script
 */
@Override
public Script freshOutputScript(KeyPurpose purpose) {
    DeterministicKey followedKey = getKey(purpose);
    ImmutableList.Builder<ECKey> keys = ImmutableList.<ECKey>builder().add(followedKey);
    for (DeterministicKeyChain keyChain : followingKeyChains) {
        DeterministicKey followingKey = keyChain.getKey(purpose);
        checkState(followedKey.getChildNumber().equals(followingKey.getChildNumber()), "Following keychains should be in sync");
        keys.add(followingKey);
    }
    List<ECKey> marriedKeys = keys.build();
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return ScriptBuilder.createP2SHOutputScript(redeemScript);
}
 
Example 2
Source File: MarriedKeyChain.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the redeem data for a key in this married chain
 */
@Override
public RedeemData getRedeemData(DeterministicKey followedKey) {
    List<ECKey> marriedKeys = getMarriedKeysWithFollowed(followedKey);
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return RedeemData.of(marriedKeys, redeemScript);
}
 
Example 3
Source File: MarriedKeyChain.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
/** Create a new married key and return the matching output script */
@Override
public Script freshOutputScript(KeyPurpose purpose) {
    DeterministicKey followedKey = getKey(purpose);
    ImmutableList.Builder<ECKey> keys = ImmutableList.<ECKey>builder().add(followedKey);
    for (DeterministicKeyChain keyChain : followingKeyChains) {
        DeterministicKey followingKey = keyChain.getKey(purpose);
        checkState(followedKey.getChildNumber().equals(followingKey.getChildNumber()), "Following keychains should be in sync");
        keys.add(followingKey);
    }
    List<ECKey> marriedKeys = keys.build();
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return ScriptBuilder.createP2SHOutputScript(redeemScript);
}
 
Example 4
Source File: MarriedKeyChain.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
/** Get the redeem data for a key in this married chain */
@Override
public RedeemData getRedeemData(DeterministicKey followedKey) {
    List<ECKey> marriedKeys = getMarriedKeysWithFollowed(followedKey);
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return RedeemData.of(marriedKeys, redeemScript);
}
 
Example 5
Source File: MarriedKeyChain.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
/** Create a new married key and return the matching output script */
@Override
public Script freshOutputScript(KeyPurpose purpose) {
    DeterministicKey followedKey = getKey(purpose);
    ImmutableList.Builder<ECKey> keys = ImmutableList.<ECKey>builder().add(followedKey);
    for (DeterministicKeyChain keyChain : followingKeyChains) {
        DeterministicKey followingKey = keyChain.getKey(purpose);
        checkState(followedKey.getChildNumber().equals(followingKey.getChildNumber()), "Following keychains should be in sync");
        keys.add(followingKey);
    }
    List<ECKey> marriedKeys = keys.build();
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return ScriptBuilder.createP2SHOutputScript(redeemScript);
}
 
Example 6
Source File: MarriedKeyChain.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
/** Get the redeem data for a key in this married chain */
@Override
public RedeemData getRedeemData(DeterministicKey followedKey) {
    List<ECKey> marriedKeys = getMarriedKeysWithFollowed(followedKey);
    Script redeemScript = ScriptBuilder.createRedeemScript(sigsRequiredToSpend, marriedKeys);
    return RedeemData.of(marriedKeys, redeemScript);
}