Pages:
Author

Topic: Decentralized mining protocol standard: getblocktemplate (ASIC ready!) (Read 32257 times)

newbie
Activity: 3
Merit: 0
Hello, sorry for maybe stupid question. Let's suppose that I run two instances of bitcoind on my server. Can I accept block template from first instance but submit share to second? If I understand it correct: getblocktemplate is stateless in terms of blockchain, and pool sever can choose which transactions to include in candidate block. And can submit blocks to any bitcoind instance.

Is it possible to load balance between two bitcoind instances using getblocktemplate?
KNK
hero member
Activity: 692
Merit: 502
Yes, that was my understanding too (glad it's correct), but where may i find information about the coinbaseaux flags?
BIP 22 states 'data that SHOULD be included in the coinbase's scriptSig content', but no mention of flags in https://en.bitcoin.it/wiki/Transactions

P.S.
In short my idea was to have each frontend worker have it's own address for coinbase (to avoid share duplication) and have the blocks valid/accepted even if they submit it to another bitcoind instance as backend.
legendary
Activity: 2576
Merit: 1186
Hello,
 i am looking at making my own poll app based on GWT, but got confused at some pint and still can't figure it out. I've read BIP 22 and 23, but some real world example would be welcome.
bitcoind returns:
Code:
{
    "version" : 2,
    "height" : XXX,
    "previousblockhash" : "X...X",
    "noncerange" : "00000000ffffffff",
    "sizelimit" : 1000000,
    "sigoplimit" : 20000,
    "target" : "X...X",
    "bits" : "12345678",
    "mintime" : XXX,
    "curtime" : XXX,
    "mutable" : [
        "time",
        "transactions",
        "prevblock"
    ],
    "transactions" : [
        {
...
        }
    ],
    "coinbaseaux" : {
        "flags" : "0123456789abcdef"
    },
    "coinbasevalue" : 2500000000,
}

Is the first transaction listed the coinbase one (guess not) or i should create my own? If the later - how do i make it in order to contain the flags (and what do they mean)?
If there is no "coinbasetxn" key, you need to make it.
https://en.bitcoin.it/wiki/Protocol_specification#tx
KNK
hero member
Activity: 692
Merit: 502
Hello,
 i am looking at making my own poll app based on GWT, but got confused at some pint and still can't figure it out. I've read BIP 22 and 23, but some real world example would be welcome.
bitcoind returns:
Code:
{
    "version" : 2,
    "height" : XXX,
    "previousblockhash" : "X...X",
    "noncerange" : "00000000ffffffff",
    "sizelimit" : 1000000,
    "sigoplimit" : 20000,
    "target" : "X...X",
    "bits" : "12345678",
    "mintime" : XXX,
    "curtime" : XXX,
    "mutable" : [
        "time",
        "transactions",
        "prevblock"
    ],
    "transactions" : [
        {
...
        }
    ],
    "coinbaseaux" : {
        "flags" : "0123456789abcdef"
    },
    "coinbasevalue" : 2500000000,
}

Is the first transaction listed the coinbase one (guess not) or i should create my own? If the later - how do i make it in order to contain the flags (and what do they mean)?
W-M
full member
Activity: 210
Merit: 100
In Crypto we Trust.
In the meantime, I got it working. The problem was that I parsed all my JSON objects to post parameters. (i.e. vara=valuea&varb=valueb). This is the way AJAX requests are normally done from Javascript or by any browser submitting a form. It never occured to me that the solution would be to just put the JSON-RPC objects as a string in the postdata of the HTTP request, and voilà, the server was able to parse it and returned a block list.


So I got it working! My Javascript/PHP miner is mining, albeit extremely slow(and with some stops where my host tells me I've done too much requests from one IP in a short time), but it works. I have yet to submit my first real share to the server, and probably some other bugs will pop up later down the line, but for now it is hashing. Hooray! :-)

Thank you for your help, Luke-jr


~W-M
W-M
full member
Activity: 210
Merit: 100
In Crypto we Trust.
Thank you for your reply, Luke.

Code:
{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}
I have tried a multitude of different variations on this, but it still doesn't work.
This looks fine, are you including the HTTP headers for JSON-RPC? While GBT could be used with a raw TCP connection like Stratum, bitcoind does not support this at present.
I have now tried to send the content-type:"application/json" in the headers. Still giving me the same output.

Problems I stumble across:
1. I'm unsure if the "coinbasetxn", "workid", "coinbase/append" and even the whole "capabilities" are optional, or that the brackets in the example are actually part of the syntax to forward the different arguments as an array (as they are usually used in JSON).
It's all optional, but necessary for some servers which make decisions on what features to use in your template.
2. the BIP 22 does not list this request at all, only telling me about two non-optional arguments.
3. Analyzing the python-blkmaker source code, I find another argument called "maxversion". This is not mentioned on the wiki page and not on the BIP 22 page or anywhere else either.
These are part of BIP 23 mainly.

[/quote]
Hmm... Yes, in BIP 23 more optional parts are noted. However, the structure of the JSON-RPC request isn't outlined anywhere. Unless someone had worked with JSON-RPC before they wouldn't know about the exact way to invoke this. Maybe a link to the JSON-RPC Wikipedia page would be nice  Smiley.
legendary
Activity: 2576
Merit: 1186
Code:
{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}
I have tried a multitude of different variations on this, but it still doesn't work.
This looks fine, are you including the HTTP headers for JSON-RPC? While GBT could be used with a raw TCP connection like Stratum, bitcoind does not support this at present.

Problems I stumble across:
1. I'm unsure if the "coinbasetxn", "workid", "coinbase/append" and even the whole "capabilities" are optional, or that the brackets in the example are actually part of the syntax to forward the different arguments as an array (as they are usually used in JSON).
It's all optional, but necessary for some servers which make decisions on what features to use in your template.
2. the BIP 22 does not list this request at all, only telling me about two non-optional arguments.
3. Analyzing the python-blkmaker source code, I find another argument called "maxversion". This is not mentioned on the wiki page and not on the BIP 22 page or anywhere else either.
These are part of BIP 23 mainly.
W-M
full member
Activity: 210
Merit: 100
In Crypto we Trust.
Hey guys, sorry to interrupt your discussion about penis sizes, but I have a question about the workings of getblocktemplate  Tongue.


Recently I have been working on a small getblocktemplate miner implementation in JavaScript/PHP, mainly to understand how the bitcoin works internally a lot better. The Wiki page about getblocktemplate has helped me a lot, but there is one crucial thing I cannot figure out:

How to send a proper block template request to a pool. (This is the request a mining program makes to the pool to indicate it wants to mine something)
Everything I've tried thus far makes the pool return
Code:
{"result":null,"id":null,"error":{"name":"JSONRPCError","code":100,"message":"Parse error"}}
This seems like I'm doing something wrong.
The Wiki page tells me the following syntax:
Code:
{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}
I have tried a multitude of different variations on this, but it still doesn't work.

Problems I stumble across:
1. I'm unsure if the "coinbasetxn", "workid", "coinbase/append" and even the whole "capabilities" are optional, or that the brackets in the example are actually part of the syntax to forward the different arguments as an array (as they are usually used in JSON).
2. the BIP 22 does not list this request at all, only telling me about two non-optional arguments.
3. Analyzing the python-blkmaker source code, I find another argument called "maxversion". This is not mentioned on the wiki page and not on the BIP 22 page or anywhere else either.

So, what do I do? How do I make a proper block template request?


Thanks,

~W-M
newbie
Activity: 39
Merit: 0
legendary
Activity: 952
Merit: 1000
How do you guys propose to compare dick size?

I don't want to play tit for tat and name calling and dick size comparisons
newbie
Activity: 39
Merit: 0
How do you guys propose to compare dick size?
That could be interesting.

However, I am sure there are forum rules against that. lol.
legendary
Activity: 2730
Merit: 1034
Needs more jiggawatts
...and i really thought i could get more information on GBT here.. found myself in a flamewar though. Honestly guys.. noone here is giving a good example.

Sorry that I added to the spam. But there is a reason these forums are so unfriendly. kano has a habit of trolling, name calling, religious harassment, etc. etc. I don't know why he hasn't been banned yet. But if noone says anything, things won't get any better.
hero member
Activity: 700
Merit: 507
...and i really thought i could get more information on GBT here.. found myself in a flamewar though. Honestly guys.. noone here is giving a good example.
-ck
legendary
Activity: 4088
Merit: 1631
Ruu \o/
Little Luke-Jr
This is how representatives of cgminer address other developers?
To be fair, kano is a valued coder and contributor to cgminer and its "defence" as it were, on these most unfriendly forums. However, he should most certainly not be considered the public face of cgminer, which I take full responsibility for. Kano has been, and will be, extremely valuable to the cgminer code, but we have also had our disagreements, and he has humbly accepted no as an answer since I remain the maintainer of the code. On the other hand, lack of humility is precisely why we are where we are with a hostile fork of cgminer. I and Kano have admitted we were wrong whenever appropriate. I don't want to play tit for tat and name calling and dick size comparisons, but the bottom line is, please don't think Kano is the face of cgminer. Look for where I have personally "attacked" someone on the forums before making a judgement about the public face of cgminer.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Little Luke-Jr

This is how representatives of cgminer address other developers?

No - as usual, you simply fall down to the level of name calling and show no intelligence at all.

I LOLed.

Yeah read my whole post - or is that too difficult for you?
My point is that all he ever does is calling me a liar and never once has backed that statement up.

Most of my replies include the details of what I am talking about and the reasons why.

He even said of Graet: "constantly spreading FUD and other lies"
Which is pure bull shit - though I guess you swallowed it whole right? DrHaribo?
legendary
Activity: 2730
Merit: 1034
Needs more jiggawatts
Little Luke-Jr

This is how representatives of cgminer address other developers?

No - as usual, you simply fall down to the level of name calling and show no intelligence at all.

I LOLed.
legendary
Activity: 1162
Merit: 1000
DiabloMiner author
Bottom line is still: Kano is a clueless liar.

Luke, continued trolling can earn you a ban on the forums. Are you sure you really want that?
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Bottom line is still: Kano is a clueless liar.
I've proven you've lied before.

Go ahead and show me where I've lied?
No - as usual, you simply fall down to the level of name calling and show no intelligence at all.
legendary
Activity: 2576
Merit: 1186
Bottom line is still: Kano is a clueless liar.
Pages:
Jump to: