本文整理汇总了Java中com.google.bitcoin.core.ECKey.getPubKey方法的典型用法代码示例。如果您正苦于以下问题:Java ECKey.getPubKey方法的具体用法?Java ECKey.getPubKey怎么用?Java ECKey.getPubKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.bitcoin.core.ECKey
的用法示例。
在下文中一共展示了ECKey.getPubKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HDAddress
import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
public HDAddress(NetworkParameters params,
DeterministicKey chainKey,
JSONObject addrNode)
throws RuntimeException, JSONException {
mParams = params;
mAddrNum = addrNode.getInt("addrNum");
mPath = addrNode.getString("path");
// Derive ECKey.
byte[] prvBytes = null;
try {
mPubBytes = Base58.decode(addrNode.getString("pubBytes"));
} catch (AddressFormatException ex) {
throw new RuntimeException("failed to decode pubBytes");
}
mECKey = new ECKey(prvBytes, mPubBytes);
// Set creation time to BTCReceive epoch.
mECKey.setCreationTimeSeconds(EPOCH);
// Derive public key, public hash and address.
mPubKey = mECKey.getPubKey();
mPubKeyHash = mECKey.getPubKeyHash();
mAddress = mECKey.toAddress(mParams);
// Initialize transaction count and balance. If we don't have
// a persisted available amount, presume it is all available.
mNumTrans = addrNode.getInt("numTrans");
mBalance = addrNode.getLong("balance");
mAvailable = addrNode.has("available") ?
addrNode.getLong("available") : mBalance;
mLogger.info("read address " + mPath + ": " + mAddress.toString());
}
示例2: createInputScript
import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/** Creates a scriptSig that can redeem a pay-to-address output. */
public static Script createInputScript(TransactionSignature signature, ECKey pubKey) {
byte[] pubkeyBytes = pubKey.getPubKey();
return new ScriptBuilder().data(signature.encodeToBitcoin()).data(pubkeyBytes).build();
}