Sending a transaction to a cluster with 3 peers











up vote
2
down vote

favorite












I'm trying to extend my existing single orderer, single peer hyperledger fabric system to 2 orders and 3 peers. I've managed to add a new order so that the system works even if one of the orderers is down.



Now I'm trying to do the same with peers but I'm having difficulties to save a new record on the blockchain, when one of the peers is down.



On saving, I'm using Java SDK to send transaction proposal to all three peers - I receive 2 successful and one failing ProposalResponse - I'm filtering out the failed on and send the collection of successful ones to org.hyperledger.fabric.sdk.Channel#sendTransaction(java.util.Collection<org.hyperledger.fabric.sdk.ProposalResponse>).



The method returns CompletableFuture<TransactionEvent> which I'm subscribing to with whenComplete. I've noticed that when one of the peers is down the future doesn't complete unless the offline peer becomes available again.



Is it how the system is designed? I'd expect fabric and SDK complete a task even if only one peer is available and then let peers update themselves when they become online. Is there some way to achieve a behaviour like that?



Thanks in advance!



EDIT:
I've realized that I'm using sendTransaction with default transaction options that add all peers as event peers so the transaction cannot be finished unless all of them receive the event.










share|improve this question
























  • What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
    – adnan.c
    Nov 19 at 21:43










  • @adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
    – Nav
    Nov 20 at 1:04















up vote
2
down vote

favorite












I'm trying to extend my existing single orderer, single peer hyperledger fabric system to 2 orders and 3 peers. I've managed to add a new order so that the system works even if one of the orderers is down.



Now I'm trying to do the same with peers but I'm having difficulties to save a new record on the blockchain, when one of the peers is down.



On saving, I'm using Java SDK to send transaction proposal to all three peers - I receive 2 successful and one failing ProposalResponse - I'm filtering out the failed on and send the collection of successful ones to org.hyperledger.fabric.sdk.Channel#sendTransaction(java.util.Collection<org.hyperledger.fabric.sdk.ProposalResponse>).



The method returns CompletableFuture<TransactionEvent> which I'm subscribing to with whenComplete. I've noticed that when one of the peers is down the future doesn't complete unless the offline peer becomes available again.



Is it how the system is designed? I'd expect fabric and SDK complete a task even if only one peer is available and then let peers update themselves when they become online. Is there some way to achieve a behaviour like that?



Thanks in advance!



EDIT:
I've realized that I'm using sendTransaction with default transaction options that add all peers as event peers so the transaction cannot be finished unless all of them receive the event.










share|improve this question
























  • What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
    – adnan.c
    Nov 19 at 21:43










  • @adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
    – Nav
    Nov 20 at 1:04













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm trying to extend my existing single orderer, single peer hyperledger fabric system to 2 orders and 3 peers. I've managed to add a new order so that the system works even if one of the orderers is down.



Now I'm trying to do the same with peers but I'm having difficulties to save a new record on the blockchain, when one of the peers is down.



On saving, I'm using Java SDK to send transaction proposal to all three peers - I receive 2 successful and one failing ProposalResponse - I'm filtering out the failed on and send the collection of successful ones to org.hyperledger.fabric.sdk.Channel#sendTransaction(java.util.Collection<org.hyperledger.fabric.sdk.ProposalResponse>).



The method returns CompletableFuture<TransactionEvent> which I'm subscribing to with whenComplete. I've noticed that when one of the peers is down the future doesn't complete unless the offline peer becomes available again.



Is it how the system is designed? I'd expect fabric and SDK complete a task even if only one peer is available and then let peers update themselves when they become online. Is there some way to achieve a behaviour like that?



Thanks in advance!



EDIT:
I've realized that I'm using sendTransaction with default transaction options that add all peers as event peers so the transaction cannot be finished unless all of them receive the event.










share|improve this question















I'm trying to extend my existing single orderer, single peer hyperledger fabric system to 2 orders and 3 peers. I've managed to add a new order so that the system works even if one of the orderers is down.



Now I'm trying to do the same with peers but I'm having difficulties to save a new record on the blockchain, when one of the peers is down.



On saving, I'm using Java SDK to send transaction proposal to all three peers - I receive 2 successful and one failing ProposalResponse - I'm filtering out the failed on and send the collection of successful ones to org.hyperledger.fabric.sdk.Channel#sendTransaction(java.util.Collection<org.hyperledger.fabric.sdk.ProposalResponse>).



The method returns CompletableFuture<TransactionEvent> which I'm subscribing to with whenComplete. I've noticed that when one of the peers is down the future doesn't complete unless the offline peer becomes available again.



Is it how the system is designed? I'd expect fabric and SDK complete a task even if only one peer is available and then let peers update themselves when they become online. Is there some way to achieve a behaviour like that?



Thanks in advance!



EDIT:
I've realized that I'm using sendTransaction with default transaction options that add all peers as event peers so the transaction cannot be finished unless all of them receive the event.







java hyperledger-fabric hyperledger






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 14:46

























asked Nov 19 at 15:34









Nav

113314




113314












  • What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
    – adnan.c
    Nov 19 at 21:43










  • @adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
    – Nav
    Nov 20 at 1:04


















  • What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
    – adnan.c
    Nov 19 at 21:43










  • @adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
    – Nav
    Nov 20 at 1:04
















What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
– adnan.c
Nov 19 at 21:43




What is the chaincode endorsement policy? Does it need endorsement from all 3 peers?
– adnan.c
Nov 19 at 21:43












@adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
– Nav
Nov 20 at 1:04




@adnan.c Tbh I just started working with fabric and completely forgot to look into it - I believe we have some basic policy taken based probably from some tutorial. As 3 peers are there for resilience I'd assume that it shouldn't really need all 3 peers for endorsement - just one would be enough. Is there a way to configure it this way? Right now I have two approaches - passing NOfEvents.createNoEvents() to ` sendTransaction(Collection<ProposalResponse>,TransactionOptions)` or using all successful peers returned with sendTransactionProposal as endorsing peers. Does it make sense?
– Nav
Nov 20 at 1:04

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377947%2fsending-a-transaction-to-a-cluster-with-3-peers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377947%2fsending-a-transaction-to-a-cluster-with-3-peers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...