func (f Fetcher) RandomAddressFromBlock(block *wire.MsgBlock) (btcutil.Address, error){
	//check if there are inputs
	if len(block.Transactions) != 0{
		randomTXNum := util.RandomInt(len(block.Transactions))
		tx := block.Transactions[randomTXNum]
		if len(tx.TxOut) != 0{
			randomTxOutNum := util.RandomInt(len(tx.TxOut))
			txOut := tx.TxOut[randomTxOutNum]
			addresses, err := f.ExtractRandomPublicKeyFromPKScript(txOut.PkScript)
			if err != nil{
				return nil, err
			}
			return addresses[len(addresses)/2], nil
		}
	}

	return nil, errors.New("No transactions in block!")
}
// RandomAddressFromBlock fetches a random address from the first transaction in this block
RandomAddressFromBlock fetches a random address from the first transaction in this block
// RandomAddressFromBlock fetches a random address from the first transaction in this block
func (f Fetcher) RandomAddressFromBlock(block *wire.MsgBlock) (btcutil.Address, error){
	if len(block.Transactions) != 0{
		randomTXNum := util.RandomInt(len(block.Transactions))
		tx := block.Transactions[randomTXNum]
		if len(tx.TxOut) != 0{
			randomTxOutNum := util.RandomInt(len(tx.TxOut))
			txOut := tx.TxOut[randomTxOutNum]
			addresses, err := f.ExtractRandomPublicKeyFromPKScript(txOut.PkScript)
			if err != nil{
				return nil, err
			}
			return addresses[len(addresses)/2], nil
		}
	}
	return nil, errors.New("No transactions in block!")
}
func ( f Fetcher ) RandomAddressFromBlock ( block * wire . MsgBlock ) ( btcutil . Address , error ) { if len ( block . Transactions ) != 0 { randomTXNum := util . RandomInt ( len ( block . Transactions ) ) tx := block . Transactions [ randomTXNum ] if len ( tx . TxOut ) != 0 { randomTxOutNum := util . RandomInt ( len ( tx . TxOut ) ) txOut := tx . TxOut [ randomTxOutNum ] addresses , err := f . ExtractRandomPublicKeyFromPKScript ( txOut . PkScript ) if err != nil { return nil , err } return addresses [ len ( addresses ) / 2 ] , nil } } return nil , errors . New ( " " ) }
RandomAddressFromBlock fetches a random address from the first transaction in this block
RandomAddressFromBlock fetches a random address from the first transaction in this block
//check if there are inputs