本文整理汇总了Java中org.bitcoinj.core.ECKey.getPubKey方法的典型用法代码示例。如果您正苦于以下问题:Java ECKey.getPubKey方法的具体用法?Java ECKey.getPubKey怎么用?Java ECKey.getPubKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bitcoinj.core.ECKey
的用法示例。
在下文中一共展示了ECKey.getPubKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CLTVScriptPair
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
CLTVScriptPair(ECKey newPsynymKey, long expireDate) {
ScriptBuilder sb = new ScriptBuilder();
//the part that freezes the tx output, special 5 byte number
sb.data(encodeExpireDate(expireDate));
//sb.smallNum(num)
sb.op(ScriptOpCodes.OP_CHECKLOCKTIMEVERIFY);
sb.op(ScriptOpCodes.OP_DROP);
//standard p2pkh part
sb.op(ScriptOpCodes.OP_DUP);
sb.op(ScriptOpCodes.OP_HASH160);
sb.data(newPsynymKey.getPubKeyHash());
sb.op(ScriptOpCodes.OP_EQUALVERIFY);
sb.op(ScriptOpCodes.OP_CHECKSIG);
this.redeemScript = sb.build();
System.out.println("cltvscripiar yielded a locktime of " + new Date(getLockTime()*1000));
assert(expireDate == getLockTime());
this.pubKeyScript = ScriptBuilder.createP2SHOutputScript(redeemScript);
this.pubkeyHash = newPsynymKey.getPubKeyHash();
this.pubkey = newPsynymKey.getPubKey();
}
示例2: getKeys
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
public Keys getKeys() {
ECKey key = new ECKey();
byte[] address = key.getPubKey();
String addressAsString = key.toAddress(getNetworkParameters()).toString();
byte[] privateKey = key.getPrivKeyBytes();
String addressAsStringWithPrivate = key.toStringWithPrivate(getNetworkParameters()).toString();
return new Keys()
.setAddress(address)
.setAddressAsString(addressAsString)
.setPrivateKey(privateKey)
.setAddressAsStringWithPrivate(addressAsStringWithPrivate);
}
示例3: createInputScript
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
/**
* Creates a scriptSig that can redeem a pay-to-address output.
* If given signature is null, incomplete scriptSig will be created with OP_0 instead of signature
*/
public static Script createInputScript(@Nullable TransactionSignature signature, ECKey pubKey) {
byte[] pubkeyBytes = pubKey.getPubKey();
byte[] sigBytes = signature != null ? signature.encodeToBitcoin() : new byte[]{};
return new ScriptBuilder().data(sigBytes).data(pubkeyBytes).build();
}