Bitcoin Forum
May 22, 2024, 12:59:56 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 [113] 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 »
2241  Bitcoin / Development & Technical Discussion / Re: Bitcoin Binary Data Protocol, for mining, monitorblocks, etc. on: February 16, 2011, 02:43:23 AM
1) Neither login request nor solution are not lost in my proposal.

If they cannot be lost, then by definition they must be retransmitted.  And you must build logic to determine how often to retransmit.  When to stop retransmitting and give up.  Reinventing TCP, in other words.

Quote
2) I don't think that loss of WORK message will seriously impact the performance. If I understand the principle, new WORK will be broadcasted with every transaction received by server. And it's often enough.
3) I mean only "push" protocol, which does not use GETWORK.

The loss of a WORK message can mean the loss of money, due to not working on the latest block etc.  No miner will stand for this, therefore, WORK must be acknowledged by client, and retransmitted by server.  TCP does this for us automatically.

Quote
4) UDP, as far as I know, is the same NAT-friendly as TCP. In both cases NAT box just maps the source port.

UDP has no notion of connections, so a heavily loaded NAT box must rely on timeouts and other hacks, unlike TCP.  But in focusing on NAT you ignored "firewall";   TCP far more readily passes through firewalls than UDP.  I've seen this at plenty of large corporate sites especially.  They'll do a local DNS server, and no UDP traffic will traverse the firewall into the outside world.  If you want universality, UDP is not the way to go.  TCP is simply more likely to succeed.


Quote
6) Some features of TCP are really overhead when building a low-latency service. So it is sometimes better to reimplement some TCP features than use its full version. For example, in this case we don't need an acknowledge for every message.

Only if you don't mind losing money Smiley

2242  Bitcoin / Mining software (miners) / Re: New demonstration CPU miner available on: February 16, 2011, 02:37:51 AM
Because:
Code:
$ ./configure 
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.


I have the same thing. Trying to configure sources on FreeBSD 8.1-RELEASE-p2 i386.
Maybe, there are some linker flags or workarounds or something?

The solution here is easy:  don't build from git, build from tarball releases.  The tarball already has the proper configure script generated, so you don't have to worry about missing macros or broken OS configurations.

2243  Bitcoin / Mining software (miners) / Re: New demonstration CPU miner available on: February 16, 2011, 02:35:23 AM
I want to suggest some improvements (possibly incorrect).
As I understand your sources. Now, each thread makes his getwork and processes it.
Why not parallelize the processing of one getwork a few threads? Like this: thread_1(nonce = 0 to N), thread_2(nonce = N to M), ..., thread_X(nonce = Y to Z).

This should reduce the load on the network and the loss in the processing of RPC request. (For the case when the block solution time > maximum admissible (skantime). But this is the most common case, no?)

Yes, this is a good idea for the future.  If someone wanted to contributed a clean implementation of this, I would accept it.

As it stands now, simply starting completely independent threads was easier to code.  Breaking up the nonce work implies some level of coordination among threads, which must be done carefully to avoid hurting performance due to locks / asynchronous queues / similar threading details.  One must also take care never to stall one thread, while it waits on other threads.  This is not a hard problem... but it must be done right to avoid these pitfalls.

Quote
The following improvements (for the distant future) - Miner parallelization on multiple hosts with the aid of a binary (for fast) protocol supports pooling, an indication of nonse range and calibrate the performance of customers (to determine the nonce range). In practice, this task of building a new server pool with their customers. It is interesting to you?

Pooling already exists.  See this thread, or see this thread for a binary pool protocol.

2244  Bitcoin / Development & Technical Discussion / Re: Bitcoin Binary Data Protocol, for mining, monitorblocks, etc. on: February 15, 2011, 10:33:56 PM
Why not UDP?
Retransmissions imply you wind up reinventing TCP.
Is retransmission really required everywhere? I think it is useful only during login and result reporting and only on miner side. All other activity does not require TCP features.

A miner does not want to lose a WORK msg, GETWORK msg, nor have their solution lost.  Every single message -- LOGIN, GETWORK, WORK, ... -- must be retransmitted or retried by one side or the other.

But that's just one of many disadvantages of UDP.  TCP is also better supported by most programming language libs, and is more firewall- and NAT-friendly.

Having implemented many UDP servers of various sorts -- financial data feeds, gaming servers, and cloud computing coordinators -- you really do wind up reinventing TCP while attempting to simply have a robust UDP implementation.
2245  Other / CPU/GPU Bitcoin mining hardware / Re: Yet one CPU SSE2 miner for Windows on: February 15, 2011, 10:23:25 PM
According to the license, the code is public domain, so perhaps somebody might want to integrate this into cpuminer itself ;-)
2246  Bitcoin / Bitcoin Discussion / Re: Best practice for fast transaction acceptance - how high is the risk? on: February 15, 2011, 10:22:36 PM
Seems likely this attack will be completely impractical for transactions under $200 when the block reward is worth more than $400.  0-confirmations (just wait N seconds to look for a quick double-spend) for any transaction under $200 seems "good enough" to me.

That's my conclusion.  One of the websites I'm planning on releasing RSN will feature 0-confirmations.  Average transaction will be ~2 BTC.

I also think people will notice if double-spends start appearing with any frequency.

2247  Bitcoin / Development & Technical Discussion / Re: Bitcoin Binary Data Protocol, for mining, monitorblocks, etc. on: February 15, 2011, 08:56:56 PM
Why not UDP?

Retransmissions imply you wind up reinventing TCP.
2248  Other / CPU/GPU Bitcoin mining hardware / Re: Yet one CPU SSE2 miner for Windows on: February 15, 2011, 08:54:55 PM

Is this faster than cpuminer?
2249  Bitcoin / Pools / Re: Cooperative mining (>20Ghash/s, join us!) on: February 15, 2011, 07:28:13 PM
Pool outage was ~15 minutes, everything is working perfectly now. I'll add second server into cluster, change will be without outage.

Is this two pool servers connecting to same bitcoind... or two pool servers connecting to two bitcoind instances?
2250  Bitcoin / Development & Technical Discussion / Bitcoin Binary Data Protocol, for mining, monitorblocks, etc. on: February 15, 2011, 08:17:19 AM
0. The URLs
----------------------------------------------------------------------------------
URL: http://yyz.us/bitcoin/pushpool-0.4.tar.gz
Repo: https://github.com/jgarzik/pushpool


1. The Problem
----------------------------------------------------------------------------------
With the recent slashdotting and resultant influx in new users, the 'getwork' network protocol used in mining is showing some strain, particularly on the pools.  Miners request work once every 5-10 seconds using HTTP JSON-RPC, which has several glaring inefficiencies that lead to unnecessary server load:
  • HTTP/1.1 persistent connections are uncommon, possibly because bitcoind does not support them.  This results in a new TCP connection from every miner, every 5-10 seconds, to the same network host.
  • 'getwork' data is a mere 256 bytes, but HTTP headers and binary-to-hexidecimal encoding for JSON increase the payload to more than double that
  • official bitcoin client's RPC server implementation is essentially a single-threaded loop, where requests from clients B, C, and D will be stalled and ignored until client A's request is finished -- or a 30 second timeout (see -rpctimeout).  This algorithm does not tolerate a high TCP request rate from multiple threads / computers.

Several people, pool operators in particular, have a keen interest in solving these problems.  In addition, push mining (see below) has been discussed as a future alternative to the 'getwork' polling method currently employed.


2. Design goals for a solution
----------------------------------------------------------------------------------
I have written a demonstration pool server (aka a 'getwork' proxy server) that functions in a similar fashion to the recently-discussed poold.py:  large numbers of miners connect to the pool server, which proxies 'getwork' JSON-RPC requests to the official bitcoin client.  This demonstration server implements a new binary protocol that was designed to meet the following goals:

  • Persistent TCP connections, to eliminate TCP disconnect+reconnect behavior by miners
  • Network-efficient for the common use case:  one network packet for 'getwork', one network packet for the returned data.
  • Network-efficient for similar use cases (monitorblocks, monitortx) where clients connect, and then passively wait for real-time events to be delivered
  • Existing miner client workflows supported, to minimize network protocol change impact on miners
  • Support "push mining," where server delivers new work to miners unsolicited (ie. without the miner first sending a 'getwork' message)

This is not intended to replace JSON-RPC API, but to supplement it for specific use cases.  Yes, that means bitcoind will listen to three network ports: P2P network, JSON-RPC, and binary RPC (though as now, only P2P is required for operation; the servers are always optional).


3. Let's start with a protocol example: today's getwork mining
----------------------------------------------------------------------------------
The specific details of the protocol itself are in ubbp.h and protocol.h of the above URL (pushpool-0.1.1.tar.gz).  Here is an example, to provide a suitable introduction:

* TCP connection is broken up into messages.  Each message has a 64-bit header, with 8-bit opcode and 24-bit length fields.
* Miner client connects to TCP server, and issues a LOGIN message, which is compressed JSON login data + sha256 hash of (data + shared secret).
* Server responds with an OP_LOGIN_RESP msg, compressed JSON, indicating options and capabilities
* Client issues an OP_GETWORK msg (8 bytes)
* Server responds with an OP_WORK msg (264 bytes)
* Client uses its CPU/GPU to work on proof-of-work solution...
* Client issues an OP_GETWORK msg (8 bytes)
* Server responds with an OP_WORK msg (264 bytes)
* ...

The above example intentionally matches existing 'getwork' JSON-RPC miner client workflow today.  Miner clients may even support stateless operation by pipelining the OP_LOGIN and OP_GETWORK requests together, and closing the TCP connection.  Stateless operation is not recommended, but it is supported, in order to support the widest range of existing mining clients.


4.  Tomorrow's mining:  push mining
----------------------------------------------------------------------------------
When a block or tx arrives, it is preferable to begin working immediately on the new work.  From the server's perspective, this is a classic data-broadcast problem, where the server wants to broadcast N different pieces of work to N miners.  Hence, "push mining" where the server pushes new work pro-actively to the miner clients.

This new network protocol supports pushing mining, as demonstrated in this example:

* Client connects to server, issues a LOGIN message with the "send_me_work" flag set
* Server responds with OP_LOGIN_RESP msg
* Server sends a OP_WORK msg
* Server sends a OP_WORK msg
* Server sends a OP_WORK msg
* ...


5.  A similar use case:  monitorblocks
----------------------------------------------------------------------------------
Gavin Andresen has a patch in his github which provides a very useful feature:  when a new block is received (monitorblocks) or new wallet transaction (monitortx), bitcoind sends an HTTP POST to the specified URL.  Thus, monitorblocks provides real-time monitoring of the bitcoin network, and monitortx provides real-time monitoring of the local wallet.  This sort of featureset pushes data as events occur, rather than forcing a website operator to poll JSON-RPC for certain operations to complete.

Monitoring new blocks on the bitcoin network is a very easy data broadcasting problem that this binary network protocol may easily support:

* Client connects to server, issues a LOGIN message with the "send_me_blocks" flag set
* Server responds with OP_LOGIN_RESP msg
* Server sends a OP_BLOCK msg
* Server sends a OP_BLOCK msg
* Server sends a OP_BLOCK msg
...

monitortx is more complicated, because one may specify transaction-matching criteria.  But with this new protocol's support of JSON, flexibility is not a problem.


6.  A plan to proceed - this is just a rough draft
----------------------------------------------------------------------------------
I'm thinking of the following steps to proceed, given the need to coalesce several potentially parallel push-mining efforts:
  • write a pool server / proxy server that supports the new protocol (done)
  • hack existing miner clients (cpuminer, oclminer seem easy targets) to support new protocol. volunteers?
  • iterate, test, comment.  iterate, test, comment.  lather, rinse, repeat
  • Once people are happy, implement in official bitcoind
  • in parallel with any of the above efforts, update official bitcoind's rpc.cpp with a smarter httpd implementation

Let the comments begin...  hopefully someone will volunteer to mod a GPU miner to support this?



Appendix 1:  FAQ
----------------------------------------------------------------------------------
Q. Why invent a new protocol?  Why not use Google protocol buffers or XDR?

A. protobuf and XDR both require an underlying packetizing format, such as UBBP that I've presented here.  That implies the choice would be UBBP+protobuf or UBBP+JSON.  Given the bitcoin community's embrace of JSON, the latter was chosen.  JSON is actually more flexible than protobufs, because more dynamic data structures may be described using JSON.


Q.  Why did you not address glaring problems in getwork?

A.  I focused purely on a network-efficient protocol.  getwork implementation choices are outside the scope of this work.


Q.  What is the state / quality of this code release?

A.  Uh, it compiles and runs... but no clients yet exist for it.  Without a miner client for testing, it's about as useful as spitting on a fish...



2251  Bitcoin / Development & Technical Discussion / Re: Patch For Minor issue on: February 14, 2011, 11:24:07 PM
diff --git a/net.h b/net.h
index f070816..205991f 100644
--- a/net.h
+++ b/net.h
@@ -16,7 +16,7 @@ inline unsigned short GetDefaultPort() { return fTestNet ? htons(18333) : htons(
 static const unsigned int PUBLISH_HOPS = 5;
 enum
 {
-    NODE_NETWORK = (1 << 0),
+    NODE_NETWORK = 1,
 };


The code is correct as-is.   This is the normal way someone defines bitmap constants, and is found throughout the Linux kernel among other places.

In the future, you would probably see
Code:
enum {
     NODE_NETWORK      = (1 << 0),
     NODE_FOO          = (1 << 1),
     NODE_BAR          = (1 << 2),
};

etc.

2252  Bitcoin / Mining software (miners) / Re: New demonstration CPU miner available on: February 14, 2011, 09:14:25 PM
For @jgarzik, would you accept pull requests as a way to share patches (via github) the way you want to manage patches? I'm looking at adding a benchmark code to automagically select a core, and *cough* eying how to get the best performance out of this TI DM3730...wonder how fast the DSP really is as a "second core", and porting to NEON.

github pull request, emailed pull request (Linux kernel-style) or a posted patch are all welcomed.  It's a small project Smiley
2253  Bitcoin / Mining software (miners) / Re: New demonstration CPU miner available on: February 14, 2011, 06:41:34 PM
Because:
Code:
$ ./configure 
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.

2254  Bitcoin / Development & Technical Discussion / Re: what miners are trying to resolve? on: February 14, 2011, 06:39:36 PM
Good questions, I'm trying to answer those as well. Some things I've found out:

- The nonce is what a miner itself increases after every try.
- I think you need to hash quite some fields, the nonce, timestamp, and more (merkle root?)
- The generated hash needs to be smaller then the current target (which you can retrieve)

I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do).

To mine, you really need to know the bitcoin data structures quite intimately...  ultimately that means reading the bitcoind source code.
2255  Bitcoin / Mining software (miners) / Re: New demonstration CPU miner available on: February 14, 2011, 05:34:01 PM
Tried this on osx 10.6, using gcc 4.2.1, which does not have the builtin byte swap, apparently:

Code:
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP
#else
#include <byteswap.h>
#endif

But the current master HEAD (6d2882937f8b2a5291ae68ae9ea985ad5271d0fb) does not have this byteswap.h file.

byteswap.h is provided by your OS.  cpuminer will probably need a few minor patches before building on osx.   Patches welcome!

Quote
Also, using ./autogen.h left me with a weird check for libcurl in configure:

Code:
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  AC_MSG_ERROR([Missing required libcurl >= 7.10.1]))

Why is that weird?  That's the standard CURL autotools macro invocation.
2256  Economy / Marketplace / Re: Low-Volume Bitcoin Exchange on: February 14, 2011, 07:17:44 AM
The chargeback fraud, if I understand correctly, isn't a result of people cancelling payment or disputing it through paypal, rather that the transfers are funded by credit card, and the credit card receives a chargeback request, at which point paypal reverse the transaction, since it was funded fraudulently (allegedly).  My understanding is it is quite difficult to eliminate them, other than simply waiting a long time to clear transactions.  I'm not sure if there is a way to only accept paypal transactions funded by account balances, I'm sure it's been discussed before though, since this has come up quite often in the bitcoin community.

There is the paypal chargeback -- scammer disputes their purchase, and gets back funds -- in addition to the credit card chargeback.

The scam, and the net result, are the same:  PayPal seller loses funds from purchase, and scammer keeps the hard cash (bitcoins or LR).
2257  Bitcoin / Development & Technical Discussion / Re: [PATCH] isinitialized RPC method on: February 14, 2011, 03:59:25 AM
Right but you don't know whether bitcoind is running or not.

You can look for it in the OS process list.
2258  Bitcoin / Bitcoin Discussion / Re: Best practice for fast transaction acceptance - how high is the risk? on: February 13, 2011, 11:33:59 PM
In the current Bitcoin scheme, one can't accept transactions until it has been incorporated into a block. Suppose two transactions "spending the same coins" enter the network at different points. On average, half the network will have one transaction and half the other. The only way out of this deadlock is which happens to make it into a block first. So you can see that the race across the network is unimportant but the race to get into a block is the deciding factor.

Presumably, a commercial bitcoin payment processor would spend the bucks to enter the network at a wide array of points, implementing their own double-spending detection and prevention.
2259  Bitcoin / Development & Technical Discussion / Re: [PATCH] isinitialized RPC method on: February 13, 2011, 11:04:20 PM
Why:
Currently it is hard for a GUI wrapping bitcoind by means of the RPC-server to detect when bitcoin is running but still initialising. This seeks to resolve that.

Or you could just deduce same from getinfo's "blocks" and "connections" output...



I don't mean downloading the block chain, or finding connections, I mean the completion of AppInit(...)

The completion of AppInit is signalled by the availability of the RPC service -- that's why JSON-RPC is initialized last in AppInit.
2260  Bitcoin / Development & Technical Discussion / Re: [RFC] monitor JSON-RPC api (push instead of poll) on: February 13, 2011, 11:01:44 PM
I don't have any major problem with your proposal. Skipping HTTP overhead is good idea mainly for high traffic deployment and including some kind of notifications for external applications would be nice. But if I'll have a choice, I'll prefer stateless protocol. I don't see first auth request as necessary, there  is not any problem with sending username/password with every request, but it make code on both sides more transparent.

Highly redundant HTTP headers are probably >50% of your overall bandwidth usage.  My proposal eliminates that entirely.

The cost of stateless is huge.  Think about it -- those HTTP request and response headers are sent, uncompressed, over and over and over again.

My proposal cuts 'getwork' down to a single network packet.  That is maximum network efficiency.
Pages: « 1 ... 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 [113] 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!