当前位置: 首页>>代码示例>>Java>>正文


Java ECKey.toAddress方法代码示例

本文整理汇总了Java中org.bitcoinj.core.ECKey.toAddress方法的典型用法代码示例。如果您正苦于以下问题:Java ECKey.toAddress方法的具体用法?Java ECKey.toAddress怎么用?Java ECKey.toAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bitcoinj.core.ECKey的用法示例。


在下文中一共展示了ECKey.toAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAddressesKeys

import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
/**
 *
 * @return
 */
@Override
public Map<String, String> getAddressesKeys() {
    Map<String, String> addrKeysMap = new HashMap<>();

    List<ECKey> allWalletKeys = _coin.getWalletManager().wallet().getImportedKeys();
    allWalletKeys.addAll(_coin.getWalletManager().wallet().getIssuedReceiveKeys());

    for (ECKey k : allWalletKeys) {
        Address addr = k.toAddress(Constants.NETWORK_PARAMETERS);
        String hash = WalletUtils.formatAddress(addr, Constants.ADDRESS_FORMAT_GROUP_SIZE, Constants.ADDRESS_FORMAT_LINE_SIZE).toString();

        addrKeysMap.put(hash, k.getPrivateKeyAsHex());
    }

    return addrKeysMap;
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:21,代码来源:BitcoinManager.java

示例2: updateFragments

import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
void updateFragments() {
    final Wallet wallet = getWalletApplication().getWallet();
    final List<ECKey> derivedKeys = wallet.getIssuedReceiveKeys();
    Collections.sort(derivedKeys, DeterministicKey.CHILDNUM_ORDER);
    final List<ECKey> randomKeys = wallet.getImportedKeys();
    final ArrayList<Address> addresses = new ArrayList<Address>(derivedKeys.size() + randomKeys.size());

    for (final ECKey key : Iterables.concat(derivedKeys, randomKeys)) {
        final Address address = key.toAddress(Constants.NETWORK_PARAMETERS);
        addresses.add(address);
    }

    sendingAddressesFragment.setWalletAddresses(addresses);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:15,代码来源:AddressBookActivity.java

示例3: rowKey

import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
private View rowKey(final int position, View row) {
    final ECKey key = (ECKey) getItem(position);
    final Address address = key.toAddress(Constants.NETWORK_PARAMETERS);
    final boolean isRotateKey = wallet.isKeyRotating(key);

    if (row == null)
        row = inflater.inflate(R.layout.address_book_row, null);

    final TextView addressView = (TextView) row.findViewById(R.id.address_book_row_address);
    addressView.setText(WalletUtils.formatAddress(address, Constants.ADDRESS_FORMAT_GROUP_SIZE,
            Constants.ADDRESS_FORMAT_LINE_SIZE));
    addressView.setTextColor(isRotateKey ? colorInsignificant : colorSignificant);

    final TextView labelView = (TextView) row.findViewById(R.id.address_book_row_label);
    final String label = AddressBookProvider.resolveLabel(context, address.toBase58());
    if (label != null) {
        labelView.setText(label);
        labelView.setTextColor(isRotateKey ? colorInsignificant : colorLessSignificant);
    } else {
        labelView.setText(R.string.address_unlabeled);
        labelView.setTextColor(colorInsignificant);
    }

    final TextView messageView = (TextView) row.findViewById(R.id.address_book_row_message);
    messageView.setVisibility(isRotateKey ? View.VISIBLE : View.GONE);

    return row;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:29,代码来源:WalletAddressesAdapter.java


注:本文中的org.bitcoinj.core.ECKey.toAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。