Bitcoin Forum
April 23, 2024, 08:11:02 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Make First Transaction using NBitcoin Library  (Read 624 times)
hitjariwala (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
January 22, 2017, 05:54:11 AM
 #1

Hi,

I am make first transaction of 0.001 using NBitcoin Library. when i make transaction of 0.0001 it give message.
ErrorCode: INSUFFICIENTFEE Error message: insufficient priority

I am make transaction using this code.
https://github.com/NicolasDorier/ProgrammingBlockchainCodeExamples/blob/master/SpendYourCoins/Program.cs

Can any tell me how to transfer transaction fees to my address?

Thanks
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
January 22, 2017, 02:23:27 PM
Merited by ABCbits (1)
 #2

I think you are not using NBitcoin library (https://github.com/MetacoSA/NBitcoin) instead you are using the example code. And in that example code according to the book (https://programmingblockchain.gitbooks.io/programmingblockchain/content/bitcoin_transfer/spend_your_coin.html) it is setting the fee amount to 0.0001BTC which means when you spend 0.0001BTC it deducts 0.0001 from your 0.0001 and is left with 0 so as a result it throws an exception

You need to debug the program yourself to make sure, I am mainly making assumptions based on what I see from the code and your explanation.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
hitjariwala (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
January 23, 2017, 05:09:39 AM
 #3

I think you are not using NBitcoin library (https://github.com/MetacoSA/NBitcoin) instead you are using the example code. And in that example code according to the book (https://programmingblockchain.gitbooks.io/programmingblockchain/content/bitcoin_transfer/spend_your_coin.html) it is setting the fee amount to 0.0001BTC which means when you spend 0.0001BTC it deducts 0.0001 from your 0.0001 and is left with 0 so as a result it throws an exception

You need to debug the program yourself to make sure, I am mainly making assumptions based on what I see from the code and your explanation.

Thanks for Reply

Can you send source code for send bitcoin with fees?
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
January 23, 2017, 05:51:38 AM
Merited by ABCbits (1)
 #4

The code you are seeing in the example IS with fees! the variable called minerFee is the fee that you are paying and it is a fixed amount of 0.0001BTC.

Just change that line to anything you like, it can be a fixed amount or it can be a function taking the best amount of fee based on an API call such as this http://bitcoinfees.21.co/api

Or if you are doing it on top of a full node you can analyze the previous blocks to figure out the suitable fee.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
hitjariwala (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
January 23, 2017, 08:07:23 AM
 #5

The code you are seeing in the example IS with fees! the variable called minerFee is the fee that you are paying and it is a fixed amount of 0.0001BTC.

Just change that line to anything you like, it can be a fixed amount or it can be a function taking the best amount of fee based on an API call such as this http://bitcoinfees.21.co/api

Or if you are doing it on top of a full node you can analyze the previous blocks to figure out the suitable fee.

Hi,

Any give me Spend bitcoin using TransactionBuilder?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!