cryptean / bitcoinlib

Bitcoin Core RPC compatible, battle-tested .NET library and RPC wrapper for Bitcoin and Altcoins
MIT License
404 stars 206 forks source link

Add estimatesmartfee call #71

Closed bazooka70 closed 6 years ago

bazooka70 commented 6 years ago

Is it possible to add the estimatesmartfee RPC call please?

moodmosaic commented 6 years ago

Yes, that's a nice one to have, as it estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks.

bazooka70 commented 6 years ago

Also note that estimatefeeand estimaterawfee are long DEPRECATED in 0.15+

bazooka70 commented 6 years ago

This is the workaround I use so far:

public class GetEstimateSmartFeeResponse
{
    public decimal feerate;
    public ushort blocks;
}

IBitcoinService bitcoinService = new BitcoinService(useTestnet: false);
BitcoinLib.RPC.Connector.IRpcConnector _rpcConnector = new BitcoinLib.RPC.Connector.RpcConnector(bitcoinService);
var response = new GetEstimateSmartFeeResponse();                                   
response = _rpcConnector.MakeRequest<GetEstimateSmartFeeResponse>(BitcoinLib.RPC.Specifications.RpcMethods.estimatesmartfee, 6);

Not sure if this code perfect but it works for me.

moodmosaic commented 6 years ago

Resolved by https://github.com/cryptean/bitcoinlib/pull/75.