coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
September 29, 2016, 11:15:11 PM |
|
No issues so far with using OP_Return as part of the proof process. BitSquare and a few others doing something similar already // We add the hash ot OP_RETURN with a 0 amount output TransactionOutput contractHashOutput = new TransactionOutput(params, preparedDepositTx, Coin.ZERO, ScriptBuilder.createOpReturnScript(contractHash).getProgram()); preparedDepositTx.addOutput(contractHashOutput);
TransactionOutput takerTransactionOutput = null; if (takerChangeOutputValue > 0 && takerChangeAddressString != null) takerTransactionOutput = new TransactionOutput(params, preparedDepositTx, Coin.valueOf(takerChangeOutputValue), new Address(params, takerChangeAddressString));
if (offererIsBuyer) { // Add optional buyer outputs if (offererOutput != null) preparedDepositTx.addOutput(offererOutput);
// Add optional seller outputs if (takerTransactionOutput != null) preparedDepositTx.addOutput(takerTransactionOutput); } else { // taker is buyer role
// Add optional seller outputs if (takerTransactionOutput != null) preparedDepositTx.addOutput(takerTransactionOutput);
// Add optional buyer outputs if (offererOutput != null) preparedDepositTx.addOutput(offererOutput); }
// Sign inputs int start = offererIsBuyer ? 0 : takerRawTransactionInputs.size(); int end = offererIsBuyer ? offererInputs.size() : preparedDepositTx.getInputs().size(); for (int i = start; i < end; i++) { TransactionInput input = preparedDepositTx.getInput(i); signInput(preparedDepositTx, input, i); checkScriptSig(preparedDepositTx, input, i); }
verifyTransaction(preparedDepositTx);
printTxWithInputs("preparedDepositTx", preparedDepositTx);
return new PreparedDepositTxAndOffererInputs(offererRawTransactionInputs, preparedDepositTx.bitcoinSerialize()); } // Check if OP_RETURN output with contract hash matches the one from the offerer TransactionOutput contractHashOutput = new TransactionOutput(params, offerersDepositTx, Coin.ZERO, ScriptBuilder.createOpReturnScript(contractHash).getProgram()); log.debug("contractHashOutput " + contractHashOutput); TransactionOutput offerersContractHashOutput = offerersDepositTx.getOutputs().get(1); log.debug("offerersContractHashOutput " + offerersContractHashOutput); if (!offerersContractHashOutput.getScriptPubKey().equals(contractHashOutput.getScriptPubKey())) throw new TransactionVerificationException("Offerers transaction output for the contract hash is not matching takers version.");
|
|
|
|
rhinomonkey
|
|
September 30, 2016, 01:53:52 AM |
|
I sent 0.2 Bitcoin, Georgem!
|
|
|
|
AnotherNode
Full Member
Offline
Activity: 178
Merit: 100
Nodes That Serve
|
|
September 30, 2016, 08:45:57 AM |
|
No issues so far with using OP_Return as part of the proof process. BitSquare and a few others doing something similar already // We add the hash ot OP_RETURN with a 0 amount output TransactionOutput contractHashOutput = new TransactionOutput(params, preparedDepositTx, Coin.ZERO, ScriptBuilder.createOpReturnScript(contractHash).getProgram()); preparedDepositTx.addOutput(contractHashOutput);
TransactionOutput takerTransactionOutput = null; if (takerChangeOutputValue > 0 && takerChangeAddressString != null) takerTransactionOutput = new TransactionOutput(params, preparedDepositTx, Coin.valueOf(takerChangeOutputValue), new Address(params, takerChangeAddressString));
if (offererIsBuyer) { // Add optional buyer outputs if (offererOutput != null) preparedDepositTx.addOutput(offererOutput);
// Add optional seller outputs if (takerTransactionOutput != null) preparedDepositTx.addOutput(takerTransactionOutput); } else { // taker is buyer role
// Add optional seller outputs if (takerTransactionOutput != null) preparedDepositTx.addOutput(takerTransactionOutput);
// Add optional buyer outputs if (offererOutput != null) preparedDepositTx.addOutput(offererOutput); }
// Sign inputs int start = offererIsBuyer ? 0 : takerRawTransactionInputs.size(); int end = offererIsBuyer ? offererInputs.size() : preparedDepositTx.getInputs().size(); for (int i = start; i < end; i++) { TransactionInput input = preparedDepositTx.getInput(i); signInput(preparedDepositTx, input, i); checkScriptSig(preparedDepositTx, input, i); }
verifyTransaction(preparedDepositTx);
printTxWithInputs("preparedDepositTx", preparedDepositTx);
return new PreparedDepositTxAndOffererInputs(offererRawTransactionInputs, preparedDepositTx.bitcoinSerialize()); } // Check if OP_RETURN output with contract hash matches the one from the offerer TransactionOutput contractHashOutput = new TransactionOutput(params, offerersDepositTx, Coin.ZERO, ScriptBuilder.createOpReturnScript(contractHash).getProgram()); log.debug("contractHashOutput " + contractHashOutput); TransactionOutput offerersContractHashOutput = offerersDepositTx.getOutputs().get(1); log.debug("offerersContractHashOutput " + offerersContractHashOutput); if (!offerersContractHashOutput.getScriptPubKey().equals(contractHashOutput.getScriptPubKey())) throw new TransactionVerificationException("Offerers transaction output for the contract hash is not matching takers version."); How does this work with the initial election of Servicenodes and the final payment made to that node? With the model outlined you would have to wait for a certain number of Bitcoin confirmations before a node was paid, so you would end up with a backlog of payments?
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
September 30, 2016, 12:20:56 PM Last edit: September 30, 2016, 01:17:22 PM by coins101 |
|
.....
How does this work with the initial election of Servicenodes and the final payment made to that node?
With the model outlined you would have to wait for a certain number of Bitcoin confirmations before a node was paid, so you would end up with a backlog of payments?
Lets go back a few years. The concept of Masternodes was not actually invented by DASH (Darkcoin back then). Dash took an existing concept and added random selection and random election (I know these things ). The term Master Node is derived from pieces of existing concepts, like this snippet from December 2010, where master node selection was discussed in detail. It relates to selecting a cloud server from a group and making it the master (masternodes / servicenodes in terms of our cyrpto world are cloud servers too). How to select which server is made the master and which are the slaves was the issue being discussed in this example back from 2010: +Majority election for the cloud +=============================== + +This package helps you elect a master node among a set of identical nodes (say, electing a master database server among the servers running the database in your cloud, or the master load-balancer server). + +See `test/test_majority.coffee` for usage example. + + +Consensus protocol +------------------ + +The idea is to elect an online node with a minimal ID as a master. (If you use IP addressed as node IDs, which you should, then a node with a lexicographically smallest IP address wins.) + +To implement this idea, there are a few complications to take care of: + +* Getting the nodes to agree which one of them is a node with a minimal ID. + + Solution: Each node broadcasts its vote on who should be elected. Each node also received the broadcasts, counts votes and picks a winner based on a majority consensus. The incoming broadcasts are also used to judge whether peer nodes are online or offline. + +* If there's a “network split” (a conditions when two or more groups of nodes are online, but cannot communicate across groups), we have to avoid picking several master nodes. + + Solution: There must be a known list of all nodes, and for a winner to be elected, more than N/2 votes are required (where N is the total number of nodes, not a number of nodes that voted). + +* When nodes with small IDs come back online, master may be re-elected even though the old one is perfectly capable of functioning. In the worst case, if the node with a minimal ID is unstable (goes offline and back online often), the whole system may be disrupted by frequent re-elections. + + Solution: Only re-elect a master when the old one is offline. To do it, there are two separate elections going on: one which goes as described and picks a “candidate” (the node to become a master when the current master goes offline), and another one that picks the actual master. + + A node always gives candidate vote to the online node with a smallest ID. The master vote is kept unchanged until the current master goes online, in which case the *currently elected candidate* becomes the new master vote (i.e. a node only updates its master vote to the candidate which has been elected by the candidate election prior to that moment). + + Both master and candidate elections happen on every broadcast (e.g. every 5 seconds), but master votes only change when the old master goes away, so the master is not re-elected until necessary + +* Which nodes to consider offline? + + For now, a node is considered offline if no broadcast has been received from it during the period between two broadcasts. This is an area that could obviously use some improvement, but even this simple rule is good enough. + +The algorithm is very simple, avoid special-casing the “current node” in any way (it also assumes that a node receives its own broadcasts), and cannot possibly re-elect a master unless a majority of nodes decide that such re-election is needed. + + +Status +------ + +This code HAS NOT been used in a real-world application yet — it was certainly written with such use in mind, but I still need to cover some more basic stuff in my cloud stack before I get to the monitoring service. + + +Installation +------------ + +Will be released as an NPM package once it gets some real-world testing. + + +Thanks +------ + +Martin v. Löwis, Spike Gronim and Nick Johnson for the answers on my StackOverflow question [How to elect a master node among the nodes running in a cluster?](http://stackoverflow.com/questions/4523185/how-to-elect-a-master-node-among-the-nodes-running-in-a-cluster) + + +License +------- + +MIT license. I love the function name in here: 'pickWinner' +pickWinner = (threshold, votes) -> + counts = {} + for vote in votes + counts[vote] = (counts[vote] || 0) + 1 + if counts[vote] >= threshold + return vote + return null + +startMajorityElector = (options) -> + { nodeId: myNodeId, pingInterval, obtainListOfNodes, broadcast, becomeMaster, giveUpMaster, trace } = options + + lastReplies = {} + nextReplies = {} + + consensusMasterId = null + consensusCandidateId = null + + myMasterVote = null + myCandidateVote = null + + pingAllNodes = -> + [lastReplies, nextReplies] = [nextReplies, {}] + + allNodes = obtainListOfNodes() + + allNodesIndexed = {} + for node in allNodes + allNodesIndexed[node.nodeId] = node + + # compute consensus votes + + # ignore replies from unlisted nodes + legitimateReplies = (reply for nodeId, reply of lastReplies when allNodesIndexed[nodeId]) + + masterVotes = (reply.masterVote for reply in legitimateReplies) + candidateVotes = (reply.candidateVote for reply in legitimateReplies) + + threshold = allNodes.length / 2 # thank gods, in JavaScript 3 / 2 == 1.5 + + previousConsensusMasterId = consensusMasterId + consensusMasterId = pickWinner(threshold, masterVotes) + consensusCandidateId = pickWinner(threshold, candidateVotes) + + if previousConsensusMasterId != consensusMasterId + if previousConsensusMasterId == myNodeId + giveUpMaster() + else if consensusMasterId == myNodeId + becomeMaster()
Now. We want to do the same thing. Which servicenode gets paid is something that has only this year become decentralized. The process was originally a reference node controlled by the dev, which wasn't great as it was centralized, but that's now gone. So we can untie functions (functions such as providing data mining services, escrow, etc) of ServiceNodes from the election and payment of rewards process. In our case we want a random group of servers to check if a servicenode is actually running a full bitcoin node. So what we could do is pay all nodes in sequence, as the existing SPR process, but if a particular ServiceNode fails to confirm a hash from the Bitcoin blockchain, then it can get bumped off the payments list. It's scoring criteria can be so bad that it needs to prove itself again. So the question about waiting for confirmations from Bitcoin can be removed from some of the processes in order to avoid a payments queue / backlog forming which would potentially become a pot of money and therefore a target for hackers. This proof of running a Bitcoin node in the current proposals gives rise to the potential of reintroducing the original Satoshi whitepaper model - nodes using PoW to validate something. In our case, validate they actually exist. PoW from Hashcash was created to avoid email spam - a user sending an email had to generate some PoW before the email could go. This is basically what we are doing - PoW to generate a hash of a message from the SPR network that only that node will know about. If the node fails to generate the inputs into the hash, it's proof that node is a fake; or more likely that the attacker doesn't want to keep an army of sybil nodes if they have to carry out some PoW in order to get paid once every day or once every week. I think there is a whitepaper in there somewhere.
|
|
|
|
rhinomonkey
|
|
September 30, 2016, 10:28:13 PM |
|
Thanks for the info! I'll use this as a reference when the Spreadwallet comes out.
|
|
|
|
Nikolaj
|
|
October 01, 2016, 01:33:17 AM |
|
A not so complex variation of this: No it's not. I assume that you mean that the problem is that B's coins will remain locked until A agrees to unlock, but this is solved with locktime as described by gmaxwell, see also here. ... This clarified the graphic to some degree, actually. If I'm understanding correctly, you have a service node that is elected for payment, it relays an invoice using BIP74 to the bitcoin network through the SpreadWallet. Once that's confirmed, the SpreadWallet recognizes that and sends payment to the service node. If the SN wasn't legit, it would have never relayed the invoice in the first place, and would become ineligible for receipt of payment. Don't get hung up on the invoice number thing.. it was just an example used during the BIP discussion process by the guy proposing it. What he was basically saying is that additional information can be sent to the bitcoin blockchain without a fee using the OP_RETURN codes and that's what we're interested in when seeking to create a proof. @dev I think sending a 40 byte hash of a validation check from spreadwallet into an internal communications channel that triggers a bitcoin wallet to confirm that same hash on the bitcoin blockchain via OP_RETURN is a strong contender for PoBN, in our servicenode context. edits some of the crap that gets into the blockchain or could these be proofs? Interesting post, thanks. So guys, what about the current status of spr in terms of wallet development? Is there a roadmap regarding the new features mentioned above? Ps: are you part of the spr dev team? Thank you in advance.
|
|
|
|
rhinomonkey
|
|
October 01, 2016, 02:46:38 AM |
|
So guys, what about the current status of spr in terms of wallet development? Is there a roadmap regarding the new features mentioned above?
Ps: are you part of the spr dev team?
Thank you in advance.
There is no roadmap for the release of the wallet features. I think Georgem will keep us updated with where it stands as he completes it. Shouldn't be much longer I think. Currently Georgem is the only programming "dev". However, after the release of the wallet I think some new devs will be attracted to the project. Taking on more developers is sort of a logical step for continuing to grow the community / project. I am a strong supporter of the project and I keep the reddit updated. It's sort of kind of being apart of the "team" coins101 was one of the main people to write this whitepaper (and has contributed in numerous other ways): http://spreadcoin.info/news/wp-content/uploads/2015/10/Proof-of-Bitcoin-Node-DRAFTv1-1.pdf
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
October 01, 2016, 07:50:26 AM |
|
A not so complex variation of this: No it's not. I assume that you mean that the problem is that B's coins will remain locked until A agrees to unlock, but this is solved with locktime as described by gmaxwell, see also here. ... This clarified the graphic to some degree, actually. If I'm understanding correctly, you have a service node that is elected for payment, it relays an invoice using BIP74 to the bitcoin network through the SpreadWallet. Once that's confirmed, the SpreadWallet recognizes that and sends payment to the service node. If the SN wasn't legit, it would have never relayed the invoice in the first place, and would become ineligible for receipt of payment. Don't get hung up on the invoice number thing.. it was just an example used during the BIP discussion process by the guy proposing it. What he was basically saying is that additional information can be sent to the bitcoin blockchain without a fee using the OP_RETURN codes and that's what we're interested in when seeking to create a proof. @dev I think sending a 40 byte hash of a validation check from spreadwallet into an internal communications channel that triggers a bitcoin wallet to confirm that same hash on the bitcoin blockchain via OP_RETURN is a strong contender for PoBN, in our servicenode context. edits some of the crap that gets into the blockchain or could these be proofs? Interesting post, thanks. So guys, what about the current status of spr in terms of wallet development? Is there a roadmap regarding the new features mentioned above? Ps: are you part of the spr dev team? Thank you in advance. Hey I am head of Imaginerring (self appointed, department of 1), AMA
|
|
|
|
rhinomonkey
|
|
October 01, 2016, 07:34:59 PM |
|
Hey
I am head of Imaginerring (self appointed, department of 1), AMA
We can get you a business card to make it official.
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
October 02, 2016, 11:04:51 PM |
|
Hey
I am head of Imaginerring Imagineering(self appointed, department of 1), AMA
We can get you a business card to make it official. Better make sure we spell it properly then. btw, Imgineering is a thing: verbgerund or present participle: imagineering "devise and implement (a new or highly imaginative concept or technology)."
|
|
|
|
AnotherNode
Full Member
Offline
Activity: 178
Merit: 100
Nodes That Serve
|
|
October 02, 2016, 11:19:08 PM |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
October 03, 2016, 07:20:28 AM |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
I'll make you one and send it on PM. I don't think we can post about sig campaigns. I'll check the mod rules.
|
|
|
|
Nikolaj
|
|
October 03, 2016, 11:00:23 AM |
|
guys, a question
I cannot remember the passwork in a spr wallet, to unlock it.
Is there any way to recover it?
I would like to send the amount to georgem in spr: ShutUpHxbuLdy22g9NE4afviUr2Cnqd68H
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
October 03, 2016, 11:17:07 AM |
|
Cross posting, some relevance to this thread While conducting a casual survey into how many people use Bitcoin, the question of how many nodes do we need arose. Here is how many reachable nodes are on the network supporting these users, along with the original version release dates: The key question is is a little complicated: how many full nodes do we need for the current users, how many do we need for double the current users; how many do we need for 100m users; and how many do we need for double that again? Rather than ask those questions first, I thought it would be interesting to get a common base for how many nodes do we need for the current user base of between 2m to 10m going into a growth period which might see numbers go up to 30m?
Lets ignore pruning; segwit, etc. Those are fantastic technological advances, that I would call tricks of the trade to make everyday users lives easier. The backbone of the network is always going to be full nodes.
|
|
|
|
sirazimuth
Legendary
Offline
Activity: 3500
Merit: 3603
born once atheist
|
|
October 04, 2016, 12:01:13 AM |
|
guys, a question
I cannot remember the passwork in a spr wallet, to unlock it.
Is there any way to recover it?
I would like to send the amount to georgem in spr: ShutUpHxbuLdy22g9NE4afviUr2Cnqd68H
i believe the only way to recover a qt wallet password is to know it, so if you have forgotten it with no record of it, unfortunatly you are like that saying goes... up shitz creek without a paddle. but if its any consolation, you get unlimited guesses. good luck
|
Bitcoin...the future of all monetary transactions...and always will be
|
|
|
rhinomonkey
|
|
October 04, 2016, 02:54:10 AM |
|
guys, a question
I cannot remember the passwork in a spr wallet, to unlock it.
Is there any way to recover it?
I would like to send the amount to georgem in spr: ShutUpHxbuLdy22g9NE4afviUr2Cnqd68H
i believe the only way to recover a qt wallet password is to know it, so if you have forgotten it with no record of it, unfortunatly you are like that saying goes... up shitz creek without a paddle. but if its any consolation, you get unlimited guesses. good luck yea, maybe there is some sort of way to brute force it. I'm willing to guess that if you know a few letters of the password you could help the process a bit. Not entirely sure what you would need to download though. Hopefully it wasn't a lot of coins.
|
|
|
|
rhinomonkey
|
|
October 04, 2016, 02:57:31 AM Last edit: October 04, 2016, 03:39:08 AM by rhinomonkey |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
I'll make you one and send it on PM. I don't think we can post about sig campaigns. I'll check the mod rules. Would be cool to have one for Spreadcoin that had the logo and such. There has to be someone who can do that on these forums... anyone know of someone? Edit: AnotherNode, I didn't realize you were such a veteran around these parts. You're very inconspicuous lol. Glad to see people hanging around for such a long time
|
|
|
|
stonehedge
Legendary
Offline
Activity: 1722
Merit: 1002
Decentralize Everything
|
|
October 04, 2016, 02:03:01 PM |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
I'll make you one and send it on PM. I don't think we can post about sig campaigns. I'll check the mod rules. Would be cool to have one for Spreadcoin that had the logo and such. There has to be someone who can do that on these forums... anyone know of someone? Edit: AnotherNode, I didn't realize you were such a veteran around these parts. You're very inconspicuous lol. Glad to see people hanging around for such a long time This guy has done good work for a number of projects I'm involved with. https://bitcointalk.org/index.php?topic=1142066.0
|
|
|
|
coins101
Legendary
Offline
Activity: 1456
Merit: 1000
|
|
October 04, 2016, 02:10:30 PM |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
I'll make you one and send it on PM. I don't think we can post about sig campaigns. I'll check the mod rules. Would be cool to have one for Spreadcoin that had the logo and such. There has to be someone who can do that on these forums... anyone know of someone? Edit: AnotherNode, I didn't realize you were such a veteran around these parts. You're very inconspicuous lol. Glad to see people hanging around for such a long time This guy has done good work for a number of projects I'm involved with. https://bitcointalk.org/index.php?topic=1142066.0But mine is better than yours and it was free
|
|
|
|
stonehedge
Legendary
Offline
Activity: 1722
Merit: 1002
Decentralize Everything
|
|
October 04, 2016, 02:29:20 PM |
|
Coins101: is there an official sig campaign?
Where can I get the same sig as you or one for my account level?
I'll make you one and send it on PM. I don't think we can post about sig campaigns. I'll check the mod rules. Would be cool to have one for Spreadcoin that had the logo and such. There has to be someone who can do that on these forums... anyone know of someone? Edit: AnotherNode, I didn't realize you were such a veteran around these parts. You're very inconspicuous lol. Glad to see people hanging around for such a long time This guy has done good work for a number of projects I'm involved with. https://bitcointalk.org/index.php?topic=1142066.0But mine is better than yours and it was free It is a very nice signature, no arguments there.
|
|
|
|
|