Bitcoin Forum
April 19, 2024, 03:17:02 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: C# worked code + support  (Read 1813 times)
andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
May 31, 2012, 12:50:04 AM
 #1

Dears

I need a c# code to work with bitcoin (send, receive, create wallet, address...) and a support do prepare the computer. Can you help me?

André
1713539822
Hero Member
*
Offline Offline

Posts: 1713539822

View Profile Personal Message (Offline)

Ignore
1713539822
Reply with quote  #2

1713539822
Report to moderator
It is a common myth that Bitcoin is ruled by a majority of miners. This is not true. Bitcoin miners "vote" on the ordering of transactions, but that's all they do. They can't vote to change the network rules.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713539822
Hero Member
*
Offline Offline

Posts: 1713539822

View Profile Personal Message (Offline)

Ignore
1713539822
Reply with quote  #2

1713539822
Report to moderator
1713539822
Hero Member
*
Offline Offline

Posts: 1713539822

View Profile Personal Message (Offline)

Ignore
1713539822
Reply with quote  #2

1713539822
Report to moderator
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
May 31, 2012, 12:52:38 AM
 #2

The only library I know is:
http://code.google.com/p/bitcoinsharp/

It hasn't been updated in 6 months but at least the parts I have used (key/address generation) have worked.

It is base off of the java library:
http://code.google.com/p/bitcoinj/

so structure, libraries, design should be similar.

.net developers are a rare breed in Bitcoin.  Hopefully that gets you started.


andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
May 31, 2012, 01:03:37 AM
 #3

The only library I know is:
http://code.google.com/p/bitcoinsharp/

It hasn't been updated in 6 months but at least the parts I have used (key/address generation) have worked.

It is base off of the java library:
http://code.google.com/p/bitcoinj/

so structure, libraries, design should be similar.

.net developers are a rare breed in Bitcoin.  Hopefully that gets you started.




i know the bitcoinsharp, but it´s not working...

i will try in java...
Sergio_Demian_Lerner
Hero Member
*****
expert
Offline Offline

Activity: 549
Merit: 608


View Profile WWW
May 31, 2012, 05:36:52 PM
 #4

I  made it work. Some minor changes are needed. I don't warranty that it's correct, but It worked for me.
Best regards,
 Sergio.


This is the diff:

Index: DownloadListener.cs
===================================================================
--- DownloadListener.cs   (revision 60)
+++ DownloadListener.cs   (working copy)
@@ -36,7 +36,7 @@
     {
         private int _originalBlocksLeft = -1;
         private int _lastPercent;
-        private readonly Semaphore _done = new Semaphore(0, 0);
+        private readonly Semaphore _done = new Semaphore(1, 1);
 
         public override void OnChainDownloadStarted(Peer peer, int blocksLeft)
         {
Index: NetworkConnection.cs
===================================================================
--- NetworkConnection.cs   (revision 60)
+++ NetworkConnection.cs   (working copy)
@@ -76,17 +76,22 @@
             _in = new NetworkStream(_socket, FileAccess.Read);
 
             // the version message never uses check-summing. Update check-summing property after version is read.
-            _serializer = new BitcoinSerializer(@params, false);
+            _serializer = new BitcoinSerializer(@params, true);  // SDL: Checksuming now ALWAYS necessary
 
             // Announce ourselves. This has to come first to connect to clients beyond v0.30.20.2 which wait to hear
             // from us until they send their version message back.
             WriteMessage(new VersionMessage(@params, bestHeight));
+            // SDL: Now read a versionack
+
             // When connecting, the remote peer sends us a version message with various bits of
             // useful data in it. We need to know the peer protocol version before we can talk to it.
+
             _versionMessage = (VersionMessage) ReadMessage();
+
             // Now it's our turn ...
             // Send an ACK message stating we accept the peers protocol version.
             WriteMessage(new VersionAck());
+
             // And get one back ...
             ReadMessage();
             // Switch to the new protocol version.
Index: Store/BoundedOverheadBlockStore.cs
===================================================================
--- Store/BoundedOverheadBlockStore.cs   (revision 60)
+++ Store/BoundedOverheadBlockStore.cs   (working copy)
@@ -214,7 +214,8 @@
             {
                 _channel.Dispose();
             }
-            _channel = file.OpenRead();
+            // SDL _channel = file.OpenRead();
+            _channel = file.Open(FileMode.Open, FileAccess.ReadWrite);
             try
             {
                 // Read a version byte.
andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
May 31, 2012, 11:13:29 PM
 #5

Can you share the visual studio project?

I  made it work. Some minor changes are needed. I don't warranty that it's correct, but It worked for me.
Best regards,
 Sergio.


This is the diff:

Index: DownloadListener.cs
===================================================================
--- DownloadListener.cs   (revision 60)
+++ DownloadListener.cs   (working copy)
@@ -36,7 +36,7 @@
     {
         private int _originalBlocksLeft = -1;
         private int _lastPercent;
-        private readonly Semaphore _done = new Semaphore(0, 0);
+        private readonly Semaphore _done = new Semaphore(1, 1);
 
         public override void OnChainDownloadStarted(Peer peer, int blocksLeft)
         {
Index: NetworkConnection.cs
===================================================================
--- NetworkConnection.cs   (revision 60)
+++ NetworkConnection.cs   (working copy)
@@ -76,17 +76,22 @@
             _in = new NetworkStream(_socket, FileAccess.Read);
 
             // the version message never uses check-summing. Update check-summing property after version is read.
-            _serializer = new BitcoinSerializer(@params, false);
+            _serializer = new BitcoinSerializer(@params, true);  // SDL: Checksuming now ALWAYS necessary
 
             // Announce ourselves. This has to come first to connect to clients beyond v0.30.20.2 which wait to hear
             // from us until they send their version message back.
             WriteMessage(new VersionMessage(@params, bestHeight));
+            // SDL: Now read a versionack
+
             // When connecting, the remote peer sends us a version message with various bits of
             // useful data in it. We need to know the peer protocol version before we can talk to it.
+
             _versionMessage = (VersionMessage) ReadMessage();
+
             // Now it's our turn ...
             // Send an ACK message stating we accept the peers protocol version.
             WriteMessage(new VersionAck());
+
             // And get one back ...
             ReadMessage();
             // Switch to the new protocol version.
Index: Store/BoundedOverheadBlockStore.cs
===================================================================
--- Store/BoundedOverheadBlockStore.cs   (revision 60)
+++ Store/BoundedOverheadBlockStore.cs   (working copy)
@@ -214,7 +214,8 @@
             {
                 _channel.Dispose();
             }
-            _channel = file.OpenRead();
+            // SDL _channel = file.OpenRead();
+            _channel = file.Open(FileMode.Open, FileAccess.ReadWrite);
             try
             {
                 // Read a version byte.

Kris
Donator
Hero Member
*
Offline Offline

Activity: 640
Merit: 500


View Profile
June 01, 2012, 11:46:02 AM
 #6

So what you really need is in fact just JSON-RPC functions in C# to (send, receive, create wallet, address...) to a bitcoind instance ?

If so I might be able to squeeze it in, as I am a C# developer as well.

Should it be a Windows Form or Console application?

Regards
Kris
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
June 01, 2012, 12:25:22 PM
 #7

Class
So what you really need is in fact just JSON-RPC functions in C# to (send, receive, create wallet, address...) to a bitcoind instance ?

If so I might be able to squeeze it in, as I am a C# developer as well.

Should it be a Windows Form or Console application?

Regards
Kris

Class library would be the best project type to ensure resuability right?
Encapsulate all the JSON logic into a C# library and developers can drop it into any .Net solution (web, console, winform, etc).

If you want to get crazy write up a solution which consists of a class library project, an "example" project, and a unit testing project.

Glad to find at least three other .Net developers.  We are a rare breed in the Bitcoin world.
Sergio_Demian_Lerner
Hero Member
*****
expert
Offline Offline

Activity: 549
Merit: 608


View Profile WWW
June 01, 2012, 01:20:10 PM
 #8

When I needed to find a tool to generate some non-standard transactions I tested BitcoinJ and BitcoinSharp.

BitcoinJ requires to install a lot o packages and compiles using maven. I took me more than two hours to make it work.

BitcoinSharp took me less than two minutes.

It's the most simple Bitcoin library.


Kris
Donator
Hero Member
*
Offline Offline

Activity: 640
Merit: 500


View Profile
June 01, 2012, 08:27:35 PM
 #9

Class
So what you really need is in fact just JSON-RPC functions in C# to (send, receive, create wallet, address...) to a bitcoind instance ?

If so I might be able to squeeze it in, as I am a C# developer as well.

Should it be a Windows Form or Console application?

Regards
Kris

Class library would be the best project type to ensure resuability right?
Encapsulate all the JSON logic into a C# library and developers can drop it into any .Net solution (web, console, winform, etc).

If you want to get crazy write up a solution which consists of a class library project, an "example" project, and a unit testing project.

Glad to find at least three other .Net developers.  We are a rare breed in the Bitcoin world.

Yes a Class library, which is just a .dll file to include in your csharp projects, in Visual Studio or SharpDevelop.
andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
June 02, 2012, 12:49:18 AM
 #10

Anyone can send me the visual studio solution?
Kris
Donator
Hero Member
*
Offline Offline

Activity: 640
Merit: 500


View Profile
June 02, 2012, 01:03:29 AM
 #11

If you can wait until Sunday, I can make it for you.
andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
June 02, 2012, 01:39:46 AM
 #12

If you can wait until Sunday, I can make it for you.

Cool! thank you. I´ll wait.
Vandroiy
Legendary
*
Offline Offline

Activity: 1036
Merit: 1002


View Profile
June 02, 2012, 01:28:58 PM
 #13

Thanks to everyone who helps making this work!

I know I will need it, and I'd be happy to have a real CLI project instead of BitcoinJ on IKVM.
Kitemike
Member
**
Offline Offline

Activity: 108
Merit: 10



View Profile WWW
June 04, 2012, 12:07:25 PM
 #14

I have a couple of projects I'd love to add bitcoin functionallity to.  How can I get a hold of this .dll (or the .proj)?  There are probably more .net programmers out there than are willing to admit  Wink

andrehorta (OP)
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
June 04, 2012, 12:11:24 PM
 #15

I´m still whaiting for the projet in c#.net!

Tnks
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
June 04, 2012, 12:40:48 PM
 #16

I have a couple of projects I'd love to add bitcoin functionallity to.  How can I get a hold of this .dll (or the .proj)?  There are probably more .net programmers out there than are willing to admit  Wink


Well the source code is here (including solution & project files)
http://code.google.com/p/bitcoinsharp/

However it hasn't been updated in 6 months.  Up thread someone posted changes they needed to make to get the portion they were using working.

Likely there are other issues but that should get you started.

The optimal solution would be for someone (maybe I am nominating myself) to fork the project and get it current.
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!