Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg = "min relay fee not met, 0 < 226 (code 66)"; #127

Open
Maochengfag opened this issue Mar 18, 2020 · 1 comment
Open

msg = "min relay fee not met, 0 < 226 (code 66)"; #127

Maochengfag opened this issue Mar 18, 2020 · 1 comment

Comments

@Maochengfag
Copy link

I am doing BTC transaction , use BTCTransaction class I just setFee:like this:
BTCTransaction *tx = [[BTCTransaction alloc] init];
long gas = [self caculateFee:fee andAmount:amount andUtxos:txouts];
tx.fee = gas;

  • (long)caculateFee:(NSString *)feeRate andAmount: (long)amount andUtxos:(NSArray )utxos{
    long utxoAmount = 0L;
    long utxoSize = 0L;
    long fee = 0L;
    for (BTCTransactionOutput txout in utxos) {
    utxoSize++;
    if(utxoAmount >= (amount + fee)){
    break;
    }else{
    utxoAmount += txout.value;
    fee = (utxoSize * 148 + 34
    2+10)
    [feeRate longLongValue];
    }
    }
    return fee;
    }
@Maochengfag
Copy link
Author

get the feeRate from https://bitcoinfees.earn.com/api/v1/fees/recommended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant