idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
32,400
public static LifecycleChaincodePackage fromStream ( InputStream inputStream ) throws IOException , InvalidArgumentException { if ( null == inputStream ) { throw new InvalidArgumentException ( "The parameter inputStream may not be null." ) ; } byte [ ] packageBytes = IOUtils . toByteArray ( inputStream ) ; return fromB...
Construct a LifecycleChaincodePackage from a stream .
32,401
public byte [ ] getAsBytes ( ) { byte [ ] ret = new byte [ pBytes . length ] ; System . arraycopy ( pBytes , 0 , ret , 0 , pBytes . length ) ; return ret ; }
Lifecycle chaincode package as bytes
32,402
public void toFile ( Path path , OpenOption ... options ) throws IOException { Files . write ( path , pBytes , options ) ; }
Write Lifecycle chaincode package bytes to file .
32,403
public org . hyperledger . fabric . protos . common . Collection . CollectionConfigPackage getCollectionConfigPackage ( ) throws InvalidProtocolBufferException { if ( null == cp ) { cp = org . hyperledger . fabric . protos . common . Collection . CollectionConfigPackage . parseFrom ( collectionConfigBytes ) ; } return ...
The raw collection information returned from the peer .
32,404
public Collection < CollectionConfig > getCollectionConfigs ( ) throws InvalidProtocolBufferException { List < CollectionConfig > ret = new LinkedList < > ( ) ; for ( org . hyperledger . fabric . protos . common . Collection . CollectionConfig collectionConfig : getCollectionConfigPackage ( ) . getConfigList ( ) ) { re...
Collection of the chaincode collections .
32,405
public void setRevokedStart ( Date revokedStart ) throws InvalidArgumentException { if ( revokedStart == null ) { throw new InvalidArgumentException ( "Date can't be null" ) ; } queryParms . put ( "revoked_start" , Util . dateToString ( revokedStart ) ) ; }
Get certificates that have been revoked after this date
32,406
public void setRevokedEnd ( Date revokedEnd ) throws InvalidArgumentException { if ( revokedEnd == null ) { throw new InvalidArgumentException ( "Date can't be null" ) ; } queryParms . put ( "revoked_end" , Util . dateToString ( revokedEnd ) ) ; }
Get certificates that have been revoked before this date
32,407
public void setExpiredStart ( Date expiredStart ) throws InvalidArgumentException { if ( expiredStart == null ) { throw new InvalidArgumentException ( "Date can't be null" ) ; } queryParms . put ( "expired_start" , Util . dateToString ( expiredStart ) ) ; }
Get certificates that have expired after this date
32,408
public void setExpiredEnd ( Date expiredEnd ) throws InvalidArgumentException { if ( expiredEnd == null ) { throw new InvalidArgumentException ( "Date can't be null" ) ; } queryParms . put ( "expired_end" , Util . dateToString ( expiredEnd ) ) ; }
Get certificates that have expired before this date
32,409
public static byte [ ] calculateBlockHash ( HFClient client , long blockNumber , byte [ ] previousHash , byte [ ] dataHash ) throws IOException , InvalidArgumentException { if ( previousHash == null ) { throw new InvalidArgumentException ( "previousHash parameter is null." ) ; } if ( dataHash == null ) { throw new Inva...
used asn1 and get hash
32,410
private JsonObject toJsonObject ( ) { JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( enrollmentID != null ) { factory . add ( "id" , enrollmentID ) ; } else { factory . add ( "serial" , serial ) ; factory . add ( "aki" , aki ) ; } if ( null != reason ) { factory . add ( "reason" , reason ) ; } if ( c...
Convert the revocation request to a JSON object
32,411
public static boolean computeUpdate ( String channelId , Configtx . Config original , Configtx . Config update , Configtx . ConfigUpdate . Builder configUpdateBuilder ) { Configtx . ConfigGroup . Builder readSetBuilder = Configtx . ConfigGroup . newBuilder ( ) ; Configtx . ConfigGroup . Builder writeSetBuilder = Config...
not an api
32,412
public ChaincodeID getChaincodeID ( ) throws InvalidArgumentException { try { if ( chaincodeID == null ) { Header header = Header . parseFrom ( proposal . getHeader ( ) ) ; Common . ChannelHeader channelHeader = Common . ChannelHeader . parseFrom ( header . getChannelHeader ( ) ) ; ChaincodeHeaderExtension chaincodeHea...
Chaincode ID that was executed .
32,413
public byte [ ] getChaincodeActionResponsePayload ( ) throws InvalidArgumentException { if ( isInvalid ( ) ) { throw new InvalidArgumentException ( "Proposal response is invalid." ) ; } try { final ProposalResponsePayloadDeserializer proposalResponsePayloadDeserializer = getProposalResponsePayloadDeserializer ( ) ; Byt...
ChaincodeActionResponsePayload is the result of the executing chaincode .
32,414
public int getChaincodeActionResponseStatus ( ) throws InvalidArgumentException { if ( statusReturnCode != - 1 ) { return statusReturnCode ; } try { final ProposalResponsePayloadDeserializer proposalResponsePayloadDeserializer = getProposalResponsePayloadDeserializer ( ) ; statusReturnCode = proposalResponsePayloadDese...
getChaincodeActionResponseStatus returns the what chaincode executions set as the return status .
32,415
public TxReadWriteSetInfo getChaincodeActionResponseReadWriteSetInfo ( ) throws InvalidArgumentException { if ( isInvalid ( ) ) { throw new InvalidArgumentException ( "Proposal response is invalid." ) ; } try { final ProposalResponsePayloadDeserializer proposalResponsePayloadDeserializer = getProposalResponsePayloadDes...
getChaincodeActionResponseReadWriteSetInfo get this proposals read write set .
32,416
public PrivateKey bytesToPrivateKey ( byte [ ] pemKey ) throws CryptoException { PrivateKey pk = null ; CryptoException ce = null ; try { PemReader pr = new PemReader ( new StringReader ( new String ( pemKey ) ) ) ; PemObject po = pr . readPemObject ( ) ; PEMParser pem = new PEMParser ( new StringReader ( new String ( ...
Return PrivateKey from pem bytes .
32,417
public void addCACertificatesToTrustStore ( BufferedInputStream bis ) throws CryptoException , InvalidArgumentException { if ( bis == null ) { throw new InvalidArgumentException ( "The certificate stream bis cannot be null" ) ; } try { final Collection < ? extends Certificate > certificates = cf . generateCertificates ...
addCACertificatesToTrustStore adds a CA certs in a stream to the trust store used for signature validation
32,418
boolean validateCertificate ( byte [ ] certPEM ) { if ( certPEM == null ) { return false ; } try { X509Certificate certificate = getX509Certificate ( certPEM ) ; if ( null == certificate ) { throw new Exception ( "Certificate transformation returned null" ) ; } return validateCertificate ( certificate ) ; } catch ( Exc...
validateCertificate checks whether the given certificate is trusted . It checks if the certificate is signed by one of the trusted certs in the trust store .
32,419
void setSecurityLevel ( final int securityLevel ) throws InvalidArgumentException { logger . trace ( format ( "setSecurityLevel to %d" , securityLevel ) ) ; if ( securityCurveMapping . isEmpty ( ) ) { throw new InvalidArgumentException ( "Security curve mapping has no entries." ) ; } if ( ! securityCurveMapping . conta...
Security Level determines the elliptic curve used in key generation
32,420
private static BigInteger [ ] decodeECDSASignature ( byte [ ] signature ) throws Exception { try ( ByteArrayInputStream inStream = new ByteArrayInputStream ( signature ) ) { ASN1InputStream asnInputStream = new ASN1InputStream ( inStream ) ; ASN1Primitive asn1 = asnInputStream . readObject ( ) ; BigInteger [ ] sigs = n...
Decodes an ECDSA signature and returns a two element BigInteger array .
32,421
private byte [ ] ecdsaSignToBytes ( ECPrivateKey privateKey , byte [ ] data ) throws CryptoException { if ( data == null ) { throw new CryptoException ( "Data that to be signed is null." ) ; } if ( data . length == 0 ) { throw new CryptoException ( "Data to be signed was empty." ) ; } try { X9ECParameters params = ECNa...
Sign data with the specified elliptic curve private key .
32,422
private String certificationRequestToPEM ( PKCS10CertificationRequest csr ) throws IOException { PemObject pemCSR = new PemObject ( "CERTIFICATE REQUEST" , csr . getEncoded ( ) ) ; StringWriter str = new StringWriter ( ) ; JcaPEMWriter pemWriter = new JcaPEMWriter ( str ) ; pemWriter . writeObject ( pemCSR ) ; pemWrite...
certificationRequestToPEM - Convert a PKCS10CertificationRequest to PEM format .
32,423
private void resetConfiguration ( ) throws CryptoException , InvalidArgumentException { setSecurityLevel ( securityLevel ) ; setHashAlgorithm ( hashAlgorithm ) ; try { cf = CertificateFactory . getInstance ( CERTIFICATE_FORMAT ) ; } catch ( CertificateException e ) { CryptoException ex = new CryptoException ( "Cannot i...
Resets curve name hash algorithm and cert factory . Call this method when a config value changes
32,424
public String getPackageId ( ) throws ProposalException { Lifecycle . QueryInstalledChaincodeResult queryInstalledChaincodeResult = parsePayload ( ) ; if ( queryInstalledChaincodeResult == null ) { return null ; } return queryInstalledChaincodeResult . getPackageId ( ) ; }
The packageId for this chaincode .
32,425
public static HFCAClient createNewInstance ( NetworkConfig . CAInfo caInfo ) throws MalformedURLException , InvalidArgumentException { try { return createNewInstance ( caInfo , CryptoSuite . Factory . getCryptoSuite ( ) ) ; } catch ( MalformedURLException e ) { throw e ; } catch ( Exception e ) { throw new InvalidArgum...
Create HFCAClient from a NetworkConfig . CAInfo using default crypto suite .
32,426
public static HFCAClient createNewInstance ( NetworkConfig . CAInfo caInfo , CryptoSuite cryptoSuite ) throws MalformedURLException , InvalidArgumentException { if ( null == caInfo ) { throw new InvalidArgumentException ( "The caInfo parameter can not be null." ) ; } if ( null == cryptoSuite ) { throw new InvalidArgume...
Create HFCAClient from a NetworkConfig . CAInfo
32,427
public String register ( RegistrationRequest request , User registrar ) throws RegistrationException , InvalidArgumentException { if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( Utils . isNullOrEmpty ( request . getEnrollmentID ( ) ) ) { throw new InvalidArgumen...
Register a user .
32,428
public HFCAInfo info ( ) throws InfoException , InvalidArgumentException { logger . debug ( format ( "info url:%s" , url ) ) ; if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } setUpSSL ( ) ; try { JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( caNam...
Return information on the Fabric Certificate Authority . No credentials are needed for this API .
32,429
public Enrollment reenroll ( User user , EnrollmentRequest req ) throws EnrollmentException , InvalidArgumentException { if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( user == null ) { throw new InvalidArgumentException ( "reenrollment user is missing" ) ; } if...
Re - Enroll the user with member service
32,430
public void revoke ( User revoker , Enrollment enrollment , String reason ) throws RevocationException , InvalidArgumentException { revokeInternal ( revoker , enrollment , reason , false ) ; }
revoke one enrollment of user
32,431
public void revoke ( User revoker , String serial , String aki , String reason ) throws RevocationException , InvalidArgumentException { revokeInternal ( revoker , serial , aki , reason , false ) ; }
revoke one certificate
32,432
public String generateCRL ( User registrar , Date revokedBefore , Date revokedAfter , Date expireBefore , Date expireAfter ) throws InvalidArgumentException , GenerateCRLException { if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( registrar == null ) { throw new ...
Generate certificate revocation list .
32,433
public Collection < HFCAIdentity > getHFCAIdentities ( User registrar ) throws IdentityException , InvalidArgumentException { if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } logger . debug ( format ( "identity url: %s, registrar: %s" , url , registrar . getNam...
gets all identities that the registrar is allowed to see
32,434
public HFCAAffiliation getHFCAAffiliations ( User registrar ) throws AffiliationException , InvalidArgumentException { if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member"...
gets all affiliations that the registrar is allowed to see
32,435
public HFCACertificateResponse getHFCACertificates ( User registrar , HFCACertificateRequest req ) throws HFCACertificateException { try { logger . debug ( format ( "certificate url: %s, registrar: %s" , HFCA_CERTIFICATE , registrar . getName ( ) ) ) ; JsonObject result = httpGet ( HFCA_CERTIFICATE , registrar , req . ...
Gets all certificates that the registrar is allowed to see and based on filter parameters that are part of the certificate request .
32,436
String httpPost ( String url , String body , UsernamePasswordCredentials credentials ) throws Exception { logger . debug ( format ( "httpPost %s, body:%s" , url , body ) ) ; final HttpClientBuilder httpClientBuilder = HttpClientBuilder . create ( ) ; CredentialsProvider provider = null ; if ( credentials != null ) { pr...
Http Post Request .
32,437
public int read ( User registrar ) throws IdentityException , InvalidArgumentException { if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } String readIdURL = "" ; try { readIdURL = HFCA_IDENTITY + "/" + enrollmentID ; logger . debug ( format ( "identity url: %s,...
read retrieves a specific identity
32,438
public int create ( User registrar ) throws IdentityException , InvalidArgumentException { if ( this . deleted ) { throw new IdentityException ( "Identity has been deleted" ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } String createURL = "" ; try { crea...
create an identity
32,439
public int update ( User registrar ) throws IdentityException , InvalidArgumentException { if ( this . deleted ) { throw new IdentityException ( "Identity has been deleted" ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } String updateURL = "" ; try { upda...
update an identity
32,440
public int delete ( User registrar ) throws IdentityException , InvalidArgumentException { if ( this . deleted ) { throw new IdentityException ( "Identity has been deleted" ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } String deleteURL = "" ; try { dele...
delete an identity
32,441
public static String generateDirectoryHash ( String rootDir , String chaincodeDir , String hash ) throws IOException { Path projectPath = null ; if ( rootDir == null ) { projectPath = Paths . get ( chaincodeDir ) ; } else { projectPath = Paths . get ( rootDir , chaincodeDir ) ; } File dir = projectPath . toFile ( ) ; i...
Generate hash of a chaincode directory
32,442
public static byte [ ] generateTarGz ( File sourceDirectory , String pathPrefix , File chaincodeMetaInf ) throws IOException { logger . trace ( format ( "generateTarGz: sourceDirectory: %s, pathPrefix: %s, chaincodeMetaInf: %s" , sourceDirectory == null ? "null" : sourceDirectory . getAbsolutePath ( ) , pathPrefix , ch...
Compress the contents of given directory using Tar and Gzip to an in - memory byte array .
32,443
public static byte [ ] readFile ( File input ) throws IOException { return Files . readAllBytes ( Paths . get ( input . getAbsolutePath ( ) ) ) ; }
Read the contents a file .
32,444
public static void deleteFileOrDirectory ( File file ) throws IOException { if ( file . exists ( ) ) { if ( file . isDirectory ( ) ) { Path rootPath = Paths . get ( file . getAbsolutePath ( ) ) ; Files . walk ( rootPath , FileVisitOption . FOLLOW_LINKS ) . sorted ( Comparator . reverseOrder ( ) ) . map ( Path :: toFile...
Delete a file or directory
32,445
public static String combinePaths ( String first , String ... other ) { return Paths . get ( first , other ) . toString ( ) ; }
Combine two or more paths
32,446
public static byte [ ] readFileFromClasspath ( String fileName ) throws IOException { InputStream is = Utils . class . getClassLoader ( ) . getResourceAsStream ( fileName ) ; byte [ ] data = ByteStreams . toByteArray ( is ) ; try { is . close ( ) ; } catch ( IOException ex ) { } return data ; }
Read a file from classpath
32,447
public static Exception checkGrpcUrl ( String url ) { try { parseGrpcUrl ( url ) ; return null ; } catch ( Exception e ) { return e ; } }
Check if the strings Grpc url is valid
32,448
public static String logString ( final String string ) { if ( string == null || string . length ( ) == 0 ) { return string ; } String ret = string . replaceAll ( "[^\\p{Print}]" , "?" ) ; ret = ret . substring ( 0 , Math . min ( ret . length ( ) , MAX_LOG_STRING_LENGTH ) ) + ( ret . length ( ) > MAX_LOG_STRING_LENGTH ?...
Makes logging strings which can be long or with unprintable characters be logged and trimmed .
32,449
public Map < Integer , String > getSecurityCurveMapping ( ) { if ( curveMapping == null ) { curveMapping = parseSecurityCurveMappings ( getProperty ( SECURITY_CURVE_MAPPING ) ) ; } return Collections . unmodifiableMap ( curveMapping ) ; }
Get a mapping from strength to curve desired .
32,450
public DiagnosticFileDumper getDiagnosticFileDumper ( ) { if ( diagnosticFileDumper != null ) { return diagnosticFileDumper ; } String dd = sdkProperties . getProperty ( DIAGNOTISTIC_FILE_DIRECTORY ) ; if ( dd != null ) { diagnosticFileDumper = DiagnosticFileDumper . configInstance ( new File ( dd ) ) ; } return diagno...
The directory where diagnostic dumps are to be place null if none should be done .
32,451
public Boolean getLifecycleInitRequiredDefault ( ) { String property = getProperty ( LIFECYCLE_INITREQUIREDDEFAULT ) ; if ( property != null ) { return Boolean . parseBoolean ( property ) ; } return null ; }
Whether require init method in chaincode to be run . The default will return null which will not set the Fabric protobuf value which then sets false . False is the Fabric default .
32,452
public void setChaincodeInputStream ( InputStream chaincodeInputStream ) throws InvalidArgumentException { if ( chaincodeInputStream == null ) { throw new InvalidArgumentException ( "Chaincode input stream may not be null." ) ; } if ( chaincodeSourceLocation != null ) { throw new InvalidArgumentException ( "Error setti...
Chaincode input stream containing the actual chaincode . Only format supported is a tar zip compressed input of the source . Only input stream or source location maybe used at the same time . The contents of the stream are not validated or inspected by the SDK .
32,453
public void setChaincodeSourceLocation ( File chaincodeSourceLocation ) throws InvalidArgumentException { if ( chaincodeSourceLocation == null ) { throw new InvalidArgumentException ( "Chaincode source location may not be null." ) ; } if ( chaincodeInputStream != null ) { throw new InvalidArgumentException ( "Error set...
The location of the chaincode . Chaincode input stream and source location can not both be set .
32,454
public void setChaincodeCollectionConfiguration ( ChaincodeCollectionConfiguration collectionConfigPackage ) throws InvalidArgumentException { if ( null == collectionConfigPackage ) { throw new InvalidArgumentException ( "The parameter collectionConfigPackage may not be null." ) ; } this . collectionConfigPackage = col...
The collection configuration for the approval being queried for .
32,455
public Channel addPeer ( Peer peer , PeerOptions peerOptions ) throws InvalidArgumentException { if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( null == peer ) { throw new InvalidArgumentException ( "Peer is invalid can not be null." ) ; } if ( peer . ...
Add a peer to the channel
32,456
public Channel addOrderer ( Orderer orderer ) throws InvalidArgumentException { if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( null == orderer ) { throw new InvalidArgumentException ( "Orderer is invalid can not be null." ) ; } logger . debug ( format...
Add an Orderer to this channel .
32,457
public Collection < Peer > getPeers ( EnumSet < PeerRole > roles ) { Set < Peer > ret = new HashSet < > ( getPeers ( ) . size ( ) ) ; for ( PeerRole peerRole : roles ) { ret . addAll ( peerRoleSetMap . get ( peerRole ) ) ; } return Collections . unmodifiableCollection ( ret ) ; }
Get the peers for this channel .
32,458
PeerOptions setPeerOptions ( Peer peer , PeerOptions peerOptions ) throws InvalidArgumentException { if ( initialized ) { throw new InvalidArgumentException ( format ( "Channel %s already initialized." , name ) ) ; } checkPeer ( peer ) ; PeerOptions ret = getPeersOptions ( peer ) ; removePeerInternal ( peer ) ; addPeer...
Set peerOptions in the channel that has not be initialized yet .
32,459
public Channel initialize ( ) throws InvalidArgumentException , TransactionException { logger . debug ( format ( "Channel %s initialize shutdown %b" , name , shutdown ) ) ; if ( isInitialized ( ) ) { return this ; } if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name )...
Initialize the Channel . Starts the channel . event hubs will connect .
32,460
protected synchronized void loadCACertificates ( boolean force ) throws InvalidArgumentException , CryptoException , TransactionException { if ( ! force && msps != null && ! msps . isEmpty ( ) ) { return ; } logger . debug ( format ( "Channel %s loadCACertificates" , name ) ) ; Map < String , MSP > lmsp = parseConfigBl...
load the peer organizations CA certificates into the channel s trust store so that we can verify signatures from peer messages
32,461
public byte [ ] getUpdateChannelConfigurationSignature ( UpdateChannelConfiguration updateChannelConfiguration , User signer ) throws InvalidArgumentException { userContextCheck ( signer ) ; if ( null == updateChannelConfiguration ) { throw new InvalidArgumentException ( "channelConfiguration is null" ) ; } try { Trans...
Get signed byes of the update channel .
32,462
private Block getConfigurationBlock ( ) throws TransactionException { logger . debug ( format ( "getConfigurationBlock for channel %s" , name ) ) ; try { Orderer orderer = getRandomOrderer ( ) ; long lastConfigIndex = getLastConfigIndex ( orderer ) ; logger . debug ( format ( "Last config index is %d" , lastConfigIndex...
Provide the Channel s latest raw Configuration Block .
32,463
Collection < ProposalResponse > sendInstallProposal ( InstallProposalRequest installProposalRequest ) throws ProposalException , InvalidArgumentException { return sendInstallProposal ( installProposalRequest , getChaincodePeers ( ) ) ; }
Send install chaincode request proposal to all the channels on the peer .
32,464
Collection < ProposalResponse > sendInstallProposal ( InstallProposalRequest installProposalRequest , Collection < Peer > peers ) throws ProposalException , InvalidArgumentException { checkChannelState ( ) ; checkPeers ( peers ) ; if ( null == installProposalRequest ) { throw new InvalidArgumentException ( "InstallProp...
Send install chaincode request proposal to the channel .
32,465
public BlockInfo queryBlockByHash ( byte [ ] blockHash ) throws InvalidArgumentException , ProposalException { return queryBlockByHash ( getShuffledPeers ( EnumSet . of ( PeerRole . LEDGER_QUERY ) ) , blockHash ) ; }
query this channel for a Block by the block hash . The request is retried on each peer on the channel till successful .
32,466
public BlockInfo queryBlockByHash ( Collection < Peer > peers , byte [ ] blockHash ) throws InvalidArgumentException , ProposalException { return queryBlockByHash ( peers , blockHash , client . getUserContext ( ) ) ; }
Query a peer in this channel for a Block by the block hash . Each peer is tried until successful response .
32,467
public BlockInfo queryBlockByNumber ( long blockNumber ) throws InvalidArgumentException , ProposalException { return queryBlockByNumber ( getShuffledPeers ( EnumSet . of ( PeerRole . LEDGER_QUERY ) ) , blockNumber ) ; }
query this channel for a Block by the blockNumber . The request is retried on all peers till successful
32,468
public BlockInfo queryBlockByNumber ( Peer peer , long blockNumber ) throws InvalidArgumentException , ProposalException { return queryBlockByNumber ( Collections . singleton ( peer ) , blockNumber ) ; }
Query a peer in this channel for a Block by the blockNumber
32,469
public BlockInfo queryBlockByTransactionID ( String txID ) throws InvalidArgumentException , ProposalException { return queryBlockByTransactionID ( getShuffledPeers ( EnumSet . of ( PeerRole . LEDGER_QUERY ) ) , txID ) ; }
query this channel for a Block by a TransactionID contained in the block The request is tried on on each peer till successful .
32,470
public Collection < LifecycleCommitChaincodeDefinitionProposalResponse > sendLifecycleCommitChaincodeDefinitionProposal ( LifecycleCommitChaincodeDefinitionRequest lifecycleCommitChaincodeDefinitionRequest , Collection < Peer > peers ) throws InvalidArgumentException , ProposalException { if ( null == lifecycleCommitCh...
Commit chaincode final approval to run on all organizations that have approved .
32,471
public Collection < LifecycleQueryNamespaceDefinitionsProposalResponse > lifecycleQueryNamespaceDefinitions ( LifecycleQueryNamespaceDefinitionsRequest queryNamespaceDefinitionsRequest , Collection < Peer > peers ) throws InvalidArgumentException , ProposalException { if ( null == queryNamespaceDefinitionsRequest ) { t...
Query namespaces . Takes no specific arguments returns namespaces including chaincode names that have been committed .
32,472
public Collection < LifecycleQueryApprovalStatusProposalResponse > sendLifecycleQueryApprovalStatusRequest ( LifecycleQueryApprovalStatusRequest lifecycleQueryApprovalStatusRequest , Collection < Peer > peers ) throws InvalidArgumentException , ProposalException { if ( null == lifecycleQueryApprovalStatusRequest ) { th...
Query approval status for all organizations .
32,473
public Collection < LifecycleQueryChaincodeDefinitionProposalResponse > lifecycleQueryChaincodeDefinition ( QueryLifecycleQueryChaincodeDefinitionRequest queryLifecycleQueryChaincodeDefinitionRequest , Collection < Peer > peers ) throws InvalidArgumentException , ProposalException { if ( null == queryLifecycleQueryChai...
lifecycleQueryChaincodeDefinition get definition of chaincode .
32,474
public List < ChaincodeInfo > queryInstantiatedChaincodes ( Peer peer ) throws InvalidArgumentException , ProposalException { return queryInstantiatedChaincodes ( peer , client . getUserContext ( ) ) ; }
Query peer for chaincode that has been instantiated
32,475
public CollectionConfigPackage queryCollectionsConfig ( String chaincodeName , Peer peer , User userContext ) throws InvalidArgumentException , ProposalException { if ( isNullOrEmpty ( chaincodeName ) ) { throw new InvalidArgumentException ( "Parameter chaincodeName expected to be non null or empty string." ) ; } check...
Get information on the collections used by the chaincode .
32,476
public Collection < ProposalResponse > sendTransactionProposal ( TransactionProposalRequest transactionProposalRequest , Collection < Peer > peers ) throws ProposalException , InvalidArgumentException { return sendProposal ( transactionProposalRequest , peers ) ; }
Send a transaction proposal to specific peers .
32,477
public CompletableFuture < TransactionEvent > sendTransaction ( Collection < ProposalResponse > proposalResponses , User userContext ) { return sendTransaction ( proposalResponses , getOrderers ( ) , userContext ) ; }
Send transaction to one of the orderers on the channel using a specific user context .
32,478
public CompletableFuture < TransactionEvent > sendTransaction ( Collection < ? extends ProposalResponse > proposalResponses , Collection < Orderer > orderers ) { return sendTransaction ( proposalResponses , orderers , client . getUserContext ( ) ) ; }
Send transaction to one of the specified orderers using the usercontext set on the client ..
32,479
private String getRespData ( BroadcastResponse resp ) { StringBuilder respdata = new StringBuilder ( 400 ) ; if ( resp != null ) { Status status = resp . getStatus ( ) ; if ( null != status ) { respdata . append ( status . name ( ) ) ; respdata . append ( "-" ) ; respdata . append ( status . getNumber ( ) ) ; } String ...
Build response details
32,480
public String registerBlockListener ( BlockListener listener ) throws InvalidArgumentException { if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( null == listener ) { throw new InvalidArgumentException ( "Listener parameter is null." ) ; } String handle...
Register a block listener .
32,481
public boolean unregisterBlockListener ( String handle ) throws InvalidArgumentException { if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } checkHandle ( BLOCK_LISTENER_TAG , handle ) ; logger . trace ( format ( "Unregister BlockListener with handle %s." , h...
Unregister a block listener .
32,482
private String registerTransactionListenerProcessor ( ) throws InvalidArgumentException { logger . debug ( format ( "Channel %s registerTransactionListenerProcessor starting" , name ) ) ; return registerBlockListener ( blockEvent -> { HFClient lclient = client ; if ( null == lclient || shutdown ) { return ; } final Str...
Own block listener to manage transactions .
32,483
private CompletableFuture < TransactionEvent > registerTxListener ( String txid , NOfEvents nOfEvents , boolean failFast ) { CompletableFuture < TransactionEvent > future = new CompletableFuture < > ( ) ; new TL ( txid , future , nOfEvents , failFast ) ; return future ; }
Register a transactionId that to get notification on when the event is seen in the block chain .
32,484
public String registerChaincodeEventListener ( Pattern chaincodeId , Pattern eventName , ChaincodeEventListener chaincodeEventListener ) throws InvalidArgumentException { if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( chaincodeId == null ) { throw new...
Register a chaincode event listener . Both chaincodeId pattern AND eventName pattern must match to invoke the chaincodeEventListener
32,485
public boolean unregisterChaincodeEventListener ( String handle ) throws InvalidArgumentException { boolean ret ; if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } checkHandle ( CHAINCODE_EVENTS_TAG , handle ) ; synchronized ( chainCodeListeners ) { ret = nul...
Unregister an existing chaincode event listener .
32,486
public synchronized void shutdown ( boolean force ) { if ( shutdown ) { return ; } String ltransactionListenerProcessorHandle = transactionListenerProcessorHandle ; transactionListenerProcessorHandle = null ; if ( null != ltransactionListenerProcessorHandle ) { try { unregisterBlockListener ( ltransactionListenerProces...
Shutdown the channel with all resources released .
32,487
public void serializeChannel ( File file ) throws IOException , InvalidArgumentException { if ( null == file ) { throw new InvalidArgumentException ( "File parameter may not be null" ) ; } Files . write ( Paths . get ( file . getAbsolutePath ( ) ) , serializeChannel ( ) , StandardOpenOption . CREATE , StandardOpenOptio...
Serialize channel to a file using Java serialization . Deserialized channel will NOT be in an initialized state .
32,488
public byte [ ] serializeChannel ( ) throws IOException , InvalidArgumentException { if ( isShutdown ( ) ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , getName ( ) ) ) ; } ObjectOutputStream out = null ; try { ByteArrayOutputStream bai = new ByteArrayOutputStream ( ) ; out = new Obj...
Serialize channel to a byte array using Java serialization . Deserialized channel will NOT be in an initialized state .
32,489
public static int getProofBytes ( RevocationAlgorithm alg ) { if ( alg == null ) { throw new IllegalArgumentException ( "Revocation algorithm cannot be null" ) ; } switch ( alg ) { case ALG_NO_REVOCATION : return 0 ; default : throw new IllegalArgumentException ( "Unsupported RevocationAlgorithm: " + alg . name ( ) ) ;...
Depending on the selected revocation algorithm the proof data length will be different . This method will give the proof length for any supported revocation algorithm .
32,490
public static java . security . KeyPair generateLongTermRevocationKey ( ) { try { KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "EC" ) ; SecureRandom random = new SecureRandom ( ) ; AlgorithmParameterSpec params = new ECGenParameterSpec ( "secp384r1" ) ; keyGen . initialize ( params , random ) ; return key...
Generate a long term ECDSA key pair used for revocation
32,491
public static Idemix . CredentialRevocationInformation createCRI ( PrivateKey key , BIG [ ] unrevokedHandles , int epoch , RevocationAlgorithm alg ) throws CryptoException { Idemix . CredentialRevocationInformation . Builder builder = Idemix . CredentialRevocationInformation . newBuilder ( ) ; builder . setRevocationAl...
Creates a Credential Revocation Information object
32,492
public static boolean verifyEpochPK ( PublicKey pk , Idemix . ECP2 epochPK , byte [ ] epochPkSig , long epoch , RevocationAlgorithm alg ) throws CryptoException { Idemix . CredentialRevocationInformation . Builder builder = Idemix . CredentialRevocationInformation . newBuilder ( ) ; builder . setRevocationAlg ( alg . o...
Verifies that the revocation PK for a certain epoch is valid by checking that it was signed with the long term revocation key
32,493
public Identities . SerializedIdentity createSerializedIdentity ( ) { MspPrincipal . OrganizationUnit ou = MspPrincipal . OrganizationUnit . newBuilder ( ) . setCertifiersIdentifier ( ByteString . copyFrom ( this . ipkHash ) ) . setMspIdentifier ( this . mspId ) . setOrganizationalUnitIdentifier ( this . ou ) . build (...
Serialize Idemix Identity
32,494
JsonObject toJsonObject ( ) { JsonObjectBuilder ob = Json . createObjectBuilder ( ) ; ob . add ( "id" , enrollmentID ) ; ob . add ( "type" , type ) ; if ( this . secret != null ) { ob . add ( "secret" , secret ) ; } if ( null != maxEnrollments ) { ob . add ( "max_enrollments" , maxEnrollments ) ; } if ( affiliation != ...
Convert the registration request to a JSON object
32,495
public Collection < String > getChaincodeNamespaceTypes ( ) throws ProposalException { final Lifecycle . QueryNamespaceDefinitionsResult queryNamespaceDefinitionsResult = parsePayload ( ) ; if ( queryNamespaceDefinitionsResult == null ) { return Collections . emptySet ( ) ; } final Map < String , Lifecycle . QueryNames...
The names of chaincode that have been committed .
32,496
public String encode ( ) throws IOException { FastStringWriter fsw = new FastStringWriter ( ) ; try { fsw . write ( "{" ) ; ChartUtils . writeDataValue ( fsw , "display" , this . display , false ) ; ChartUtils . writeDataValue ( fsw , "color" , this . color , true ) ; ChartUtils . writeDataValue ( fsw , "lineWidth" , t...
Write the options of angled lines on radial linear type
32,497
private String guessImageFormat ( String contentType , String imagePath ) throws IOException { String format = "png" ; if ( contentType == null ) { contentType = URLConnection . guessContentTypeFromName ( imagePath ) ; } if ( contentType != null ) { format = contentType . replaceFirst ( "^image/([^;]+)[;]?.*$" , "$1" )...
Attempt to obtain the image format used to write the image from the contentType or the image s file extension .
32,498
public static void writeDataValue ( Writer fsw , String optionName , Object value , boolean hasComma ) throws IOException { if ( value == null ) { return ; } boolean isList = value instanceof List ; if ( hasComma ) { fsw . write ( "," ) ; } fsw . write ( "\"" + optionName + "\":" ) ; if ( isList ) { fsw . write ( "[" )...
Write the value of chartJs options
32,499
public String encode ( ) throws IOException { FastStringWriter fsw = new FastStringWriter ( ) ; try { fsw . write ( "{" ) ; fsw . write ( super . encode ( ) ) ; ChartUtils . writeDataValue ( fsw , "beginAtZero" , this . beginAtZero , true ) ; ChartUtils . writeDataValue ( fsw , "backdropColor" , this . backdropColor , ...
Write the radial linear ticks