Pages:
Author

Topic: Book release : Blockchain Programming in C# (Part 1) - page 2. (Read 31972 times)

hero member
Activity: 765
Merit: 503
Yes, the second part use TransactionBuilder a lot and have a part dedicated on the subject.

Quote
Hmm, all my test net coins where received months ago.  
This is false, check for yourself. 7dcd9c83336c932fe19999fbef3888c8bfc774efcad3831f1544c10c05b3efb3 do not exists, you are referencing a coin from a transaction that do not exists.

You can also check the log of bitcoin core to have more information, but right now your transaction can't possibly work with a coin that do not exist.
You made a mistake on the transaction id you are referencing.

I never saw had a bug with txBuilder.Verify(tx);
If it says it is well signed, then it is, your problem is with the input outpoint.

Sorry to waste your time, not sure where that hash come form.  Triple checked and all is working now.

Will be sending a tip once I get paid Cheesy
hero member
Activity: 714
Merit: 621
Yes, the second part use TransactionBuilder a lot and have a part dedicated on the subject.

Quote
Hmm, all my test net coins where received months ago.  
This is false, check for yourself. 7dcd9c83336c932fe19999fbef3888c8bfc774efcad3831f1544c10c05b3efb3 do not exists, you are referencing a coin from a transaction that do not exists.

You can also check the log of bitcoin core to have more information, but right now your transaction can't possibly work with a coin that do not exist.
You made a mistake on the transaction id you are referencing.

I never saw had a bug with txBuilder.Verify(tx);
If it says it is well signed, then it is, your problem is with the input outpoint.
hero member
Activity: 765
Merit: 503
Why is it commented out ?

Quote
//node.SendMessage(new NBitcoin.Protocol.InvPayload(transactions));

Because you need it.

Another common error I've seen some people did is referencing the wrong Output.
In my example, I've checked precisely which coin I wanted to spend. (I think it was the first output of the previous transaction)
In you case, it might be the second coin of the previous transaction.

I have also checked you transaction, you are referencing a previous coin from 7dcd9c83336c932fe19999fbef3888c8bfc774efcad3831f1544c10c05b3efb3
This transaction is not confirmed nor in any mempool.

Commented out because I was trying with and without.

Hmm, all my test net coins where received months ago. 

Does part 2 of your book have a section on the tx builder?
hero member
Activity: 714
Merit: 621
Why is it commented out ?

Quote
//node.SendMessage(new NBitcoin.Protocol.InvPayload(transactions));

Because you need it.

Another common error I've seen some people did is referencing the wrong Output.
In my example, I've checked precisely which coin I wanted to spend. (I think it was the first output of the previous transaction)
In you case, it might be the second coin of the previous transaction.

I have also checked you transaction, you are referencing a previous coin from 7dcd9c83336c932fe19999fbef3888c8bfc774efcad3831f1544c10c05b3efb3
This transaction is not confirmed nor in any mempool.
hero member
Activity: 765
Merit: 503
Hi Nic,

I can't seem to send a transaction on the test network.  This code excuses without exception.  Any ideas?

Code:
                using (var node = NBitcoin.Protocol.Node.ConnectToLocal(NBitcoin.Network.TestNet))
                {
                    node.VersionHandshake();
                    NBitcoin.Transaction[] transactions = new Transaction[1];
                    transactions[0] = tx;
                    
                    //node.SendMessage(new NBitcoin.Protocol.InvPayload(transactions));
                    node.SendMessage(new NBitcoin.Protocol.TxPayload(tx));
                }

Tx = 0100000001b3efb3050cc144151f83d3caef74c7bfc88838effb9999e12f936c33839ccd7d00000 00048473044022057a1ecdd6377d25bdfcf06d97f71c6f75571f14371e55f45265a7c28a942386f 0220201732fefbcd3788b31ffbade0cd0f2785d510b9d1c84c570f8b4ec128d993bf01ffffffff0 358020000000000001976a91497422742f5c61fd2f3d3c2b2bc97ff85be8a541f88aca8def50500 000000434104d751b12b85ba098f5648723265bcf88754d8a96923b9524ca590bbaf1dad7b51526 b0d3355602b8fa8dbe6e396e7db4655a8c5dcc1e4f1b44b6e273f5389a0ffac0000000000000000 096a074f41010001140000000000

Note:  Tx passed the verification method, Debug.Assert(txBuilder.Verify(tx));
newbie
Activity: 9
Merit: 0
Thank you for this.

Once you've finished, you might want to consider creating an ebook out of it. You can put it up on Smashwords with a price of $0 and it will get distributed to most book retailers apart from Amazon.
legendary
Activity: 2464
Merit: 1145
Hello all,

I think that one of the way to make Bitcoin a success is to teach developers how to program it themselves, while keeping in mind the real problems they can fix with it.
Depending on public web API to do the heavy stuff is still useful, but oblige the user to look at the problem from someone else eyes.
It also block innovation, since users are stuck to what their API provider gives them, and provoke a mopya to the wild possibilities of Bitcoin.

I have way too much demand for work than I can give. However, I can spread what I know for free in a book.

My book is in public domain, and will be spread likely in 3 parts.
The first part is out now, and I am waiting for your feedback (and your work ! Smiley)

In the book, you will find coding challenges that you need to resolve to get access to the next parts when they will be out.

The range of difficulty will go from "how to create a private key", "how to make you transaction by hand, and sending by hand" to "how Dark Wallet works", "How to implement coin shuffle", "how to implement a voting system with colored coins"

Website : http://blockchainprogramming.azurewebsites.net/
Book link : https://aois.blob.core.windows.net/public/Blockchain Programming in CSharp.pdf

Nicolas,
Happy coding and make shit happens,

Hello Nicholas,

Thanks for this awesome ebook! i will take a good look at and will comment when im finished with it Smiley
hero member
Activity: 714
Merit: 621
Offtopic:
Odd to hear someone doesn't like R#, it's really really good.
But i'm a fan of RedGate, i do like the ANTS profile tools..

Ontopic:
I never heard about Bill Strait and can't find much about it on google or bing, because that name is not unique at all..

I do like the private key, public key and hash being written about.
Perhaps i missed about it, but i couldn't find anything in dept technical background in there..
Ofcourse that isn't C# related Smiley

Something like this
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses


I do not go in the details, but it will be far from basic, I want developers to understand bitcoin on the conceptual and developement level.
Knowing the details about how to transform an array of byte into a base58 does not unlock any potential for innovation.
Pure source code, wiki or Mastering Bitcoin of Andreas Antonopoulos are better suited for this kind of information.

Also, this is the first part of the book. The next one (should release beginning march) talk about building more complex transaction (multi sig, DW) and colored coins.
The third part will focus on advanced scenario like Coin Share and micro payment with OP_CHECKLOCKTIMEVERIFY.

The goal of this book is to give the basic knowledge for starting innovation on bitcoin without relying on someone's else public web API (like blockchain info)
Relying on an web API blocks innovation at the web API provider level, this is the congestion I want to burst.

The lack of product in the bitcoin space is not the fault of the core developers but of API providers that got life too easy, and a lack of teaching materials easing the learning curve. Bitcoin the protocol evolves faster than we are innovating.
hero member
Activity: 798
Merit: 500
Offtopic:
Odd to hear someone doesn't like R#, it's really really good.
But i'm a fan of RedGate, i do like the ANTS profile tools..

Ontopic:
I never heard about Bill Strait and can't find much about it on google or bing, because that name is not unique at all..

I do like the private key, public key and hash being written about.
Perhaps i missed about it, but i couldn't find anything in dept technical background in there..
Ofcourse that isn't C# related Smiley

Something like this
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
hero member
Activity: 714
Merit: 621
Will you release the book in 'hard cover' instead of pdf?

Maybe by contacting o'reilly, dummies or any other tech book seller.

Someone is currently correcting the book and wants to publish it. (his name is Bill Strait)
Anyway, I will not do it myself. I prefer getting code and articles done.

Do you use ReSharper? I didn't look at your code yet, but if you don't use it you don't know what you miss. If you do use it, well you never want to work without it anymore!

Nice book anyway, i'm honest i scrolled thru it but it's great to see a book on C#, blockchain and your NuGet package.

But missing some "Red Shirts" Smiley

I don't use it. I tried in the past, multiple times, and it always resulted into crash and slowdown of visual studio.
Except for ReSharper, I'm a big fan of JetBrain. Smiley
hero member
Activity: 798
Merit: 500
Will you release the book in 'hard cover' instead of pdf?

Maybe by contacting o'reilly, dummies or any other tech book seller.
hero member
Activity: 798
Merit: 500
Do you use ReSharper? I didn't look at your code yet, but if you don't use it you don't know what you miss. If you do use it, well you never want to work without it anymore!

Nice book anyway, i'm honest i scrolled thru it but it's great to see a book on C#, blockchain and your NuGet package.

But missing some "Red Shirts" Smiley
member
Activity: 66
Merit: 10
Fantastic! There are millions of C# developers who have never learned and used anything else apart from the .NET platlform and C# and this book will be great for them.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
For some reason I missed this thread until now. First thing: I downloaded the pdf.
I will read it, I will try to understand it. First thing I like: it's not too long!!

Big THANK YOU!
member
Activity: 84
Merit: 10
I am highly intrested on programming and the bitcoin thing is making me dam crazy
hero member
Activity: 910
Merit: 1000
Hello all,

I think that one of the way to make Bitcoin a success is to teach developers how to program it themselves, while keeping in mind the real problems they can fix with it.
Depending on public web API to do the heavy stuff is still useful, but oblige the user to look at the problem from someone else eyes.
It also block innovation, since users are stuck to what their API provider gives them, and provoke a mopya to the wild possibilities of Bitcoin.

I have way too much demand for work than I can give. However, I can spread what I know for free in a book.

My book is in public domain, and will be spread likely in 3 parts.
The first part is out now, and I am waiting for your feedback (and your work ! Smiley)

In the book, you will find coding challenges that you need to resolve to get access to the next parts when they will be out.

The range of difficulty will go from "how to create a private key", "how to make you transaction by hand, and sending by hand" to "how Dark Wallet works", "How to implement coin shuffle", "how to implement a voting system with colored coins"

Website : http://blockchainprogramming.azurewebsites.net/
Book link : https://aois.blob.core.windows.net/public/Blockchain Programming in CSharp.pdf

Nicolas,
Happy coding and make shit happens,

Very much agree with your first statement. I don't program in C# (yet) but I'm happy to see books coming out on this subject.
hero member
Activity: 714
Merit: 621
I'm not sure if you'll have this in your book or not, but one thing that seems to be missing from some of the .Net wrapper libraries are annotated examples for calling each of the supported API methods.  Often the Bitcoin wrappers will include a basic example of only 2-3 methods (say checking the balance), but will miss key examples for each of the critical JSON methods that the wrapper calls, like sending a transaction. Granted, you can always look through the class and try to determine how to correctly call the method with the required parameters. However, it's much easier to just look at a working example and then change what you need to in order to adopt into the code. 

I'm looking forward to the book!

Thanks for the feedback, the RPCClient class has a good deal of easy to call methods. However, I also let exposed the JObject SendRequest("commandname", request), so people are not stuck when the RPC api evolve but not NBitcoin.
Moreover, with C# you can add your custom method to classes without modifying the source. (Extension methods)

The book does not focus on the APIs though. I focus on blockchain programming, the reason is that by knowing the basics, you can better evaluate all APIs by yourself, but also create your own if none fit your needs.

Hello all,
Nicolas,
Happy coding and make shit happens,
100% awesome.  You are the man (l'homme!).  1000s of cool things will be built on your great work.  Way to go Nicolas. 

Microsoft owes you bit time and they are idiots with growing intensity every day they don't send you a ton of money for promoting their platform. 

Thanks, actually the best medal I can get is people building cool services thanks to it.

Microsoft is doing better since the management shake up after Ballmer left.
They are doing awesome work again, and I like its community. (http://channel9.msdn.com/ show lots of the cool stuff)
I must say that I was not so optimistic in the past.

Quote
Congratulations, Nicolas! I have to read it
Hope you'll want to depend on it for the cool projects you are doing Smiley
full member
Activity: 164
Merit: 126
Amazing times are coming
Congratulations, Nicolas! I have to read it.
full member
Activity: 399
Merit: 105
Hello all,
Nicolas,
Happy coding and make shit happens,
100% awesome.  You are the man (l'homme!).  1000s of cool things will be built on your great work.  Way to go Nicolas.  

Microsoft owes you bit time and they are idiots with growing intensity every day they don't send you a ton of money for promoting their platform. 
Pages:
Jump to: