hyperledger-fabric-sdk 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fabric/block_decoder.rb +299 -0
  3. data/lib/fabric/chaincode_response.rb +47 -0
  4. data/lib/fabric/channel.rb +55 -34
  5. data/lib/fabric/client.rb +107 -25
  6. data/lib/fabric/configuration.rb +12 -4
  7. data/lib/fabric/constants.rb +1 -1
  8. data/lib/fabric/crypto_suite.rb +145 -0
  9. data/lib/fabric/enumerator_queue.rb +26 -0
  10. data/lib/fabric/error.rb +52 -0
  11. data/lib/fabric/event_hub.rb +81 -0
  12. data/lib/fabric/helper.rb +31 -0
  13. data/lib/fabric/identity.rb +25 -19
  14. data/lib/fabric/logger.rb +37 -0
  15. data/lib/fabric/orderer.rb +18 -2
  16. data/lib/fabric/peer.rb +15 -36
  17. data/lib/fabric/proposal.rb +100 -0
  18. data/lib/{protos → fabric/protos}/common/collection_pb.rb +14 -14
  19. data/lib/{protos → fabric/protos}/common/common_pb.rb +37 -36
  20. data/lib/fabric/protos/common/configtx_pb.rb +71 -0
  21. data/lib/{protos → fabric/protos}/common/configuration_pb.rb +13 -13
  22. data/lib/{protos → fabric/protos}/common/ledger_pb.rb +2 -2
  23. data/lib/{protos → fabric/protos}/common/policies_pb.rb +19 -19
  24. data/lib/fabric/protos/discovery/protocol_pb.rb +120 -0
  25. data/lib/{protos → fabric/protos}/discovery/protocol_services_pb.rb +0 -1
  26. data/lib/fabric/protos/gossip/message_pb.rb +233 -0
  27. data/lib/{protos → fabric/protos}/gossip/message_services_pb.rb +0 -1
  28. data/lib/{protos → fabric/protos}/idemix/idemix_pb.rb +37 -37
  29. data/lib/{protos → fabric/protos}/ledger/queryresult/kv_query_result_pb.rb +5 -5
  30. data/lib/fabric/protos/ledger/rwset/kvrwset/kv_rwset_pb.rb +85 -0
  31. data/lib/fabric/protos/ledger/rwset/rwset_pb.rb +46 -0
  32. data/lib/{protos → fabric/protos}/msp/identities_pb.rb +4 -4
  33. data/lib/{protos → fabric/protos}/msp/msp_config_pb.rb +27 -27
  34. data/lib/{protos → fabric/protos}/msp/msp_principal_pb.rb +20 -20
  35. data/lib/fabric/protos/orderer/ab_pb.rb +52 -0
  36. data/lib/{protos → fabric/protos}/orderer/ab_services_pb.rb +0 -1
  37. data/lib/fabric/protos/orderer/cluster_pb.rb +31 -0
  38. data/lib/fabric/protos/orderer/cluster_services_pb.rb +31 -0
  39. data/lib/{protos → fabric/protos}/orderer/configuration_pb.rb +11 -10
  40. data/lib/fabric/protos/orderer/etcdraft/configuration_pb.rb +21 -0
  41. data/lib/{protos → fabric/protos}/orderer/kafka_pb.rb +16 -16
  42. data/lib/{protos → fabric/protos}/peer/admin_pb.rb +12 -12
  43. data/lib/{protos → fabric/protos}/peer/admin_services_pb.rb +0 -1
  44. data/lib/{protos → fabric/protos}/peer/chaincode_event_pb.rb +2 -2
  45. data/lib/fabric/protos/peer/chaincode_pb.rb +60 -0
  46. data/lib/fabric/protos/peer/chaincode_shim_pb.rb +129 -0
  47. data/lib/{protos → fabric/protos}/peer/chaincode_shim_services_pb.rb +0 -1
  48. data/lib/{protos → fabric/protos}/peer/configuration_pb.rb +10 -10
  49. data/lib/fabric/protos/peer/events_pb.rb +45 -0
  50. data/lib/fabric/protos/peer/events_services_pb.rb +34 -0
  51. data/lib/{protos → fabric/protos}/peer/peer_pb.rb +5 -5
  52. data/lib/{protos → fabric/protos}/peer/peer_services_pb.rb +0 -1
  53. data/lib/{protos → fabric/protos}/peer/proposal_pb.rb +13 -13
  54. data/lib/{protos → fabric/protos}/peer/proposal_response_pb.rb +11 -11
  55. data/lib/{protos → fabric/protos}/peer/query_pb.rb +10 -10
  56. data/lib/{protos → fabric/protos}/peer/resources_pb.rb +12 -12
  57. data/lib/{protos → fabric/protos}/peer/signed_cc_dep_spec_pb.rb +3 -3
  58. data/lib/{protos → fabric/protos}/peer/transaction_pb.rb +22 -18
  59. data/lib/fabric/protos/token/prover_pb.rb +66 -0
  60. data/lib/fabric/protos/token/prover_services_pb.rb +33 -0
  61. data/lib/fabric/protos/token/transaction_pb.rb +41 -0
  62. data/lib/{protos → fabric/protos}/transientstore/transientstore_pb.rb +4 -4
  63. data/lib/fabric/queue.rb +26 -0
  64. data/lib/fabric/transaction.rb +51 -0
  65. data/lib/fabric/transaction_info.rb +20 -0
  66. data/lib/fabric/version.rb +1 -1
  67. data/lib/fabric.rb +74 -0
  68. data/lib/fabric_ca/attribute.rb +7 -0
  69. data/lib/fabric_ca/client.rb +11 -19
  70. data/lib/fabric_ca/configuration.rb +4 -2
  71. data/lib/fabric_ca/connection.rb +22 -20
  72. data/lib/fabric_ca/error.rb +3 -2
  73. data/lib/fabric_ca/faraday_middleware/basic_auth.rb +3 -3
  74. data/lib/fabric_ca/faraday_middleware/raise_http_exception.rb +13 -13
  75. data/lib/fabric_ca/faraday_middleware/token_auth.rb +10 -12
  76. data/lib/fabric_ca/request.rb +13 -24
  77. data/lib/fabric_ca/version.rb +1 -1
  78. data/lib/fabric_ca.rb +16 -0
  79. data/lib/hyperledger-fabric-sdk.rb +2 -47
  80. metadata +161 -61
  81. data/lib/crypto_suite/ecdsa_aes.rb +0 -86
  82. data/lib/fabric/peer_endorser.rb +0 -85
  83. data/lib/fabric/transaction_id.rb +0 -11
  84. data/lib/fabric/user.rb +0 -24
  85. data/lib/fabric_ca/tools.rb +0 -35
  86. data/lib/protos/common/configtx_pb.rb +0 -71
  87. data/lib/protos/discovery/protocol_pb.rb +0 -119
  88. data/lib/protos/gossip/message_pb.rb +0 -233
  89. data/lib/protos/ledger/rwset/kvrwset/kv_rwset_pb.rb +0 -85
  90. data/lib/protos/ledger/rwset/rwset_pb.rb +0 -46
  91. data/lib/protos/orderer/ab_pb.rb +0 -52
  92. data/lib/protos/peer/chaincode_pb.rb +0 -60
  93. data/lib/protos/peer/chaincode_shim_pb.rb +0 -94
  94. data/lib/protos/peer/events_pb.rb +0 -98
  95. data/lib/protos/peer/events_services_pb.rb +0 -59
@@ -1,94 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: peer/chaincode_shim.proto
3
-
4
- require 'google/protobuf'
5
-
6
- require 'peer/chaincode_event_pb'
7
- require 'peer/proposal_pb'
8
- require 'google/protobuf/timestamp_pb'
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_message "protos.ChaincodeMessage" do
11
- optional :type, :enum, 1, "protos.ChaincodeMessage.Type"
12
- optional :timestamp, :message, 2, "google.protobuf.Timestamp"
13
- optional :payload, :bytes, 3
14
- optional :txid, :string, 4
15
- optional :proposal, :message, 5, "protos.SignedProposal"
16
- optional :chaincode_event, :message, 6, "protos.ChaincodeEvent"
17
- optional :channel_id, :string, 7
18
- end
19
- add_enum "protos.ChaincodeMessage.Type" do
20
- value :UNDEFINED, 0
21
- value :REGISTER, 1
22
- value :REGISTERED, 2
23
- value :INIT, 3
24
- value :READY, 4
25
- value :TRANSACTION, 5
26
- value :COMPLETED, 6
27
- value :ERROR, 7
28
- value :GET_STATE, 8
29
- value :PUT_STATE, 9
30
- value :DEL_STATE, 10
31
- value :INVOKE_CHAINCODE, 11
32
- value :RESPONSE, 13
33
- value :GET_STATE_BY_RANGE, 14
34
- value :GET_QUERY_RESULT, 15
35
- value :QUERY_STATE_NEXT, 16
36
- value :QUERY_STATE_CLOSE, 17
37
- value :KEEPALIVE, 18
38
- value :GET_HISTORY_FOR_KEY, 19
39
- end
40
- add_message "protos.GetState" do
41
- optional :key, :string, 1
42
- optional :collection, :string, 2
43
- end
44
- add_message "protos.PutState" do
45
- optional :key, :string, 1
46
- optional :value, :bytes, 2
47
- optional :collection, :string, 3
48
- end
49
- add_message "protos.DelState" do
50
- optional :key, :string, 1
51
- optional :collection, :string, 2
52
- end
53
- add_message "protos.GetStateByRange" do
54
- optional :startKey, :string, 1
55
- optional :endKey, :string, 2
56
- optional :collection, :string, 3
57
- end
58
- add_message "protos.GetQueryResult" do
59
- optional :query, :string, 1
60
- optional :collection, :string, 2
61
- end
62
- add_message "protos.GetHistoryForKey" do
63
- optional :key, :string, 1
64
- end
65
- add_message "protos.QueryStateNext" do
66
- optional :id, :string, 1
67
- end
68
- add_message "protos.QueryStateClose" do
69
- optional :id, :string, 1
70
- end
71
- add_message "protos.QueryResultBytes" do
72
- optional :resultBytes, :bytes, 1
73
- end
74
- add_message "protos.QueryResponse" do
75
- repeated :results, :message, 1, "protos.QueryResultBytes"
76
- optional :has_more, :bool, 2
77
- optional :id, :string, 3
78
- end
79
- end
80
-
81
- module Protos
82
- ChaincodeMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.ChaincodeMessage").msgclass
83
- ChaincodeMessage::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.ChaincodeMessage.Type").enummodule
84
- GetState = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.GetState").msgclass
85
- PutState = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.PutState").msgclass
86
- DelState = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.DelState").msgclass
87
- GetStateByRange = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.GetStateByRange").msgclass
88
- GetQueryResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.GetQueryResult").msgclass
89
- GetHistoryForKey = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.GetHistoryForKey").msgclass
90
- QueryStateNext = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.QueryStateNext").msgclass
91
- QueryStateClose = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.QueryStateClose").msgclass
92
- QueryResultBytes = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.QueryResultBytes").msgclass
93
- QueryResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.QueryResponse").msgclass
94
- end
@@ -1,98 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: peer/events.proto
3
-
4
- require 'google/protobuf'
5
-
6
- require 'common/common_pb'
7
- require 'google/protobuf/timestamp_pb'
8
- require 'peer/chaincode_event_pb'
9
- require 'peer/transaction_pb'
10
- Google::Protobuf::DescriptorPool.generated_pool.build do
11
- add_message "protos.ChaincodeReg" do
12
- optional :chaincode_id, :string, 1
13
- optional :event_name, :string, 2
14
- end
15
- add_message "protos.Interest" do
16
- optional :event_type, :enum, 1, "protos.EventType"
17
- optional :chainID, :string, 3
18
- oneof :RegInfo do
19
- optional :chaincode_reg_info, :message, 2, "protos.ChaincodeReg"
20
- end
21
- end
22
- add_message "protos.Register" do
23
- repeated :events, :message, 1, "protos.Interest"
24
- end
25
- add_message "protos.Rejection" do
26
- optional :tx, :message, 1, "protos.Transaction"
27
- optional :error_msg, :string, 2
28
- end
29
- add_message "protos.Unregister" do
30
- repeated :events, :message, 1, "protos.Interest"
31
- end
32
- add_message "protos.FilteredBlock" do
33
- optional :channel_id, :string, 1
34
- optional :number, :uint64, 2
35
- repeated :filtered_transactions, :message, 4, "protos.FilteredTransaction"
36
- end
37
- add_message "protos.FilteredTransaction" do
38
- optional :txid, :string, 1
39
- optional :type, :enum, 2, "common.HeaderType"
40
- optional :tx_validation_code, :enum, 3, "protos.TxValidationCode"
41
- oneof :Data do
42
- optional :transaction_actions, :message, 4, "protos.FilteredTransactionActions"
43
- end
44
- end
45
- add_message "protos.FilteredTransactionActions" do
46
- repeated :chaincode_actions, :message, 1, "protos.FilteredChaincodeAction"
47
- end
48
- add_message "protos.FilteredChaincodeAction" do
49
- optional :chaincode_event, :message, 1, "protos.ChaincodeEvent"
50
- end
51
- add_message "protos.SignedEvent" do
52
- optional :signature, :bytes, 1
53
- optional :eventBytes, :bytes, 2
54
- end
55
- add_message "protos.Event" do
56
- optional :creator, :bytes, 6
57
- optional :timestamp, :message, 8, "google.protobuf.Timestamp"
58
- optional :tls_cert_hash, :bytes, 9
59
- oneof :Event do
60
- optional :register, :message, 1, "protos.Register"
61
- optional :block, :message, 2, "common.Block"
62
- optional :chaincode_event, :message, 3, "protos.ChaincodeEvent"
63
- optional :rejection, :message, 4, "protos.Rejection"
64
- optional :unregister, :message, 5, "protos.Unregister"
65
- optional :filtered_block, :message, 7, "protos.FilteredBlock"
66
- end
67
- end
68
- add_message "protos.DeliverResponse" do
69
- oneof :Type do
70
- optional :status, :enum, 1, "common.Status"
71
- optional :block, :message, 2, "common.Block"
72
- optional :filtered_block, :message, 3, "protos.FilteredBlock"
73
- end
74
- end
75
- add_enum "protos.EventType" do
76
- value :REGISTER, 0
77
- value :BLOCK, 1
78
- value :CHAINCODE, 2
79
- value :REJECTION, 3
80
- value :FILTEREDBLOCK, 4
81
- end
82
- end
83
-
84
- module Protos
85
- ChaincodeReg = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.ChaincodeReg").msgclass
86
- Interest = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.Interest").msgclass
87
- Register = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.Register").msgclass
88
- Rejection = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.Rejection").msgclass
89
- Unregister = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.Unregister").msgclass
90
- FilteredBlock = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.FilteredBlock").msgclass
91
- FilteredTransaction = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.FilteredTransaction").msgclass
92
- FilteredTransactionActions = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.FilteredTransactionActions").msgclass
93
- FilteredChaincodeAction = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.FilteredChaincodeAction").msgclass
94
- SignedEvent = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.SignedEvent").msgclass
95
- Event = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.Event").msgclass
96
- DeliverResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.DeliverResponse").msgclass
97
- EventType = Google::Protobuf::DescriptorPool.generated_pool.lookup("protos.EventType").enummodule
98
- end
@@ -1,59 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # Source: peer/events.proto for package 'protos'
3
- # Original file comments:
4
- #
5
- # Copyright IBM Corp. 2016 All Rights Reserved.
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require 'grpc'
21
- require 'peer/events_pb'
22
-
23
- module Protos
24
- module Events
25
- # Interface exported by the events server
26
- class Service
27
-
28
- include GRPC::GenericService
29
-
30
- self.marshal_class_method = :encode
31
- self.unmarshal_class_method = :decode
32
- self.service_name = 'protos.Events'
33
-
34
- # event chatting using Event
35
- rpc :Chat, stream(SignedEvent), stream(Event)
36
- end
37
-
38
- Stub = Service.rpc_stub_class
39
- end
40
- module Deliver
41
- class Service
42
-
43
- include GRPC::GenericService
44
-
45
- self.marshal_class_method = :encode
46
- self.unmarshal_class_method = :decode
47
- self.service_name = 'protos.Deliver'
48
-
49
- # deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message,
50
- # then a stream of block replies is received.
51
- rpc :Deliver, stream(Common::Envelope), stream(DeliverResponse)
52
- # deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message,
53
- # then a stream of **filtered** block replies is received.
54
- rpc :DeliverFiltered, stream(Common::Envelope), stream(DeliverResponse)
55
- end
56
-
57
- Stub = Service.rpc_stub_class
58
- end
59
- end