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


Java TransactionOutput.getScriptBytes方法代码示例

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


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

示例1: isEWMessage

import org.bitcoinj.core.TransactionOutput; //导入方法依赖的package包/类
public static boolean isEWMessage(Transaction tx) {
    List<TransactionOutput> outputs = tx.getOutputs();
    for (TransactionOutput out : outputs) {
        byte[] scriptBytes = out.getScriptBytes();
        if(scriptBytes.length>0) {
            String hexString = Hex.toHexString(scriptBytes);
            if(hexString.startsWith("6a")) {
                hexString=hexString.substring(2);
                if( hexString.startsWith("455720") || hexString.substring(2).startsWith("455720") ) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:17,代码来源:EWWalletService.java

示例2: isTransactionBroadcastAnnouncement

import org.bitcoinj.core.TransactionOutput; //导入方法依赖的package包/类
public boolean isTransactionBroadcastAnnouncement(Transaction tx) {
	List<TransactionOutput> outputs = tx.getOutputs();
	TransactionOutput scndOutput = outputs.get(1);
	if(!scndOutput.getScriptPubKey().isOpReturn()) {
		return false;
	}
	
	byte[] script = scndOutput.getScriptBytes();
	//check magic numbers that are defined in BroadcastAnnouncement
	return BroadcastAnnouncement.isBroadcastAnnouncementScript(script);
}
 
开发者ID:kit-tm,项目名称:bitnym,代码行数:12,代码来源:MixPartnerDiscovery.java

示例3: TrimmedOutput

import org.bitcoinj.core.TransactionOutput; //导入方法依赖的package包/类
public TrimmedOutput(TransactionOutput output, long index, TrimmedTransaction tx) {
    super(output.getParams(), Preconditions.checkNotNull(tx), output.getValue(), output.getScriptBytes());
    this.index = index;
    this.txHash = null;
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:6,代码来源:TrimmedOutput.java

示例4: checkAlias

import org.bitcoinj.core.TransactionOutput; //导入方法依赖的package包/类
public String checkAlias(Transaction tx, WalletObservable walletObservable) {
    final List<TransactionOutput> outputs = tx.getOutputs();
    for (TransactionOutput to : outputs) {
        byte[] script = to.getScriptBytes();
        if(script.length>0) {
            String hexString = Hex.toHexString(script);
            Log.i(TAG, "outputHEX: " + hexString);
            if (hexString.startsWith("6a")) {
                Log.i(TAG, "outputHEX is OP_RETURN! ");

                hexString = hexString.substring(2);
                String aliasNameHex=null;
                if(hexString.startsWith(EWA_PREFIX)  ) {  //NON_STANDARD
                    Log.i(TAG, "outputHEX is EWA NON STANDARD");
                    aliasNameHex = hexString.substring(6);
                } else if (hexString.length()>2 && hexString.substring(2).startsWith(EWA_PREFIX)) {
                    Log.i(TAG, "outputHEX is EWA WITH LENGTH");
                    aliasNameHex = hexString.substring(8);
                }
                if(aliasNameHex!=null) {
                    String aliasName = new String( Bitcoin.fromHex(aliasNameHex) , Charset.forName("utf-8") );

                    if(aliasName!=null && aliasName.length()>0) {
                        aliasName= aliasName.trim();
                        if(aliasName.length()>20)
                            aliasName=aliasName.substring(0,20);
                        Log.i(TAG, "Found alias name!! " + aliasName);

                        if(tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.PENDING ) {
                            Log.i(TAG, "alias tx is pending");
                            walletObservable.setUnconfirmedAliasName(aliasName);
                        } else {
                            walletObservable.setUnconfirmedAliasName(null);
                            walletObservable.setAliasName(aliasName);
                            Log.i(TAG, "alias tx is confirmed!");
                        }
                        walletObservable.notifyObservers();

                        return aliasName;
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:48,代码来源:EWWalletService.java


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