├── LICENSE ├── README.md ├── common-entity ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── common │ └── entity │ ├── ConsensusAlgorithmEnum.java │ ├── Enum │ ├── ActionTypeEnum.java │ ├── PeerActionTypeEnum.java │ └── VersionEnum.java │ ├── Hashable.java │ ├── QueryPeerParam.java │ ├── VerifiableData.java │ ├── block │ ├── Block.java │ ├── BlockDataResp.java │ ├── BlockDetailResp.java │ ├── BlockHeader.java │ ├── BlockHeaderBasicParam.java │ └── BlockResp.java │ ├── cert │ ├── BaseCertConfig.java │ ├── CertBCStyle.java │ ├── CertData.java │ ├── RootCertData.java │ ├── UserCsrAndCertData.java │ └── UserCsrCertData.java │ ├── chain │ ├── AddMySelfToChannelRequest.java │ ├── AddPeer2ChannelToken.java │ ├── Channel.java │ ├── ChannelBasicParams.java │ ├── ChannelBlockMaxSizeApproval.java │ ├── ChannelBlockMaxSizeRequest.java │ ├── ChannelChange.java │ ├── ChannelChangeEnum.java │ ├── ChannelConnectState.java │ ├── ChannelDynamicParams.java │ ├── ChannelInitParams.java │ ├── ChannelModifyRecord.java │ ├── ChannelModifyStrategyEnum.java │ ├── ChannelShort.java │ ├── ChannelSummary.java │ ├── ConnectState.java │ ├── ConnectStateEnum.java │ ├── CreateChannel.java │ ├── ExistMySelfFromChannelRequest.java │ ├── MemberAddChannelStrategyEnum.java │ ├── MemberModifyChannelStrategyEnum.java │ ├── MemberRemoveChannelStrategyEnum.java │ ├── NetworkConnectState.java │ ├── Peer.java │ ├── PeerAddChannelApproval.java │ ├── PeerAddChannelStrategyEnum.java │ ├── PeerBasicParams.java │ ├── PeerCert.java │ ├── PeerCertificate.java │ ├── PeerCertificateCipher.java │ ├── PeerCertificateStateApproval.java │ ├── PeerCertificateStateRequest.java │ ├── PeerCertificateUpdateApproval.java │ ├── PeerCertificateUpdateParams.java │ ├── PeerChannelIssuerParams.java │ ├── PeerChannelOperationRecord.java │ ├── PeerChannelParams.java │ ├── PeerChannelRelation.java │ ├── PeerFrozenUnFrozen.java │ ├── PeerFrozenUnFrozenApproval.java │ ├── PeerInfo.java │ ├── PeerModifyChannelStrategyEnum.java │ ├── PeerOrganization.java │ ├── PeerOrganizationParams.java │ ├── PeerRemoveChannelStrategyEnum.java │ ├── PeerServiceTypeEnum.java │ ├── PeerServiceUrl.java │ ├── PeerServiceUrls.java │ ├── PeerStage.java │ ├── PeerStageEnum.java │ ├── RemovePeerFromChannelRequest.java │ ├── RemovePeerFromChannelToken.java │ ├── RoleAddStrategyEnum.java │ ├── RoleDelStrategyEnum.java │ ├── RoleModifyStrategyEnum.java │ ├── SimplifyChannel.java │ ├── UpdateChannelMasterPublicKeyRequest.java │ └── UpdateChannelPeerPrivateKeyRequest.java │ ├── common │ ├── annotation │ │ ├── AnnotationConstant.java │ │ ├── CustomRoleToken.java │ │ ├── VerifyAuth.java │ │ └── VerifyPeer.java │ ├── base │ │ ├── BaseApproval.java │ │ ├── BaseResponse.java │ │ ├── BaseTransHashResp.java │ │ ├── BizVO.java │ │ ├── CallbackBaseReq.java │ │ ├── CallbackEnum.java │ │ ├── ListResponse.java │ │ ├── NewspiralStateCodes.java │ │ ├── ResponseUtil.java │ │ └── test.java │ ├── logmodule │ │ ├── LogClient.java │ │ └── LogModuleCodes.java │ ├── persist │ │ ├── Action.java │ │ ├── PersistActionInterface.java │ │ └── PersistConstant.java │ └── utils │ │ ├── CloneUtils.java │ │ ├── DateUtil.java │ │ └── PropertyConstantsUtils.java │ ├── config │ ├── ChannelShardingInfo.java │ ├── ConfigConstant.java │ └── LocalConfig.java │ ├── consensus │ ├── BlockVoteMsg.java │ ├── ConsensusContextTest.java │ ├── ConsensusStageEnum.java │ ├── CurrentConsensusState.java │ ├── GenericMsg.java │ ├── GenericQC.java │ ├── HotStuffDataNode.java │ ├── HotStuffDataNodeResp.java │ ├── HotStuffMsg.java │ ├── NewViewMsg.java │ ├── PeerConsensusStateResp.java │ ├── PerformanceContext.java │ ├── QueryViewNoResp.java │ └── View.java │ ├── ddos │ ├── ClassLimitParam.java │ ├── ClassTypeEnum.java │ ├── ConstraintTypeEnum.java │ ├── DDOSEnum.java │ ├── Interface.java │ ├── InterfaceEnum.java │ ├── IpConstraintList.java │ ├── IpConstraintListParam.java │ └── LimitParam.java │ ├── exception │ ├── DataVerifyEnum.java │ ├── NewSpiralErrorEnum.java │ └── NewspiralException.java │ ├── identity │ ├── Identity.java │ ├── IdentityKey.java │ ├── IdentityKeyBrief.java │ ├── IdentityTypeEnum.java │ └── SignerIdentityKey.java │ ├── member │ ├── Auth.java │ ├── Member.java │ ├── MemberAddApproval.java │ ├── MemberAddRoleStrategyEnum.java │ ├── MemberDeleteApproval.java │ ├── MemberDeleteInfo.java │ ├── MemberInfo.java │ ├── MemberRemoveRoleStrategyEnum.java │ ├── MemberStateEnum.java │ ├── MemberUpdateApproval.java │ ├── MemberUpdateInfo.java │ ├── QueryMemberListApproval.java │ ├── QueryMemberListReq.java │ ├── QueryMemberReq.java │ ├── QueryRoleApproval.java │ ├── QueryRoleListParams.java │ ├── QueryRoleParams.java │ ├── Role.java │ ├── RoleAdd.java │ ├── RoleAddApproval.java │ ├── RoleDelete.java │ ├── RoleDeleteApproval.java │ ├── RoleStateEnum.java │ ├── RoleUpdate.java │ └── RoleUpdateApproval.java │ ├── paillier │ ├── CommonUtils.java │ ├── PaillierCipher.java │ └── PaillierKeyPair.java │ ├── policy │ ├── NewSpiralPolicy.java │ ├── NewSpiralPolicyException.java │ └── NewSpiralPolicyToken.java │ ├── record │ ├── InterfaceRecord.java │ ├── InterfaceRecordBO.java │ ├── InterfaceRecordSummary.java │ └── PageInfo.java │ ├── sm9 │ ├── Crypto.java │ ├── DecryptMasterKeyPair.java │ ├── EncryptMasterKeyPair.java │ ├── G1KeyPair.java │ ├── G1PrivateKey.java │ ├── G1PublicKey.java │ ├── GMProvider.java │ ├── Hex.java │ ├── KGC.java │ ├── MasterKeyPair.java │ ├── MasterPrivateKey.java │ ├── MasterPublicKey.java │ ├── PrivateKey.java │ ├── PrivateKeyType.java │ ├── ResultCipherText.java │ ├── ResultEncapsulate.java │ ├── ResultEncapsulateCipherText.java │ ├── ResultKeyExchange.java │ ├── ResultSignature.java │ ├── SM9.java │ ├── SM9Curve.java │ ├── SM9CurveParameters.java │ ├── SM9SignParam.java │ ├── SM9Utils.java │ ├── pairing │ │ ├── SM9Pairing.java │ │ └── SM9RatePairingMap.java │ ├── sm3 │ │ └── SM3.java │ ├── sm4 │ │ └── SM4.java │ └── sm9Test.java │ ├── smartcontract │ ├── QuerySmartContractListReq.java │ ├── QuerySmartContractReq.java │ ├── SmartContract.java │ ├── SmartContractAuthorizedApproval.java │ ├── SmartContractCallInstnace.java │ ├── SmartContractCompileResp.java │ ├── SmartContractDeployToken.java │ ├── SmartContractDeplyStrategyEnum.java │ ├── SmartContractDepolyRequest.java │ ├── SmartContractInfo.java │ ├── SmartContractModelKeyReq.java │ ├── SmartContractOperationTypeEnum.java │ ├── SmartContractShort.java │ ├── SmartContractStateEnum.java │ ├── SmartContractUpdateStateToken.java │ └── SmartContractsAuthorized.java │ ├── state │ ├── ConfigEnum.java │ ├── ModuleClassification.java │ ├── StateHistory.java │ ├── StateHistoryBO.java │ ├── StateHistoryModel.java │ ├── StateHistoryResp.java │ ├── SyncStateHistoryThreadEnum.java │ ├── WorldState.java │ ├── WorldStateModifyRecord.java │ ├── WorldStateModifyRecordResp.java │ └── WorldStateResp.java │ ├── task │ ├── CodeEnum.java │ ├── EnumUtil.java │ ├── LoggerEnum.java │ ├── TansactionShortResp.java │ ├── Task.java │ ├── TaskStatus.java │ ├── TaskTypeEnum.java │ └── TimeConsuming.java │ ├── transaction │ ├── ExecutedTransaction.java │ ├── PooledTransaction.java │ ├── SDKTransaction.java │ ├── SDKTransactionBasicParam.java │ ├── Transaction.java │ ├── TransactionAttached.java │ ├── TransactionCompile.java │ ├── TransactionResp.java │ └── TxStateEnum.java │ ├── util │ ├── MerkleUtil.java │ ├── OsccaCinpher.java │ └── SpringBeanUtil.java │ └── version │ └── VersionResp.java ├── consensus-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── consensus │ └── hotstuff │ ├── ConsensusMsgProcessor.java │ └── DataVerifier.java ├── consensus ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jinninghui │ │ └── newspiral │ │ └── consensus │ │ └── impl │ │ └── hotstuff │ │ ├── ConsensusContext.java │ │ ├── ConsensusExtendedParamEnum.java │ │ ├── ConsensusMsgProcessorImpl.java │ │ ├── DataVerifierImpl.java │ │ ├── NewSpiralHotStuffProcessor.java │ │ ├── NewSpiralSyncHistoryBlockProcessor.java │ │ ├── PersistBlockProcessor.java │ │ ├── SignForConsensus.java │ │ ├── TransactionExecutionProcessor.java │ │ ├── ViewSyncHelper.java │ │ └── txexecutor │ │ ├── ExecutedTransactionPool.java │ │ ├── SystemSmartContract.java │ │ ├── TxExecutor.java │ │ ├── TxExecutorConsensusCache.java │ │ ├── WaitExecuteTxPool.java │ │ ├── WaitPackageTxPool.java │ │ └── contract │ │ ├── BusinessContractService.java │ │ ├── DefaultContractMonitor.java │ │ ├── SmartContractCache.java │ │ ├── SmartContractClassLoader.java │ │ ├── SmartContractCompile.java │ │ ├── SystemContractService.java │ │ └── compile │ │ ├── CusCompiler.java │ │ ├── JavaStringCompiler.java │ │ ├── MemoryClassLoader.java │ │ └── MemoryJavaFileManager.java │ └── resources │ ├── META-INF │ └── spring │ │ └── hotstuff-service.xml │ └── sofa-module.properties ├── gateway-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── gateway │ ├── ServiceForConsensus.java │ ├── ServiceForPeer.java │ ├── ServiceForSDK.java │ ├── entity │ ├── QueryBlockStateReq.java │ ├── QueryChainStateReq.java │ ├── QueryChainStateResp.java │ ├── QueryChannelReq.java │ ├── QueryHistoryBlockReq.java │ ├── QueryHistoryBlockResp.java │ ├── QueryHistoryQCReq.java │ ├── QueryHistoryQCResp.java │ ├── QueryViewNoReq.java │ └── datasource │ │ ├── AddDataSourceConfigReq.java │ │ ├── ConfigResp.java │ │ ├── DataSourceConfigResp.java │ │ ├── ModifyDataSourceConfigReq.java │ │ ├── QueryShardingConfigResp.java │ │ └── ShardingRuleReq.java │ └── vo │ ├── req │ ├── AddMySelfToChannelReq.java │ ├── BlockHashReq.java │ ├── BlockHeightRegionReq.java │ ├── BlockHeightReq.java │ ├── CertDataReq.java │ ├── ChangeLoggerLevelReq.java │ ├── ChannelBasicParamsReq.java │ ├── ChannelIdReq.java │ ├── ChannelInitReq.java │ ├── ChannelMasterPublicKeyReq.java │ ├── ChannelPeerPrivateKeyReq.java │ ├── ClassLimitParamReq.java │ ├── ExitMySelfFromChannelReq.java │ ├── HeightReq.java │ ├── InterfaceRecordReq.java │ ├── IpConstraintReq.java │ ├── LimitParamReq.java │ ├── PeerChannelIssuerReq.java │ ├── QueryChainStateReq.java │ ├── QueryLatestBlockListReq.java │ ├── QueryTransHashReq.java │ ├── QueryTransactionsByBlockHashReq.java │ ├── QueryTxReq.java │ ├── QueryWorldStateReq.java │ ├── RPCParam.java │ ├── RemovePeerFromChannelReq.java │ ├── SDKTransactionReq.java │ ├── StateHistoryReq.java │ ├── TransAlreadyConsensusByTimeReq.java │ ├── TransBlockHashReq.java │ ├── TransClientTxIdReq.java │ ├── TransHashReq.java │ ├── TransRegionBlockHashReq.java │ ├── UpdatePeerCertificateReq.java │ └── UserCertDataReq.java │ └── resp │ ├── CreateChannelResp.java │ ├── PeerChannelResp.java │ ├── PeerStateResp.java │ └── SystemInformation.java ├── ledger-mgr-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── ledger │ ├── contract │ ├── BusinessBusinessContractExample0.java │ ├── BusinessBusinessContractExample2.java │ ├── BusinessBusinessContractExample3.java │ └── BusinessBusinessContractExample4.java │ ├── fabric │ ├── Chaincode.java │ ├── ChaincodeBaseBusiness.java │ ├── ChaincodeStub.java │ ├── ResponseUtils.java │ ├── SimpleAsset.java │ └── SimpleAsset1.java │ └── mgr │ ├── BlockChangesMap.java │ ├── BlockChangesSnapshots.java │ ├── LedgerMgr.java │ ├── LedgerThreadLocalContext.java │ ├── LocalConfigLedgerMgr.java │ ├── MemberLedgerMgr.java │ ├── SmartContractMgr.java │ ├── StateAccessModeEnum.java │ ├── StateStorage.java │ ├── TransactionModelWithBLOBs.java │ └── contract │ ├── BusinessContractBase.java │ ├── BussinessContractCaller.java │ ├── BussinessContractConnector.java │ ├── ContractBase.java │ └── SystemContractBase.java ├── ledger-mgr ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jinninghui │ │ └── newspiral │ │ └── ledger │ │ └── mgr │ │ └── impl │ │ ├── LedgerCache.java │ │ ├── LedgerMgrImpl.java │ │ ├── LocalConfigLedgerMgrImpl.java │ │ ├── MemberLedgerMgrImpl.java │ │ ├── PersistActionHandler.java │ │ ├── PersistActionHandlerImpl.java │ │ ├── SmartContractMgrImpl.java │ │ ├── domain │ │ ├── AuthModel.java │ │ ├── BlockModel.java │ │ ├── ChannelModel.java │ │ ├── ChannelShardingInfoModel.java │ │ ├── IdentityModel.java │ │ ├── InterfaceModel.java │ │ ├── InterfaceRecordModel.java │ │ ├── InterfaceRecordSummaryModel.java │ │ ├── IpConstraintListModel.java │ │ ├── LocalConfigModel.java │ │ ├── MemberModel.java │ │ ├── MemberRoleModel.java │ │ ├── MessageModel.java │ │ ├── PeerCertificateModel.java │ │ ├── PeerChannelModel.java │ │ ├── PeerChannelModelWithBLOBs.java │ │ ├── PeerModel.java │ │ ├── PersistTaskModel.java │ │ ├── RoleModel.java │ │ ├── SmartContractModel.java │ │ ├── SmartContractModelKey.java │ │ ├── SmartContractModelWithBLOBs.java │ │ ├── StateAttachModel.java │ │ ├── StateModel.java │ │ ├── SystemVersionModel.java │ │ ├── TimeConsumingModel.java │ │ ├── TransactionModel.java │ │ ├── TransactionModelExpandStateHistory.java │ │ └── TransactionModelWithBLOBs.java │ │ ├── mapper │ │ ├── AuthMapper.java │ │ ├── BlockModelMapper.java │ │ ├── ChannelModelMapper.java │ │ ├── IdentityModelMapper.java │ │ ├── InterfaceMapper.java │ │ ├── InterfaceRecordMapper.java │ │ ├── InterfaceRecordSummaryMapper.java │ │ ├── IpConstraintListMapper.java │ │ ├── LocalConfigModelMapper.java │ │ ├── MemberMapper.java │ │ ├── MemberRoleMapper.java │ │ ├── MessageModelMapper.java │ │ ├── PeerCertificateModelMapper.java │ │ ├── PeerChannelModelMapper.java │ │ ├── PeerModelMapper.java │ │ ├── PersistTaskModelMapper.java │ │ ├── RoleMapper.java │ │ ├── SmartContractModelMapper.java │ │ ├── StateAttachModelMapper.java │ │ ├── StateHistoryModelMapper.java │ │ ├── StateModelMapper.java │ │ ├── SystemVersionMapper.java │ │ ├── TimeConsumingModelMapper.java │ │ └── TransactionModelMapper.java │ │ └── persist │ │ ├── ChannelAction.java │ │ ├── ContractAction.java │ │ ├── MemberAction.java │ │ ├── PeerAction.java │ │ ├── PeerStateAction.java │ │ ├── RoleAction.java │ │ └── WorldStateAction.java │ └── resources │ ├── META-INF │ └── spring │ │ └── ledger-mgr-service.xml │ ├── application.yml │ ├── com │ └── jinninghui │ │ └── newspiral │ │ └── ledger │ │ └── mgr │ │ └── impl │ │ ├── mysql │ │ ├── AuthModelMapper.xml │ │ ├── BlockModelMapper.xml │ │ ├── ChannelModelMapper.xml │ │ ├── IdentityModelMapper.xml │ │ ├── InterfaceModelMapper.xml │ │ ├── InterfaceRecordModelMapper.xml │ │ ├── InterfaceRecordSummaryModelMapper.xml │ │ ├── IpConstraintListModelMapper.xml │ │ ├── LocalConfigModelMapper.xml │ │ ├── MemberModelMapper.xml │ │ ├── MemberRoleModelMapper.xml │ │ ├── MessageModelMapper.xml │ │ ├── PeerCertificateModelMapper.xml │ │ ├── PeerChannelModelMapper.xml │ │ ├── PeerModelMapper.xml │ │ ├── PersistTaskModelMapper.xml │ │ ├── RoleModelMapper.xml │ │ ├── SmartContractModelMapper.xml │ │ ├── StateAttachModelMapper.xml │ │ ├── StateHistoryModelMapper.xml │ │ ├── StateModelMapper.xml │ │ ├── SystemVersionMapper.xml │ │ ├── TimeConsumingModelMapper.xml │ │ └── TransactionModelMapper.xml │ │ └── postgresql │ │ ├── AuthModelMapper.xml │ │ ├── BlockModelMapper.xml │ │ ├── ChannelModelMapper.xml │ │ ├── IdentityModelMapper.xml │ │ ├── InterfaceRecordModelMapper.xml │ │ ├── InterfaceRecordSummaryModelMapper.xml │ │ ├── LocalConfigModelMapper.xml │ │ ├── MemberModelMapper.xml │ │ ├── MemberRoleModelMapper.xml │ │ ├── MessageModelMapper.xml │ │ ├── PeerCertificateModelMapper.xml │ │ ├── PeerChannelModelMapper.xml │ │ ├── PeerModelMapper.xml │ │ ├── PersistTaskModelMapper.xml │ │ ├── RoleModelMapper.xml │ │ ├── SmartContractModelMapper.xml │ │ ├── StateAttachModelMapper.xml │ │ ├── StateModelMapper.xml │ │ ├── TimeConsumingModelMapper.xml │ │ └── TransactionModelMapper.xml │ ├── generatorConfig.xml │ └── sofa-module.properties ├── member-mgr-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── member │ └── mgr │ └── MemberMgr.java ├── member-mgr ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jinninghui │ │ └── newspiral │ │ └── member │ │ └── mgr │ │ └── impl │ │ ├── AsynMemberTask.java │ │ ├── MemberMgrImpl.java │ │ └── MemberMgrTaskRunnable.java │ └── resources │ ├── META-INF │ └── spring │ │ └── member-mgr-service.xml │ └── sofa-module.properties ├── p2p-communicator-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── p2p │ ├── P2pClient.java │ └── hotstuff │ └── HotstuffRPCInterface.java ├── p2p-communicator ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jinninghui │ │ └── newspiral │ │ └── p2p │ │ └── impl │ │ ├── P2PClientImpl.java │ │ ├── base │ │ ├── ChannelClientMgr.java │ │ ├── ServiceForPeerClient.java │ │ └── ServiceForPeerClientMgr.java │ │ └── hotstuff │ │ └── HotStuffRPC.java │ └── resources │ ├── META-INF │ └── spring │ │ └── p2p-communicator.xml │ └── sofa-module.properties ├── pom.xml ├── security-service-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── security │ ├── DataSecurityMgr.java │ ├── PeerCertificateCipherReq.java │ ├── SecurityService.java │ ├── SecurityServiceMgr.java │ ├── StartSecurityMgr.java │ ├── contract │ ├── BussinessContractCallerMonitor.java │ └── SandBoxCacheMgr.java │ └── serialize │ └── ObjectSerializer.java ├── security-service ├── PAILLIER_README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jinninghui │ │ └── newspiral │ │ └── security │ │ ├── asm │ │ ├── LoopCounter.java │ │ ├── MemoryUseCounter.java │ │ └── SandboxClassVisitor.java │ │ ├── cert │ │ ├── CertBaseUtil.java │ │ ├── CertGenerateFactory.java │ │ ├── KeyGenerateFactory.java │ │ ├── SM2CertDemo.java │ │ ├── SM2KeyGenerateFactory.java │ │ └── ZipFileExport.java │ │ ├── contract │ │ ├── BlackListItem.java │ │ ├── BusinessContractAuthChecker.java │ │ ├── ContractByteCodeSearcher.java │ │ ├── ContractByteSource.java │ │ ├── SandBoxCache.java │ │ ├── SandboxClassLoader.java │ │ ├── SandboxContractMgrImpl.java │ │ ├── SandboxException.java │ │ ├── SmartContractClassLoader.java │ │ ├── SwitchableSecurityManager.java │ │ ├── WhiteListItem.java │ │ └── sandbox │ │ │ ├── AbstractSandbox.java │ │ │ ├── CallableSandbox.java │ │ │ ├── RunnableSandbox.java │ │ │ └── SandboxThread.java │ │ ├── impl │ │ ├── Crypto.java │ │ ├── DataSecurityMgrImpl.java │ │ ├── GMCrypto.java │ │ ├── OsccaSecurityServiceImpl.java │ │ ├── SM9Mgrlmpl.java │ │ ├── SecurityServiceMgrImpl.java │ │ ├── StartSecurityMgrImpl.java │ │ └── sm9Test.java │ │ ├── serialize │ │ ├── KryoObjectSerializer.java │ │ └── KryoUtil.java │ │ └── utils │ │ ├── BCECUtil.java │ │ ├── CertificateTest.java │ │ ├── CertificateUtil.java │ │ ├── DateUtil.java │ │ ├── GMBaseUtil.java │ │ ├── GMCertificateUtil.java │ │ ├── IoUtil.java │ │ ├── PropertyConstants.java │ │ ├── RSAUtil.java │ │ └── SM4Util.java │ └── resources │ ├── META-INF │ └── spring │ │ └── security-service-mgr.xml │ ├── security.properties │ └── sofa-module.properties ├── sql-script ├── 20200924newspiral_es.sql ├── 20201019newspiral.sql ├── 20210326_2.2.0_fixbug_statehistory.sql ├── IDENTITY.sql ├── PersistTask20191018.sql ├── addColumn.sql ├── feature_2.0.10.sql ├── feature_2.0.8.sql ├── feature_2.1.0.sql ├── feature_2.2.0.sql ├── feature_2.2.0_hotfix.sql ├── feature_2.3.0.sql ├── index20191016.sql ├── iplimit.sql ├── newspiral1.sql ├── rbac.sql ├── sandbox_updated.sql └── sharding_added.sql ├── transaction-mgr-interface ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jinninghui │ └── newspiral │ └── transaction │ └── mgr │ └── TransactionMgr.java └── transaction-mgr ├── pom.xml └── src └── main ├── java └── com │ └── jinninghui │ └── newspiral │ └── transaction │ └── mgr │ └── impl │ ├── AsyncTransactionTask.java │ ├── TransactionMgrImpl.java │ └── TransactionPool.java └── resources ├── META-INF └── spring │ └── transaction-mgr-service.xml └── sofa-module.properties /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ConsensusAlgorithmEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:26 8 | */ 9 | public enum ConsensusAlgorithmEnum { 10 | 11 | NEWSPIRAL_HOT_STUFF("NewSpiralHotStuff", "NewSpiral工程化后的HotStuff共识算法"); 12 | public final String code; 13 | public final String message; 14 | ConsensusAlgorithmEnum(String code, String message) { 15 | this.code = code; 16 | this.message = message; 17 | } 18 | public String getCode() { 19 | return code; 20 | } 21 | public String getMessage() { 22 | return message; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return JSON.toJSONString(this); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/Enum/ActionTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.Enum; 2 | 3 | public enum ActionTypeEnum { 4 | IN,OUT,FROZEN,UNFROZEN; 5 | } 6 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/Enum/PeerActionTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.Enum; 2 | 3 | public enum PeerActionTypeEnum { 4 | 5 | IN_OUT("IN_OUT","进入退出通道操作"), 6 | FROZEN("FROZEN","冻结解冻节点操作"); 7 | 8 | 9 | private String code; 10 | private String message; 11 | 12 | PeerActionTypeEnum(String code,String message){ 13 | this.code = code; 14 | this.message = message; 15 | } 16 | 17 | public String getCode() { 18 | return code; 19 | } 20 | 21 | public void setCode(String code) { 22 | this.code = code; 23 | } 24 | 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | public void setMessage(String message) { 30 | this.message = message; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/Enum/VersionEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.Enum; 2 | 3 | public enum VersionEnum { 4 | 5 | FABRIC("Fabric1.0"), 6 | NEWSPIRAL("Version1.0"); 7 | 8 | private VersionEnum(String code){ 9 | this.code = code; 10 | }; 11 | 12 | private final String code; 13 | 14 | public String getCode() { 15 | return this.code; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/Hashable.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/22 19:22 8 | */ 9 | public interface Hashable extends Serializable { 10 | void setHash(String hash); 11 | String getHash(); 12 | 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/QueryPeerParam.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.chain.Peer; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: QueryPeerParam 12 | * @Package com.jinninghui.newspiral.gateway.entity 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2019/11/12 17:06 16 | */ 17 | @Data 18 | public class QueryPeerParam { 19 | 20 | /** 21 | * 通道 22 | */ 23 | String channelId; 24 | /** 25 | * 节点的信息,一般就是一条 26 | */ 27 | List peerList; 28 | /** 29 | * 身份信息 30 | */ 31 | SignerIdentityKey signerIdentityKey; 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/VerifiableData.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/22 19:14 8 | * 可验证合法性的数据,例如区块,RPC调用中使用的对象,可以是参数也可以是返回值 9 | */ 10 | public interface VerifiableData extends Hashable { 11 | 12 | 13 | SignerIdentityKey getSignerIdentityKey(); 14 | 15 | void setSignerIdentityKey(SignerIdentityKey identity); 16 | } 17 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/block/BlockDataResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.block; 2 | 3 | public class BlockDataResp { 4 | 5 | public String message; 6 | 7 | /** 8 | * 区块检查信息 9 | */ 10 | public enum BlockCheckInfo{ 11 | 12 | } 13 | 14 | public enum TransactionCheckInfo{ 15 | 16 | } 17 | 18 | public enum TxMatchWorldState{ 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/cert/BaseCertConfig.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.cert; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | import java.util.Date; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: CertBCStyle 11 | * @Package com.jinninghui.newspiral.common.entity.cert 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2021/2/3 11:46 15 | */ 16 | @Data 17 | public class BaseCertConfig { 18 | 19 | /** 20 | * 证书序列号 21 | */ 22 | private BigInteger Serial = BigInteger.valueOf(System.currentTimeMillis()); 23 | /** 24 | * 生效日期(默认为创建时间) 25 | */ 26 | private Date NotBefore = new Date(); 27 | /** 28 | * 失效日期(默认为创建时间后5年) 29 | */ 30 | private Date NotAfter = new Date(System.currentTimeMillis()+1000L*86400L*365L*5); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/cert/CertBCStyle.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.cert; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: CertBCStyle 6 | * @Package com.jinninghui.newspiral.common.entity.cert 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2021/2/3 11:46 10 | */ 11 | public enum CertBCStyle { 12 | 13 | C("C","国家代码"), 14 | ST("ST","省份"), 15 | L("L","地区"), 16 | STREET("STREET","街道"), 17 | O("O","组织"), 18 | OU("OU","组织名称"), 19 | CN("CN","身份"), 20 | T("T","主题"), 21 | SERIALNUMBER("SERIALNUMBER","设备序列号"), 22 | TELEPHONE_NUMBER("TelephoneNumber","电话号码"), 23 | ORGANIZATION_IDENTIFIER("2.5.4.97","组织标识符"), 24 | NAME("Name","名字"), 25 | TYPE("TYPE","类型"), 26 | ; 27 | public final String code; 28 | public final String message; 29 | 30 | CertBCStyle(String code, String message) { 31 | this.code = code; 32 | this.message = message; 33 | } 34 | 35 | public String getMessage() { 36 | return message; 37 | } 38 | 39 | public String getCode() { 40 | return code; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/cert/RootCertData.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.cert; 2 | 3 | import lombok.Data; 4 | 5 | import java.security.PrivateKey; 6 | import java.security.PublicKey; 7 | import java.security.cert.X509Certificate; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: CertBCStyle 12 | * @Package com.jinninghui.newspiral.common.entity.cert 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2021/2/3 11:46 16 | */ 17 | @Data 18 | public class RootCertData { 19 | 20 | /** 21 | * 根证书 22 | */ 23 | private X509Certificate rootCert; 24 | /** 25 | * 私钥 26 | */ 27 | private PrivateKey privateKey; 28 | /** 29 | * 公钥 30 | */ 31 | private PublicKey publicKey; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/cert/UserCsrAndCertData.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.cert; 2 | 3 | import lombok.Data; 4 | 5 | import java.security.cert.X509Certificate; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: CertBCStyle 10 | * @Package com.jinninghui.newspiral.common.entity.cert 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2021/2/3 11:46 14 | */ 15 | @Data 16 | public class UserCsrAndCertData extends UserCsrCertData { 17 | 18 | /** 19 | * 用户证书 20 | */ 21 | private X509Certificate userCert; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/cert/UserCsrCertData.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.cert; 2 | 3 | import lombok.Data; 4 | import org.bouncycastle.pkcs.PKCS10CertificationRequest; 5 | 6 | import java.security.PrivateKey; 7 | import java.security.PublicKey; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: CertBCStyle 12 | * @Package com.jinninghui.newspiral.common.entity.cert 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2021/2/3 11:46 16 | */ 17 | @Data 18 | public class UserCsrCertData { 19 | 20 | /** 21 | * 用户请求证书(CSR) 22 | */ 23 | private PKCS10CertificationRequest userCSR; 24 | /** 25 | * 私钥 26 | */ 27 | private PrivateKey privateKey; 28 | /** 29 | * 公钥 30 | */ 31 | private PublicKey publicKey; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelBlockMaxSizeApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.policy.NewSpiralPolicyToken; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: PeerCertificateStateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.chain 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/4/14 10:45 15 | */ 16 | @ApiModel(description = "通道区块最大限制修改请求体") 17 | @Data 18 | public class ChannelBlockMaxSizeApproval extends NewSpiralPolicyToken { 19 | 20 | /** 21 | * 通道块大小修改 22 | */ 23 | @ApiModelProperty("通道区块最大限制请求体") 24 | private ChannelBlockMaxSizeRequest channelBlockMaxSizeRequest; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelBlockMaxSizeRequest.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotNull; 9 | 10 | /** 11 | * @version V1.0 12 | * @Title: ChannelBlockMaxSizeRequest 13 | * @Package com.jinninghui.newspiral.common.entity.chain 14 | * @Description: 15 | * @author: xuxm 16 | * @date: 2020/4/15 17:12 17 | */ 18 | @ApiModel(description = "通道区块大小请求体") 19 | @Data 20 | public class ChannelBlockMaxSizeRequest { 21 | 22 | /** 23 | * 通道Id 24 | */ 25 | @ApiModelProperty("通道Id") 26 | @NotBlank 27 | private String ChannelId; 28 | 29 | /** 30 | * 块大小 31 | */ 32 | @ApiModelProperty("区块大小") 33 | @NotNull 34 | Long blockMaxSize; 35 | } 36 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelChangeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 通道变更枚举 9 | */ 10 | public enum ChannelChangeEnum { 11 | 12 | DEFALUT("DEFALUT", "默认"), 13 | CHANNEL_PEER_ADD("CHANNEL_PEER_ADD", "通道节点新增"), 14 | CHANNEL_PEER_DEL("CHANNEL_PEER_DEL", "通道节点删除"), 15 | CHANNEL_PEER_CERT_FLAG_CHANGE("CHANNEL_PEER_CERT_FLAG_CHANGE", "通道节点证书状态变化"); 16 | public final String code; 17 | public final String message; 18 | ChannelChangeEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelConnectState.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.identity.IdentityKey; 4 | import lombok.Data; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * @author lida 10 | * @date 2019/7/15 14:48 11 | * 某个节点在某个通道内的连接状态 12 | */ 13 | @Data 14 | public class ChannelConnectState { 15 | /** 16 | * 本节点本身的身份标识 17 | */ 18 | IdentityKey localPeerId; 19 | 20 | /** 21 | * key为某个对端节点的身份标识 22 | */ 23 | Map connectStateMap; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelModifyRecord.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author lida 11 | * @date 2019/9/29 14:24 12 | */ 13 | @ApiModel(description = "通道变更记录") 14 | @Data 15 | public class ChannelModifyRecord implements Serializable { 16 | 17 | /** 18 | * newChannel为空,oldChannel不为空表示删除 19 | */ 20 | @ApiModelProperty(value = "新的通道信息") 21 | Channel newChannel; 22 | @ApiModelProperty(value = "旧的通道信息") 23 | Channel oldChannel; 24 | 25 | @Override 26 | public boolean equals(Object obj) { 27 | if (!(obj instanceof ChannelModifyRecord)) { 28 | return false; 29 | } 30 | 31 | ChannelModifyRecord newChannelModifyRecord = (ChannelModifyRecord) obj; 32 | return newChannelModifyRecord.newChannel.equals(newChannel); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelModifyStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 某个通道的元数据(例如各种控制策略、通道最大节点数等)的修改控制策略 9 | */ 10 | public enum ChannelModifyStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"); 15 | public final String code; 16 | public final String message; 17 | ChannelModifyStrategyEnum(String code, String message) { 18 | this.code = code; 19 | this.message = message; 20 | } 21 | public String getCode() { 22 | return code; 23 | } 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return JSON.toJSONString(this); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ChannelShort.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: ChannelShort 8 | * @Package com.jinninghui.newspiral.gateway.vo.resp 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/7/29 10:27 12 | */ 13 | @Data 14 | public class ChannelShort { 15 | //通道ID 16 | private String channelId; 17 | //当前高度 18 | private Long height; 19 | //交易大小 20 | private Long transactionSize; 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ConnectState.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/15 15:59 8 | * 9 | * 连接状态 10 | */ 11 | @Data 12 | public class ConnectState { 13 | 14 | /** 15 | * 连接状态 16 | */ 17 | ConnectStateEnum state; 18 | 19 | Long lastBusinessCallTimestamp; 20 | 21 | Long lastHeartbeatTimestamp; 22 | 23 | Long sendBytes; 24 | 25 | Long receivedBytes; 26 | 27 | /** 28 | * 当前连接状态持续秒数 29 | */ 30 | Long currentStateDuration; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/ConnectStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 节点加入链的策略枚举 9 | */ 10 | public enum ConnectStateEnum { 11 | 12 | CONNECTED("CONNECTED", "正常连接"), 13 | DIS_CONNECTED("DIS_CONNECTED", "连接断开"); 14 | public final String code; 15 | public final String message; 16 | ConnectStateEnum(String code, String message) { 17 | this.code = code; 18 | this.message = message; 19 | } 20 | public String getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return JSON.toJSONString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/CreateChannel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: 8 | * @Package 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/8/5 17:55 12 | */ 13 | @Data 14 | public class CreateChannel { 15 | 16 | /** 17 | * 通道Id 18 | */ 19 | private String channelId; 20 | 21 | 22 | /** 23 | * 创建时间戳 24 | */ 25 | private Long createTimestamp; 26 | } 27 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/MemberAddChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 成员加入通道的策略枚举 9 | */ 10 | public enum MemberAddChannelStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 16 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 17 | public final String code; 18 | public final String message; 19 | MemberAddChannelStrategyEnum(String code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | public String getCode() { 24 | return code; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return JSON.toJSONString(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/MemberModifyChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 成员修改的通道的策略枚举 9 | */ 10 | public enum MemberModifyChannelStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 16 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 17 | public final String code; 18 | public final String message; 19 | MemberModifyChannelStrategyEnum(String code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | public String getCode() { 24 | return code; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return JSON.toJSONString(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/MemberRemoveChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 成员移除通道的策略枚举 9 | */ 10 | public enum MemberRemoveChannelStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 16 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 17 | public final String code; 18 | public final String message; 19 | MemberRemoveChannelStrategyEnum(String code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | public String getCode() { 24 | return code; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return JSON.toJSONString(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/NetworkConnectState.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.identity.IdentityKey; 4 | import lombok.Data; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * @author lida 11 | * @date 2019/7/15 14:42 12 | * 某个节点的与网络的连接状态 13 | */ 14 | @Data 15 | public class NetworkConnectState { 16 | 17 | /** 18 | * 本节点本身的身份标识 19 | */ 20 | IdentityKey localPeerId; 21 | 22 | 23 | /** 24 | * key为通道ID 25 | */ 26 | Map channelConnStateMap = new HashMap<>(); 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerAddChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 节点加入通道的策略枚举 9 | */ 10 | public enum PeerAddChannelStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 15 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"); 16 | public final String code; 17 | public final String message; 18 | PeerAddChannelStrategyEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerCertificate.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: PeerCertificate 11 | * @Package com.jinninghui.newspiral.common.entity.chain 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/4/14 11:28 15 | */ 16 | @Data 17 | public class PeerCertificate { 18 | 19 | /** 20 | * 节点信息 21 | */ 22 | private Peer peer; 23 | 24 | /** 25 | * 证书记录 26 | */ 27 | private List peerCert =new ArrayList<>(); 28 | } 29 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerCertificateStateApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.policy.NewSpiralPolicyToken; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: PeerCertificateStateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.chain 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/4/14 10:45 15 | */ 16 | @ApiModel(description = "修改节点证书状态投票") 17 | @Data 18 | public class PeerCertificateStateApproval extends NewSpiralPolicyToken { 19 | 20 | /** 21 | * 证书状态动作 22 | */ 23 | @ApiModelProperty("证书状态请求体") 24 | private PeerCertificateStateRequest peerCertificateStateRequest; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerCertificateUpdateApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.policy.NewSpiralPolicyToken; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: PeerCertificateUpdateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.chain 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/20 13:53 15 | */ 16 | @ApiModel(description = "节点证书修改请求体") 17 | @Data 18 | public class PeerCertificateUpdateApproval extends NewSpiralPolicyToken { 19 | /** 20 | * 需要修改peer节点的证书 21 | */ 22 | /* 23 | private byte[] certificateCerFile;*/ 24 | 25 | /** 26 | * 需要修改peer节点的证书 27 | */ 28 | @ApiModelProperty("节点证书修改参数") 29 | private PeerCertificateUpdateParams updatePeerCertificate; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerCertificateUpdateParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.identity.IdentityKey; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import javax.validation.Valid; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * @version V1.0 13 | * @Title: PeerCertificateUpdateParams 14 | * @Package com.jinninghui.newspiral.common.entity.chain 15 | * @Description: 16 | * @author: xuxm 17 | * @date: 2021/3/12 13:26 18 | */ 19 | @ApiModel(description = "修改节点证书参数") 20 | @Data 21 | public class PeerCertificateUpdateParams { 22 | 23 | @ApiModelProperty(value = "通道Id") 24 | private String channelId; 25 | /** 26 | * 节点本身的身份标识 27 | */ 28 | @ApiModelProperty(value = "节点本身的身份标识") 29 | @Valid 30 | @NotNull 31 | IdentityKey peerId; 32 | /** 33 | * ca证书 34 | */ 35 | @ApiModelProperty(value = "ca证书") 36 | private byte[] certificateCerFile=null; 37 | 38 | /** 39 | * 密钥库 40 | */ 41 | @ApiModelProperty(value = "密钥库") 42 | private byte[] certificateKeyStoreFile=null; 43 | } 44 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerChannelIssuerParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @ClassName PeerChannelIssuerParams 7 | * @Author owen 8 | * @Date 2021-04-20 2021-04-20 19:35 9 | * @Version 1.0 10 | * @Description 在相同通道和相同组织中的节点 11 | **/ 12 | @Data 13 | public class PeerChannelIssuerParams { 14 | /** 15 | * 几点所在通道 16 | */ 17 | private String channelId; 18 | /** 19 | * 节点ID 20 | */ 21 | private String peerId; 22 | /** 23 | * 节点状态 24 | */ 25 | private String flag; 26 | /** 27 | * 节点url 28 | */ 29 | private String serviceUrls; 30 | /** 31 | * 节点所在组织ID 32 | */ 33 | private String issuerId; 34 | /** 35 | * 节点所在组织公钥 36 | */ 37 | private String issuerPublickey; 38 | /** 39 | * 节点所在组织私钥;此变量为空 40 | */ 41 | private String issuerPrivatekey; 42 | } 43 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerChannelOperationRecord.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.Enum.ActionTypeEnum; 4 | import com.jinninghui.newspiral.common.entity.Enum.PeerActionTypeEnum; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | @Data 9 | public class PeerChannelOperationRecord implements Comparable { 10 | 11 | /** 12 | * actionType:枚举(IN,OUT,FROZEN,UNFROZEN) 13 | */ 14 | @ApiModelProperty("actionType:枚举(IN,OUT,FROZEN,UNFROZEN)") 15 | private ActionTypeEnum actionTypeEnum; 16 | 17 | /** 18 | * 区块高度 19 | */ 20 | @ApiModelProperty("区块高度") 21 | private Long blockHeight; 22 | 23 | /** 24 | * 操作时间,单位毫秒 25 | */ 26 | @ApiModelProperty("操作时间,单位毫秒") 27 | private Long actionTime; 28 | 29 | //从大到小排序 30 | @Override 31 | public int compareTo(PeerChannelOperationRecord o) { 32 | return Long.compare(o.getBlockHeight(),this.getBlockHeight()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerChannelParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: QueryWorldStateReq 11 | * @Package com.jinninghui.newspiral.gateway.vo.req 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/2/8 11:11 15 | */ 16 | @Data 17 | public class PeerChannelParams { 18 | 19 | /** 20 | * 所属通道ID 21 | */ 22 | @ApiModelProperty(value = "所属通道ID") 23 | private String channelId; 24 | 25 | /** 26 | * 通道的组织公钥证书 27 | */ 28 | @ApiModelProperty(value = "通道的组织公钥证书") 29 | private String publicCertFile; 30 | 31 | /** 32 | * 通道的基础信息 33 | */ 34 | @ApiModelProperty(value = "通道的基础信息") 35 | private ChannelBasicParams channelBasicParams; 36 | 37 | /** 38 | * 通道动态数据 39 | */ 40 | @ApiModelProperty(value = "通道动态数据") 41 | private ChannelDynamicParams channelDynamicParams; 42 | 43 | /** 44 | * 节点信息列表 45 | */ 46 | @ApiModelProperty(value = "节点信息列表") 47 | private List peerBasicParams; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerFrozenUnFrozenApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.policy.NewSpiralPolicyToken; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | @ApiModel(description = "冻结解冻节点") 9 | @Data 10 | public class PeerFrozenUnFrozenApproval extends NewSpiralPolicyToken { 11 | 12 | /** 13 | * 证书状态动作 14 | */ 15 | @ApiModelProperty("节点冻结解冻请求体") 16 | private PeerFrozenUnFrozen peerFrozenUnFrozen; 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerModifyChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | public enum PeerModifyChannelStrategyEnum { 6 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 7 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 8 | ALL_AGREE("ALL_AGREE", "通道中已有组织全部同意即可"), 9 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"); 10 | public final String code; 11 | public final String message; 12 | PeerModifyChannelStrategyEnum(String code, String message) { 13 | this.code = code; 14 | this.message = message; 15 | } 16 | public String getCode() { 17 | return code; 18 | } 19 | public String getMessage() { 20 | return message; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return JSON.toJSONString(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerOrganizationParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: QueryWorldStateReq 8 | * @Package com.jinninghui.newspiral.gateway.vo.req 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/2/8 11:11 12 | */ 13 | @Data 14 | public class PeerOrganizationParams { 15 | 16 | //使用组织公钥证书 17 | private String organizationPublicCertFile; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerRemoveChannelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | public enum PeerRemoveChannelStrategyEnum { 6 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 7 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 8 | ALL_AGREE("ALL_AGREE", "通道中已有组织全部同意即可"), 9 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 10 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 11 | public final String code; 12 | public final String message; 13 | PeerRemoveChannelStrategyEnum(String code, String message) { 14 | this.code = code; 15 | this.message = message; 16 | } 17 | public String getCode() { 18 | return code; 19 | } 20 | public String getMessage() { 21 | return message; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return JSON.toJSONString(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerServiceTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 节点加入链的策略枚举 9 | */ 10 | public enum PeerServiceTypeEnum { 11 | 12 | FOR_PEER("FOR_PEER", "为其他节点提供的服务"), 13 | FOR_SDK("FOR_SDK", "为SDK提供的服务"); 14 | public final String code; 15 | public final String message; 16 | PeerServiceTypeEnum(String code, String message) { 17 | this.code = code; 18 | this.message = message; 19 | } 20 | public String getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return JSON.toJSONString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerServiceUrl.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @author lida 9 | * @date 2019/9/9 17:46 10 | */ 11 | @ApiModel(description = "节点服务url") 12 | @Data 13 | public class PeerServiceUrl { 14 | @ApiModelProperty("url类型") 15 | String type; 16 | @ApiModelProperty(value = "url地址") 17 | String url; 18 | } 19 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerStage.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: PeerStage 6 | * @Package com.jinninghui.newspiral.gateway.config 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2020/7/28 17:19 10 | */ 11 | public class PeerStage { 12 | 13 | public static PeerStageEnum peerStageEnum; 14 | } 15 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/PeerStageEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 节点共识阶段 9 | */ 10 | public enum PeerStageEnum { 11 | 12 | PEER_STOP("PEER_STOP","节点停止中"), 13 | PEER_RUN("PEER_RUN", "节点运行中"); 14 | public final String code; 15 | public final String message; 16 | PeerStageEnum(String code, String message) { 17 | this.code = code; 18 | this.message = message; 19 | } 20 | public String getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return JSON.toJSONString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/RoleAddStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 角色加入通道的策略枚举 9 | */ 10 | public enum RoleAddStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"); 16 | public final String code; 17 | public final String message; 18 | RoleAddStrategyEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/RoleDelStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 角色删除的策略枚举 9 | */ 10 | public enum RoleDelStrategyEnum { 11 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 12 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 13 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 14 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"); 15 | public final String code; 16 | public final String message; 17 | RoleDelStrategyEnum(String code, String message) { 18 | this.code = code; 19 | this.message = message; 20 | } 21 | public String getCode() { 22 | return code; 23 | } 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return JSON.toJSONString(this); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/RoleModifyStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 角色修改的策略枚举 9 | */ 10 | public enum RoleModifyStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"); 16 | public final String code; 17 | public final String message; 18 | RoleModifyStrategyEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/SimplifyChannel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | 8 | @ApiModel(description = "通道精简数据实体") 9 | @Data 10 | public class SimplifyChannel { 11 | 12 | @ApiModelProperty(value = "通道id") 13 | private String channelId; 14 | 15 | @ApiModelProperty(value = "通道名称") 16 | private String channelName; 17 | 18 | @ApiModelProperty(value = "通道中最高的块高度") 19 | private long maxBlockId; 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/chain/UpdateChannelPeerPrivateKeyRequest.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.chain; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author lida 11 | * @date 2019/9/11 19:27 12 | * 管理平台调用节点的“把本节点加入某个通道”接口的请求 13 | * 需使用组织根证书签名 14 | */ 15 | 16 | @Data 17 | public class UpdateChannelPeerPrivateKeyRequest implements VerifiableData { 18 | String hash; 19 | 20 | /** 21 | * 通道 22 | */ 23 | String channelId; 24 | 25 | /** 26 | * 27 | */ 28 | List channelPeerList; 29 | /** 30 | * 这个签名用于本地节点验签 31 | */ 32 | SignerIdentityKey signerIdentityKey; 33 | 34 | public SignerIdentityKey getSignerIdentityKey() { 35 | return signerIdentityKey; 36 | } 37 | 38 | public void setSignerIdentityKey(SignerIdentityKey identity) { 39 | signerIdentityKey = identity; 40 | } 41 | 42 | public void setHash(String hash) { 43 | this.hash=hash; 44 | } 45 | 46 | public String getHash() { 47 | return hash; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/annotation/AnnotationConstant.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.annotation; 2 | 3 | public class AnnotationConstant { 4 | 5 | 6 | 7 | /** 8 | * 普通模式,校验权限 9 | */ 10 | public static final String COMMON_STRATEGY = "haveNeededInterfaceAuth"; 11 | /** 12 | * 父节点同意模式,只需父节点同意即可 13 | */ 14 | public static final String FATHER_PEER_AGREE_STRATEGY = "fatherPeerAgree"; 15 | 16 | 17 | public static final String SYSTEM_CONTRACT_STRATEGY = "systemContractVerifyStrategy"; 18 | 19 | 20 | public static final String BUSINESS_CONTRACT_STRATEGY="businessContractStrategy"; 21 | 22 | /** 23 | * 本地节点监控策略 24 | */ 25 | public static final String PEER_MONITOR_STRATEGY="peerMonitorStrategy"; 26 | 27 | public enum SystemClassPathEnum { 28 | common("com.jinninghui.newspiral.consensus.impl.hotstuff.txexecutor.SystemSmartContract"); 29 | 30 | private final String path; 31 | 32 | SystemClassPathEnum(String path) { 33 | this.path = path; 34 | } 35 | 36 | public String getPath() { 37 | return path; 38 | } 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/annotation/CustomRoleToken.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: AuthRoleToken 12 | * @Package com.jinninghui.newspiral.common.entity.common.annotation 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/1/8 16:09 16 | */ 17 | @Target(ElementType.METHOD) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | public @interface CustomRoleToken { 21 | 22 | /** 23 | * 访问所需的自定义的角色身份,默认为空,可以多个定义 24 | * @return 25 | */ 26 | String[] customRoleName() default ""; 27 | } 28 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/annotation/VerifyAuth.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: AuthRoleToken 12 | * @Package com.jinninghui.newspiral.common.entity.common.annotation 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/1/8 16:09 16 | */ 17 | @Target(ElementType.METHOD) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | public @interface VerifyAuth { 21 | 22 | /** 23 | * 访问所需的预定义的角色身份,默认为空,可以多个定义 24 | * @return 25 | */ 26 | String Strategy() default AnnotationConstant.COMMON_STRATEGY; 27 | 28 | /** 29 | * 是否验签,默认为ture 30 | * @return 31 | */ 32 | boolean verifySignature() default true; 33 | 34 | /** 35 | * 是否要求调用者是某个通道的成员 36 | */ 37 | boolean callerHaveChannelMemberIdentity() default true; 38 | } 39 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/annotation/VerifyPeer.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Target(ElementType.METHOD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface VerifyPeer { 13 | } 14 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/BaseApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import io.swagger.annotations.ApiModel; 6 | import io.swagger.annotations.ApiModelProperty; 7 | import lombok.Data; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: BaseApproval 12 | * @Package com.jinninghui.newspiral.common.entity.common.base 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/1/20 15:12 16 | */ 17 | @ApiModel(description = "基础审核信息") 18 | @Data 19 | public class BaseApproval implements VerifiableData { 20 | @ApiModelProperty("投票参数相关Hash值") 21 | private String hash; 22 | /** 23 | * 加入的通道ID 24 | */ 25 | @ApiModelProperty(value = "通道ID") 26 | private String channelId; 27 | 28 | /** 29 | * 同意该申请的组织的身份标识 30 | */ 31 | @ApiModelProperty(value = "审核者的身份标识") 32 | private SignerIdentityKey signerIdentityKey; 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/BaseTransHashResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: BaseTransHashResp 8 | * @Package com.jinninghui.newspiral.common.entity.common.base 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2021/4/23 9:44 12 | */ 13 | @Data 14 | public class BaseTransHashResp { 15 | /** 交易hash**/ 16 | private String transHash; 17 | /** 返回信息**/; 18 | private NewspiralStateCodes newspiralStateCodes; 19 | 20 | 21 | public BaseTransHashResp(String transHash) 22 | { 23 | this.transHash=transHash; 24 | } 25 | 26 | public BaseTransHashResp(String transHash,NewspiralStateCodes newspiralStateCodes) 27 | { 28 | this.transHash=transHash; 29 | this.newspiralStateCodes=newspiralStateCodes; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/BizVO.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @ApiModel(description = "分页查询结果返回实体") 10 | @Data 11 | public class BizVO { 12 | //返回总记录数 13 | @ApiModelProperty("总记录数") 14 | private Integer recordCount; 15 | 16 | //页数 17 | @ApiModelProperty("页码") 18 | private Integer pageNo; 19 | 20 | //每页记录数 21 | @ApiModelProperty("每页记录数") 22 | private Integer pageSize; 23 | 24 | //总页数 25 | @ApiModelProperty("总页数") 26 | private Integer pageCount; 27 | //列表 28 | @ApiModelProperty("返回值结果列表") 29 | private List list; 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/CallbackBaseReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: CallbackBaseReq 10 | * @Package com.jinninghui.newspiral.common.entity.common.base 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2021/2/18 13:16 14 | */ 15 | @ApiModel(description = "回调请求数据") 16 | @Data 17 | public class CallbackBaseReq { 18 | /** 19 | * 类型 20 | */ 21 | @ApiModelProperty(value = "类型") 22 | protected CallbackEnum callbackEnum; 23 | 24 | /** 25 | * 对象 26 | */ 27 | @ApiModelProperty(value = "对象") 28 | protected T data; 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/CallbackEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: CallbackEnum 6 | * @Package com.jinninghui.newspiral.common.entity.common.base 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2021/2/18 13:20 10 | */ 11 | public enum CallbackEnum { 12 | TRANSACTION("transaction"); 13 | 14 | private CallbackEnum(String code){ 15 | this.code = code; 16 | }; 17 | 18 | private final String code; 19 | 20 | public String getCode() { 21 | return this.code; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/base/ListResponse.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.base; 2 | 3 | import lombok.Data; 4 | 5 | 6 | @Data 7 | public class ListResponse { 8 | public ListResponse(){ 9 | 10 | } 11 | public ListResponse(String code, String message, BizVO bizVO) { 12 | this.code = code; 13 | this.message = message; 14 | this.bizVO = bizVO; 15 | } 16 | 17 | 18 | /** 19 | * 返回码 20 | */ 21 | protected String code; 22 | 23 | /** 24 | * 消息 25 | */ 26 | protected String message; 27 | 28 | private BizVO bizVO; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/logmodule/LogModuleCodes.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.logmodule; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: LogModuleCodes 6 | * @Package com.jinninghui.newspiral.common.entity.common.logmodule 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2020/4/7 10:10 10 | */ 11 | public enum LogModuleCodes { 12 | SYSTEM_PLANTFORM_ACTION("001", "SYSTEM_PLANTFORM_ACTION"), 13 | SYSTEM_USER_ACTION("002", "SYSTEM_USER_ACTION"), 14 | SYSTEM_SMART_CONTRACT_ACTION("003", "SYSTEM_SMART_CONTRACT_ACTION"), 15 | BUSINESS_SMART_CONTRACT_ACTION("004", "SANDBOX_BUSINESS_CONTRACT_ACTION"); 16 | 17 | private final String code; 18 | private final String msg; 19 | 20 | private LogModuleCodes(String code, String msg) { 21 | this.code = code; 22 | this.msg = msg; 23 | } 24 | 25 | public String getCode() { 26 | return this.code; 27 | } 28 | 29 | public String getMsg() { 30 | return this.msg; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/persist/Action.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.persist; 2 | 3 | public interface Action { 4 | 5 | void invoke(Object obj); 6 | } 7 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/persist/PersistActionInterface.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.persist; 2 | 3 | public interface PersistActionInterface { 4 | 5 | 6 | void doAdd(T obj); 7 | 8 | void doRemove(T obj); 9 | 10 | void doModify(T obj); 11 | 12 | void doRest(T obj); 13 | } 14 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/common/utils/PropertyConstantsUtils.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.common.utils; 2 | 3 | import java.io.IOException; 4 | import java.util.Properties; 5 | 6 | public class PropertyConstantsUtils { 7 | private static Properties properties; 8 | private static String defaultName = "application.properties"; 9 | 10 | 11 | 12 | public static void setProperty(String name){ 13 | if (properties==null) { 14 | properties = new Properties(); 15 | ClassLoader loader = Thread.currentThread().getContextClassLoader();/**/ 16 | try { 17 | properties.load(loader.getResourceAsStream(name)); 18 | } catch (IOException e) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | } 23 | 24 | public static String getPropertiesKey(String key){ 25 | if (properties==null) { 26 | setProperty(defaultName); 27 | } 28 | return properties.getProperty(key, "default"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/config/ChannelShardingInfo.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.config; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "通道分片相关信息") 9 | public class ChannelShardingInfo { 10 | 11 | @ApiModelProperty(value = "通道Id") 12 | private String channelId; 13 | 14 | @ApiModelProperty(value = "通道名称") 15 | private String channelName; 16 | 17 | @ApiModelProperty(value = "每个分库中通道最大的高度") 18 | private long maxHeightInEachDs; 19 | } 20 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/config/LocalConfig.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.config; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class LocalConfig { 7 | 8 | private String key; 9 | 10 | private String value; 11 | 12 | private String type; 13 | 14 | private transient int show; 15 | } 16 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/consensus/ConsensusStageEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.consensus; 2 | 3 | /** 4 | * @author lida 5 | * @date 2019/7/11 17:50 6 | * 节点共识阶段 7 | */ 8 | public enum ConsensusStageEnum { 9 | 10 | WAIT_SYNC_WITH_CHANNEL("WaitSyncWithChannel","等待与网络同步数据,不能确定本地状态,不参与共识逻辑,一个典型的例子是本节点宕机了一段时间"), 11 | LEADER_WAIT_NEWVIEW("LeaderWaitNewView", "本节点在本轮是主节点,但是还没有拿到足够多的NewView消息,因此还不能开始构造Block"), 12 | LEADER_WAIT_TRANS("LeaderWaitTrans", "本节点在本轮是主节点,已经拿到足够多的NewView消息,但尚未有足够多的交易,因此还没有开始构造Block"), 13 | LEADER_WAIT_BLOCK_VOTE("LeaderWaitBlockVote", "本节点在本轮是主节点,已经构造并发送完毕Block,正在等待BlockVote"), 14 | REPLICA_WAIT_BLOCK("ReplicaWaitBlock", "本节点在本轮不是主节点,在等待主节点的Block"), 15 | ONE_PEER("OnePeer","通道中只有一个节点"), 16 | LEAVE_CHANNEL("LeaveChannel", "离开通道,停止相关线程"), 17 | NO_AVALIABLE_DB_ROUTE("NoAvaliableDBRoute", "没有可用的数据库路由,在等待刷新数据库配置"); 18 | public final String code; 19 | public final String message; 20 | ConsensusStageEnum(String code, String message) { 21 | this.code = code; 22 | this.message = message; 23 | } 24 | public String getCode() { 25 | return code; 26 | } 27 | public String getMessage() { 28 | return message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/consensus/HotStuffDataNodeResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.consensus; 2 | 3 | import com.jinninghui.newspiral.common.entity.block.BlockResp; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | /** 9 | * 用于查询的时候对外展示hotstuff节点信息 10 | */ 11 | public class HotStuffDataNodeResp { 12 | 13 | /** 14 | * 父Node,以其Block的hash作为key 15 | */ 16 | @ApiModelProperty(value = "父节点的hash值") 17 | @Getter 18 | @Setter 19 | String parentNodeHashStr; 20 | 21 | /** 22 | * 证明此block的父亲是合法的,注意并不是证明此Block合法 23 | */ 24 | @ApiModelProperty(value = "投票证书,证明此block的父区块是合法的") 25 | @Getter @Setter 26 | GenericQC justify; 27 | 28 | /** 29 | * 区块基本信息,此字段仅仅在查询展示的时候使用 30 | */ 31 | @Getter @Setter 32 | BlockResp blockResp; 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/consensus/HotStuffMsg.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.consensus; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @author lida 9 | * @date 2019/7/24 9:31 10 | */ 11 | @Data 12 | public abstract class HotStuffMsg implements VerifiableData { 13 | /** 14 | * 发送时本地的viewNo 15 | */ 16 | @ApiModelProperty(value = "视图序号") 17 | Long viewNo; 18 | } 19 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/consensus/PerformanceContext.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.consensus; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: PerformanceContext 8 | * @Package com.jinninghui.newspiral.consensus.hotstuff 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/7/3 11:21 12 | */ 13 | @Data 14 | public class PerformanceContext { 15 | /** 16 | * current height of committed block 17 | */ 18 | long blockHeight; 19 | /** 20 | * 共识数量 21 | */ 22 | int nodeNumber; 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/consensus/QueryViewNoResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.consensus; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class QueryViewNoResp { 7 | Long viewNo; 8 | Long height; 9 | } 10 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/ClassLimitParam.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class ClassLimitParam { 8 | /** 9 | * 接口所在类的类名 10 | */ 11 | @ApiModelProperty("接口所在类的类名") 12 | private ClassTypeEnum classTypeEnum; 13 | 14 | /** 15 | * 接口是否进行限流,(限流1,不限流0)默认为限流 16 | */ 17 | @ApiModelProperty("接口是否进行限流,(限流1,不限流0)默认为限流") 18 | private String limitAccess; 19 | 20 | /** 21 | * 令牌创建速率,每秒钟允许的最大请求数 22 | */ 23 | @ApiModelProperty("令牌创建速率,每秒钟允许的最大请求数") 24 | private Integer createTokenRate; 25 | 26 | /** 27 | * 每个请求最大等待时间,如超过这个时间则请求被拒绝 28 | */ 29 | @ApiModelProperty("每个请求最大等待时间,如超过这个时间则请求被拒绝") 30 | private Integer waitTokenTime; 31 | 32 | public Interface toInterface(){ 33 | Interface anInterface = new Interface(); 34 | anInterface.setClassName(this.getClassTypeEnum().getClassName()); 35 | anInterface.setLimitAccess(this.getLimitAccess()); 36 | anInterface.setCreateTokenRate(this.getCreateTokenRate()); 37 | anInterface.setWaitTokenTime(this.getWaitTokenTime()); 38 | return anInterface; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/ClassTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | public enum ClassTypeEnum { 4 | 5 | SDK("ServiceForSDKImpl","SDK对外提供的接口,供客户端调用"), 6 | PEER("ServiceForPeerImpl","PEER对外提供接口,节点之间调用"), 7 | CONSENSUS("ServiceForConsensusImpl","CONSENSUS对外提供接口,节点之间共识消息调用"), 8 | CONSTRACT("SystemSmartContract","系统合约提供接口"); 9 | 10 | private String className; 11 | private String message; 12 | 13 | ClassTypeEnum(String className,String message){ 14 | this.className = className; 15 | this.message = message; 16 | } 17 | 18 | public String getClassName() { 19 | return className; 20 | } 21 | 22 | public String getMessage() { 23 | return message; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/ConstraintTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | public enum ConstraintTypeEnum { 4 | NO_ACCESS("NoAccess","禁止访问"), 5 | PEER_ACCESS("PeerAccess","节点白名单,运行节点之间相互调用"); 6 | 7 | 8 | private String constraintType; 9 | private String message; 10 | ConstraintTypeEnum(String constraintType, String message){ 11 | this.constraintType = constraintType; 12 | this.message = message; 13 | } 14 | 15 | public String getConstraintType() { 16 | return constraintType; 17 | } 18 | 19 | public String getMessage() { 20 | return message; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/DDOSEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | public enum DDOSEnum { 4 | BATCH_MODIFY_LIMIT_PARAM_SUCCESS("batch modify limit param success","批量修改限流参数成功了"), 5 | BY_CLASS_MODIFY_LIMIT_PARAM_SUCCESS("by class modify limit param success","按照类名批量修改限流参数成功了"), 6 | ADD_IP_INTO_IP_CONSTRAINT_LIST_SECCESS("add ip into ip constraint list success","添加限制ip操作信息成功了"), 7 | MODIFY_IP_IN_IP_CONSTRAINT_LIST_SECCESS("modify ip in ip constraint list success","修改限制ip操作信息成功了"); 8 | //add ip into ip_constraint_list success modify ip in ip_constraint_list success 9 | private String code; 10 | private String message; 11 | DDOSEnum(String code,String message){ 12 | this.code = code; 13 | this.message = message; 14 | } 15 | 16 | public String getCode() { 17 | return code; 18 | } 19 | 20 | public String getMessage() { 21 | return message; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/Interface.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class Interface { 8 | /** 9 | * 接口所在类的类名 10 | */ 11 | @ApiModelProperty("接口所在类的类名") 12 | private String className; 13 | 14 | /** 15 | * 方法名 16 | */ 17 | @ApiModelProperty("方法名") 18 | private String methodName; 19 | 20 | /** 21 | * 接口是否进行限流,(限流1,不限流0)默认为限流 22 | */ 23 | @ApiModelProperty("接口是否进行限流,(限流1,不限流0)默认为限流") 24 | private String limitAccess; 25 | 26 | 27 | /** 28 | * 令牌创建速率,每秒钟允许的最大请求数 29 | */ 30 | @ApiModelProperty 31 | private Integer createTokenRate; 32 | 33 | /** 34 | * 35 | */ 36 | @ApiModelProperty("每个请求最大等待时间,如超过这个时间则请求被拒绝") 37 | private Integer waitTokenTime; 38 | } 39 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/ddos/IpConstraintList.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.ddos; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | import lombok.ToString; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import java.io.Serializable; 9 | 10 | @Data 11 | @ToString 12 | public class IpConstraintList implements Serializable { 13 | 14 | /** 15 | * ip地址 16 | */ 17 | @ApiModelProperty("ip地址") 18 | @NotBlank 19 | private String ipAddr; 20 | 21 | /** 22 | * 禁止该ip访问的类名,该类名下的所有接口禁止访问 23 | */ 24 | @ApiModelProperty("限制操作类型,比如禁止访问,允许访问,限流等") 25 | @NotBlank 26 | private String constraintType; 27 | 28 | /** 29 | * 黑名单是否生效,1为生效,0为不生效,默认为1 30 | */ 31 | @ApiModelProperty("黑名单是否生效,1为生效,0为不生效,默认为1") 32 | private String active = "1"; 33 | 34 | /** 35 | * 补充信息,用于说明该ip地址的额外信息 36 | */ 37 | @ApiModelProperty("补充信息,用于说明该ip地址的额外信息") 38 | private String Remark; 39 | 40 | /** 41 | * 创建时间 42 | */ 43 | @ApiModelProperty("创建时间") 44 | private Long createTime; 45 | 46 | /** 47 | * 更新时间 48 | */ 49 | @ApiModelProperty("更新时间") 50 | private Long updateTime; 51 | } 52 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/identity/Identity.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.identity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/9/9 19:31 8 | */ 9 | @Data 10 | public class Identity { 11 | IdentityKey key; 12 | 13 | /** 14 | * 父身份的Key 15 | */ 16 | IdentityKey parentKey; 17 | 18 | String extendedProps; 19 | } 20 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/identity/IdentityTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.identity; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author lida 9 | * @date 2019/7/5 19:13 10 | * 身份标识类型枚举 11 | */ 12 | public enum IdentityTypeEnum implements Serializable { 13 | CHINA_PKI("CHINA_PKI", "基于国密的非对称加密体系"); 14 | public final String code; 15 | public final String message; 16 | IdentityTypeEnum(String code, String message) { 17 | this.code = code; 18 | this.message = message; 19 | } 20 | public String getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return JSON.toJSONString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/Auth.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | @Data 9 | public class Auth implements Serializable { 10 | 11 | @ApiModelProperty(value = "权限id") 12 | private Integer authId; 13 | 14 | @ApiModelProperty(value = "权限名称") 15 | private String authName; 16 | 17 | @ApiModelProperty(value = "权限编码") 18 | private String authCode; 19 | 20 | @ApiModelProperty(value = "权限描述") 21 | private String authDescription; 22 | 23 | 24 | public Auth clone() 25 | { 26 | Auth auth=new Auth(); 27 | auth.setAuthId(this.authId); 28 | auth.setAuthCode(this.authCode); 29 | auth.setAuthDescription(this.authDescription); 30 | auth.setAuthName(this.authName); 31 | return auth; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberAddRoleStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 成员加入该角色的控制策略 9 | */ 10 | public enum MemberAddRoleStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 16 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 17 | public final String code; 18 | public final String message; 19 | MemberAddRoleStrategyEnum(String code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | public String getCode() { 24 | return code; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return JSON.toJSONString(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberDeleteApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: MemberUpdateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.member 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/13 15:53 15 | */ 16 | @ApiModel(description = "成员删除请求体") 17 | @Data 18 | public class MemberDeleteApproval extends BaseApproval { 19 | 20 | /** 21 | * 成员删除信息 22 | */ 23 | @ApiModelProperty("成员删除信息") 24 | MemberDeleteInfo memberDeleteInfo; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberDeleteInfo.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 用来删除成员信息 9 | */ 10 | @ApiModel(description = "用来删除成员信息") 11 | @Data 12 | public class MemberDeleteInfo { 13 | 14 | /** 15 | * 数字证书公钥 16 | */ 17 | @ApiModelProperty("数字证书公钥") 18 | String publicKey; 19 | 20 | /** 21 | * 通道Id 22 | */ 23 | @ApiModelProperty("通道Id") 24 | String channelId; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberInfo.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | @ApiModel(description = "成员信息") 14 | @Data 15 | public class MemberInfo implements Serializable { 16 | 17 | @ApiModelProperty(value = "公钥证书") 18 | private String certificateCerFile; 19 | 20 | 21 | @ApiModelProperty(value = "扩展属性数据") 22 | private Map extendedData = new HashMap(); 23 | 24 | @ApiModelProperty(value = "角色ID组") 25 | private List roleIdList = new ArrayList<>(); 26 | 27 | public MemberInfo clone() { 28 | MemberInfo info = new MemberInfo(); 29 | info.setCertificateCerFile(certificateCerFile); 30 | info.setExtendedData(extendedData); 31 | info.setRoleIdList(roleIdList); 32 | return info; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberRemoveRoleStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 成员移除该角色的控制策略 9 | */ 10 | public enum MemberRemoveRoleStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "通道中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "通道中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "通道中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"), 16 | PARENT_AGREE("PARENT_AGREE", "父成员同意即可"); 17 | public final String code; 18 | public final String message; 19 | MemberRemoveRoleStrategyEnum(String code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | public String getCode() { 24 | return code; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return JSON.toJSONString(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | public enum MemberStateEnum { 6 | VALID(0, "正常"), 7 | INVALID_CERTIFICATE(1, "证书过期"), 8 | FROZEN(2,"业务冻结"), 9 | DELETED(3, "业务删除"); 10 | public final Integer code; 11 | public final String message; 12 | MemberStateEnum(Integer code, String message) { 13 | this.code = code; 14 | this.message = message; 15 | } 16 | public Integer getCode() { 17 | return code; 18 | } 19 | public String getMessage() { 20 | return message; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return JSON.toJSONString(this); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberUpdateApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: MemberUpdateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.member 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/13 15:53 15 | */ 16 | @ApiModel(description = "成员修改请求体") 17 | @Data 18 | public class MemberUpdateApproval extends BaseApproval { 19 | /** 20 | * 需要修改的成员信息 21 | */ 22 | @ApiModelProperty("成员修改信息") 23 | private MemberUpdateInfo memberUpdateInfo; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/MemberUpdateInfo.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 用来更新成员信息 9 | */ 10 | @ApiModel(description = "成员修改信息") 11 | @Data 12 | public class MemberUpdateInfo { 13 | /** 14 | * 成员修改信息 15 | */ 16 | @ApiModelProperty("成员修改信息") 17 | MemberInfo memberInfo; 18 | /** 19 | * 成员状态 20 | */ 21 | @ApiModelProperty("成员状态") 22 | MemberStateEnum stateEnum; 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryMemberListApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: QueryMemberApproval 9 | * @Package com.jinninghui.newspiral.common.entity.member 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/1/21 09:53 13 | */ 14 | @Data 15 | public class QueryMemberListApproval extends BaseApproval { 16 | /** 17 | * 成员信息列表的查询条件 18 | */ 19 | private QueryMemberListReq queryMemberListReq; 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryMemberListReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: QueryMemberReq 12 | * @Package com.jinninghui.newspiral.common.entity.member 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/1/21 9:45 16 | */ 17 | @ApiModel(description = "查询成员列表请求体") 18 | @Data 19 | public class QueryMemberListReq { 20 | /** 21 | * 通道编号(必传) 22 | */ 23 | @ApiModelProperty("通道Id") 24 | private String channelId; 25 | 26 | /** 27 | * 0正常,1证书过期,2业务冻结,3业务删除 28 | * 允许多个 29 | */ 30 | @ApiModelProperty("成员状态:0正常,1证书过期,2业务冻结,3业务删除") 31 | private List stateEnumList; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryMemberReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: QueryMemberReq 10 | * @Package com.jinninghui.newspiral.common.entity.member 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2020/1/21 9:45 14 | */ 15 | @ApiModel(description = "查询成员请求体") 16 | @Data 17 | public class QueryMemberReq { 18 | /** 19 | * 通道编号(必传) 20 | */ 21 | @ApiModelProperty("通道Id") 22 | private String channelId; 23 | 24 | /** 25 | * 数字证书的公钥 26 | */ 27 | @ApiModelProperty(value = "数字证书公钥") 28 | private String publicKey; 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryRoleApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: QueryRoleApproval 9 | * @Package com.jinninghui.newspiral.common.entity.member 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/1/17 15:53 13 | */ 14 | @Data 15 | public class QueryRoleApproval extends BaseApproval { 16 | /** 17 | * 查询实体role 18 | */ 19 | private Role formRole; 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryRoleListParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @ApiModel(description = "查询角色列表") 10 | @Data 11 | public class QueryRoleListParams { 12 | 13 | @ApiModelProperty(value = "通道ID") 14 | private String channelId; 15 | 16 | @ApiModelProperty(value = "状态(1正常 2业务删除)") 17 | private List state; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/QueryRoleParams.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | 8 | @ApiModel(description = "角色查询参数") 9 | @Data 10 | public class QueryRoleParams { 11 | 12 | /** 13 | * 通道Id 14 | */ 15 | @ApiModelProperty(value = "通道ID") 16 | private String channelId; 17 | 18 | /** 19 | * 主键 20 | */ 21 | @ApiModelProperty(value = "角色ID") 22 | private String roleId; 23 | 24 | /** 25 | * 名称 26 | */ 27 | @ApiModelProperty(value = "角色名称") 28 | private String name; 29 | 30 | /** 31 | * 英文名称 32 | */ 33 | @ApiModelProperty(value = "角色英文名称") 34 | private String shortName; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/RoleAddApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: RoleAddApproval 11 | * @Package com.jinninghui.newspiral.common.entity.member 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/13 15:53 15 | */ 16 | @ApiModel(description = "角色新增请求体") 17 | @Data 18 | public class RoleAddApproval extends BaseApproval { 19 | /** 20 | * 新加入的自定义RoleAdd 21 | */ 22 | @ApiModelProperty("角色新增参数") 23 | private RoleAdd roleAdd; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/RoleDelete.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(description = "角色删除参数") 8 | @Data 9 | public class RoleDelete { 10 | /** 11 | * 通道Id 12 | */ 13 | @ApiModelProperty(value = "通道ID") 14 | private String channelId; 15 | /** 16 | * 主键 17 | */ 18 | @ApiModelProperty(value = "角色ID") 19 | private String roleId; 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/RoleDeleteApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: RoleDeleteApproval 11 | * @Package com.jinninghui.newspiral.common.entity.member 12 | * @Description: 13 | * @author: wuhuaijiang 14 | * @date: 2020/10/18 9:01 15 | */ 16 | @ApiModel(description = "角色删除请求体") 17 | @Data 18 | public class RoleDeleteApproval extends BaseApproval { 19 | /** 20 | * 需要删除的自定义角色 21 | */ 22 | @ApiModelProperty("角色删除参数") 23 | private RoleDelete deleteRole; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/RoleStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | /** 4 | * @author whj 5 | * @date 6 | */ 7 | public enum RoleStateEnum { 8 | NORMOR(1,"正常"), 9 | DELETE(2,"业务删除"); 10 | 11 | private final Integer code; 12 | private final String message; 13 | 14 | 15 | RoleStateEnum(Integer roleSate,String message) { 16 | this.code = roleSate; 17 | this.message = message; 18 | 19 | } 20 | public Integer getCode() { 21 | return code; 22 | } 23 | 24 | public String getMessage(){return message;} 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/member/RoleUpdateApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.member; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: RoleUpdateApproval 11 | * @Package com.jinninghui.newspiral.common.entity.member 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/13 15:53 15 | */ 16 | @ApiModel(description = "角色修改请求体") 17 | @Data 18 | public class RoleUpdateApproval extends BaseApproval { 19 | /** 20 | * 需要修改的自定义role 21 | */ 22 | @ApiModelProperty("角色修改请求参数") 23 | private RoleUpdate updateRole; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/policy/NewSpiralPolicy.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.policy; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Target({ElementType.METHOD}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface NewSpiralPolicy { 13 | public String role() default "ASYNCHRONOUS"; 14 | public String rule() default "ANY"; 15 | } 16 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/policy/NewSpiralPolicyException.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.policy; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class NewSpiralPolicyException extends RuntimeException { 7 | private String role; 8 | private String rule; 9 | private String msg; 10 | public NewSpiralPolicyException(String role, String rule, String msg) { 11 | this.role = role; 12 | this.rule = rule; 13 | this.msg = msg; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/record/PageInfo.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.record; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 分页实体 10 | * @param 11 | */ 12 | @Data 13 | public class PageInfo { 14 | 15 | /** 16 | * 总数,符合条件的记录总数 17 | */ 18 | @ApiModelProperty("总数,符合条件的记录总数") 19 | private Long totalCount; 20 | 21 | /** 22 | * 总页数 23 | */ 24 | @ApiModelProperty("总页数") 25 | private Long totalPage; 26 | 27 | /** 28 | * 当前页序号:从1开始 29 | */ 30 | @ApiModelProperty("当前页序号:从1开始") 31 | private Long curPage; 32 | 33 | /** 34 | * 页大小 35 | */ 36 | @ApiModelProperty("页大小") 37 | private Integer pageSize; 38 | 39 | /** 40 | * 当前页的所有调用记录,每条记录包括记录需求的所有属性 41 | */ 42 | @ApiModelProperty("当前页的所有调用记录,每条记录包括记录需求的所有属性") 43 | private List record; 44 | } 45 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/DecryptMasterKeyPair.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: DecryptMasterKeyPair 8 | * @Package com.jinninghui.newspiral.common.entity.sm9 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2019/11/7 10:14 12 | */ 13 | @Data 14 | public class DecryptMasterKeyPair { 15 | 16 | /** 17 | * 解密后的主公钥字符串 18 | */ 19 | private String decryptMasterPublicKey; 20 | 21 | /** 22 | * 解密后的主私钥字符串 23 | */ 24 | private String decryptMasterPrivateKey; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/EncryptMasterKeyPair.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: EncryptMasterKeyPair 8 | * @Package com.jinninghui.newspiral.common.entity.sm9 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2019/11/7 9:48 12 | */ 13 | @Data 14 | public class EncryptMasterKeyPair { 15 | /** 16 | * 加密的主公钥字符串 17 | */ 18 | private String encryptMasterPublicKey; 19 | 20 | /** 21 | * 加密的主私钥字符串 22 | */ 23 | private String encryptMasterPrivateKey; 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/G1PrivateKey.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * SM9 private key on G1 group. 7 | * 8 | * Created by on 2019/4/15. 9 | */ 10 | public class G1PrivateKey { 11 | BigInteger d; 12 | 13 | public G1PrivateKey(BigInteger d) { 14 | this.d = d; 15 | } 16 | 17 | public static G1PrivateKey fromByteArray(byte[] source) { 18 | BigInteger d = new BigInteger(1, source); 19 | return new G1PrivateKey(d); 20 | } 21 | 22 | public byte[] toByteArray() { 23 | return SM9Utils.BigIntegerToBytes(d, SM9CurveParameters.nBits/8); 24 | } 25 | 26 | 27 | @Override 28 | public String toString() { 29 | StringBuffer sb = new StringBuffer(); 30 | 31 | sb.append("sm9 private key on G1 group:"); 32 | sb.append(SM9Utils.NEW_LINE); 33 | sb.append(SM9Utils.toHexString(SM9Utils.BigIntegerToBytes(d, SM9CurveParameters.nBits/8))); 34 | 35 | return sb.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/G1PublicKey.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import it.unisa.dia.gas.plaf.jpbc.field.curve.CurveElement; 4 | 5 | /** 6 | * SM9 public key on G1 group. 7 | * 8 | * Created by on 2019/4/15. 9 | */ 10 | public class G1PublicKey { 11 | CurveElement Q; 12 | 13 | public G1PublicKey(CurveElement point) 14 | { 15 | this.Q = point; 16 | } 17 | 18 | public static G1PublicKey fromByteArray(SM9Curve curve, byte[] source) { 19 | CurveElement Q = curve.G1.newElement(); 20 | Q.setFromBytes(source); 21 | return new G1PublicKey(Q); 22 | } 23 | 24 | public byte[] toByteArray() { 25 | return Q.toBytes(); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | StringBuffer sb = new StringBuffer(); 31 | 32 | sb.append("sm9 public key on G1 group:"); 33 | sb.append(SM9Utils.NEW_LINE); 34 | sb.append(SM9Utils.toHexString(SM9Utils.G1ElementToBytes(Q))); 35 | 36 | return sb.toString(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/GMProvider.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import java.security.Provider; 4 | 5 | /** 6 | * GM algorithm provider. 7 | * 8 | * Created by on 2019/1/18. 9 | */ 10 | public class GMProvider { 11 | private static Provider sProvider = null; 12 | 13 | /** 14 | * Get GM algorithm provider. 15 | * 16 | * @return GM algorithm provider. 17 | */ 18 | public static Provider getProvider() 19 | { 20 | if(sProvider==null) { 21 | //sProvider = new BouncyCastleProvider(); 22 | } 23 | return sProvider; 24 | } 25 | 26 | 27 | private GMProvider(){ 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/PrivateKeyType.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | /** 4 | * SM9 private key type, use to generate private key. 5 | * 6 | * Created by on 2019/4/15. 7 | */ 8 | public enum PrivateKeyType { 9 | /** SM9 signed private key. */ 10 | KEY_SIGN, 11 | /** SM9 key exchange private key(also is a encrypted private key). */ 12 | KEY_KEY_EXCHANGE, 13 | /** SM9 encrypted private key. */ 14 | KEY_ENCRYPT 15 | } 16 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/ResultEncapsulate.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | /** 4 | * SM9 key encapsulation result struct. 5 | * 6 | * Created by on 2019/4/14. 7 | */ 8 | public final class ResultEncapsulate { 9 | byte[] K; 10 | ResultEncapsulateCipherText C; 11 | 12 | public ResultEncapsulate(byte[] K, ResultEncapsulateCipherText C) { 13 | this.K = K; 14 | this.C = C; 15 | } 16 | 17 | public byte[] getK() { 18 | return K; 19 | } 20 | 21 | public ResultEncapsulateCipherText getC() { 22 | return C; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | StringBuffer sb = new StringBuffer(); 28 | 29 | sb.append("sm9 key encapsulate result:"); 30 | sb.append(SM9Utils.NEW_LINE); 31 | sb.append("K:"); 32 | sb.append(SM9Utils.NEW_LINE); 33 | sb.append(SM9Utils.toHexString(K)); 34 | sb.append(SM9Utils.NEW_LINE); 35 | sb.append(C.toString()); 36 | 37 | return sb.toString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/ResultEncapsulateCipherText.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import it.unisa.dia.gas.plaf.jpbc.field.curve.CurveElement; 4 | 5 | /** 6 | * The cipher text of key in SM9 key encapsulation result struct. 7 | * 8 | * Created by on 2019/4/14. 9 | */ 10 | public final class ResultEncapsulateCipherText { 11 | CurveElement C; 12 | 13 | public ResultEncapsulateCipherText(CurveElement C) { 14 | this.C = C; 15 | } 16 | 17 | public static ResultEncapsulateCipherText fromByteArray(SM9Curve curve, byte[] data) { 18 | CurveElement e = curve.G1.newElement(); 19 | e.setFromBytes(data); 20 | return new ResultEncapsulateCipherText(e); 21 | } 22 | 23 | public byte[] toByteArray() 24 | { 25 | return C.toBytes(); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | StringBuffer sb = new StringBuffer(); 31 | sb.append("sm9 key encapsulate cipher text of key:"); 32 | sb.append(SM9Utils.NEW_LINE); 33 | sb.append(SM9Utils.toHexString(SM9Utils.G1ElementToBytes(C))); 34 | 35 | return sb.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/ResultKeyExchange.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | /** 4 | * SM9 key exchange result struct. 5 | * 6 | * Created by on 2019/4/15. 7 | */ 8 | public class ResultKeyExchange { 9 | byte[] SK; 10 | byte[] SA2; 11 | byte[] SB1; 12 | 13 | public ResultKeyExchange(byte[] SK, byte[] SA2, byte[] SB1) 14 | { 15 | this.SK = SK; 16 | this.SA2 = SA2; 17 | this.SB1 = SB1; 18 | } 19 | 20 | public byte[] getSK() { 21 | return SK; 22 | } 23 | 24 | public byte[] getSA2() { 25 | return SA2; 26 | } 27 | 28 | public byte[] getSB1() { 29 | return SB1; 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/SM9SignParam.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: SM9SignParam 8 | * @Package com.jinninghui.newspiral.common.entity.sm9 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2019/10/22 11:05 12 | */ 13 | @Data 14 | public class SM9SignParam { 15 | private String channelId; 16 | private MasterPublicKey masterPublicKey; 17 | private PrivateKey privateKey; 18 | private byte[] data; 19 | private ResultSignature resultSignature; 20 | /** 21 | * 22 | */ 23 | private String ida; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/sm9/sm3/SM3.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.sm9.sm3; 2 | 3 | import com.jinninghui.newspiral.common.entity.sm9.GMProvider; 4 | 5 | import java.security.MessageDigest; 6 | import java.security.NoSuchAlgorithmException; 7 | 8 | /** 9 | * SM3 MessageDigest. 10 | * 11 | * @author 12 | * @since 2019/01/18 13 | */ 14 | public class SM3 { 15 | public static final int DIGEST_SIZE = 32; 16 | 17 | private SM3() 18 | { 19 | } 20 | 21 | /** 22 | * Get MessageDigest object for SM3 algorithm instance. 23 | * 24 | * @return SM3 MessageDigest object 25 | * @throws NoSuchAlgorithmException 26 | */ 27 | public static MessageDigest getInstance() throws NoSuchAlgorithmException { 28 | return MessageDigest.getInstance("SM3", GMProvider.getProvider()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/QuerySmartContractReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: QuerySmartContractReq 10 | * @Package com.jinninghui.newspiral.common.entity.smartcontract 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2020/8/27 18:38 14 | */ 15 | @ApiModel("查询智能合约请求体") 16 | @Data 17 | public class QuerySmartContractReq { 18 | /** 19 | * 通道编号 20 | */ 21 | @ApiModelProperty("通道Id") 22 | private String channelId; 23 | 24 | //别名 25 | @ApiModelProperty("合约别名") 26 | private String alisa; 27 | 28 | //版本号 29 | @ApiModelProperty("版本号") 30 | private String version; 31 | 32 | 33 | public QuerySmartContractReq() { 34 | } 35 | 36 | public QuerySmartContractReq(String channelId, String version, String alisa) { 37 | this.channelId = channelId; 38 | this.alisa = alisa; 39 | this.version = version; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractAuthorizedApproval.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: SmartContractAuthorizedApproval 9 | * @Package com.jinninghui.newspiral.common.entity.smartcontract 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/8/31 9:38 13 | */ 14 | @Data 15 | public class SmartContractAuthorizedApproval extends BaseApproval { 16 | 17 | private SmartContractsAuthorized smartContractsAuthorized; 18 | } 19 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractCompileResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: SmartContractCompile 8 | * @Package com.jinninghui.newspiral.common.entity.smartcontract 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/9/24 15:53 12 | */ 13 | @Data 14 | public class SmartContractCompileResp { 15 | //java文件 16 | private String sourceContent; 17 | 18 | //类名 19 | private String className; 20 | } 21 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractDeplyStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 某个链的元数据(例如各种控制策略、链最大节点数等)的修改控制策略 9 | */ 10 | public enum SmartContractDeplyStrategyEnum { 11 | 12 | MAJORITY_AGREE("MAJORITY_AGREE", "链中已有过半数节点同意即可"), 13 | ABSOLUTE_MAJORITY_AGREE("ABSOLUTE_MAJORITY_AGREE", "链中已有节点中2/3以上同意即可"), 14 | ALL_AGREE("ALL_AGREE", "链中已有节点全部同意即可"), 15 | MANAGER_AGREE("MANAGER_AGREE", "通道的管理员同意即可"); 16 | public final String code; 17 | public final String message; 18 | SmartContractDeplyStrategyEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractModelKeyReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SmartContractModelKeyReq { 7 | private String scName; 8 | 9 | private String scVersion; 10 | 11 | private String scChannelId; 12 | 13 | /** 14 | * 别名 15 | */ 16 | private String alisa; 17 | 18 | } -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractOperationTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 智能合约操作状态 9 | */ 10 | public enum SmartContractOperationTypeEnum { 11 | 12 | SMARTCONTRACT_INSTALL("SMARTCONTRACT_INSTALL", "合约安装"), 13 | SMARTCONTRACT_UPGRADE("SMARTCONTRACT_UPGRADE", "合约升级"); 14 | public final String code; 15 | public final String message; 16 | SmartContractOperationTypeEnum(String code, String message) { 17 | this.code = code; 18 | this.message = message; 19 | } 20 | public String getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return JSON.toJSONString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractShort.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: SmartContractShort 10 | * @Package com.jinninghui.newspiral.common.entity.smartcontract 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2020/8/31 15:48 14 | */ 15 | @ApiModel(description = "简化智能合约") 16 | @Data 17 | public class SmartContractShort { 18 | //别名 19 | @ApiModelProperty(value = "别名") 20 | private String alisa; 21 | 22 | //版本号 23 | @ApiModelProperty(value = "版本号") 24 | private String version; 25 | } 26 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * 7 | * 8 | * 智能合约操作状态 9 | */ 10 | public enum SmartContractStateEnum { 11 | 12 | SMARTCONTRACT_VALID("1", "正常"), 13 | SMARTCONTRACT_FROZEN("2", "冻结"), 14 | SMARTCONTRACT_DESTORIED("3", "销毁"); 15 | public final String code; 16 | public final String message; 17 | SmartContractStateEnum(String code, String message) { 18 | this.code = code; 19 | this.message = message; 20 | } 21 | public String getCode() { 22 | return code; 23 | } 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return JSON.toJSONString(this); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/smartcontract/SmartContractUpdateStateToken.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.smartcontract; 2 | 3 | import com.jinninghui.newspiral.common.entity.common.base.BaseApproval; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | @ApiModel(description = "智能合约状态升级投票") 11 | @Data 12 | public class SmartContractUpdateStateToken extends BaseApproval implements Serializable { 13 | 14 | @ApiModelProperty(value = "智能合约版本号") 15 | private String version; 16 | 17 | @ApiModelProperty(value = "智能合约别名") 18 | private String alisa; 19 | 20 | @ApiModelProperty(value = "智能合约状态,1正常;2冻结;3销毁") 21 | private SmartContractStateEnum state; 22 | 23 | public boolean equals(SmartContractUpdateStateToken other) 24 | { 25 | if(version.equals(other.getVersion()) && alisa.equals(other.getAlisa()) && state.equals(other.getState()) 26 | && getChannelId().equals(other.getChannelId())) 27 | { 28 | return true; 29 | } 30 | return false; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/state/ConfigEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.state; 2 | 3 | public enum ConfigEnum { 4 | 5 | NS_SYSCONTRACTID("NS_SYSCONTRACTID","com.jinninghui.newspiral.consensus.impl.hotstuff.txexecutor.SystemSmartContract"); 6 | 7 | private String code; 8 | private String message; 9 | 10 | private ConfigEnum(String code, String message){ 11 | this.code = code; 12 | this.message = message; 13 | } 14 | 15 | public String getCode() { 16 | return code; 17 | } 18 | 19 | public void setCode(String code) { 20 | this.code = code; 21 | } 22 | 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/state/StateHistoryBO.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.state; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class StateHistoryBO { 7 | 8 | private String channelId; 9 | 10 | private String stateKey; 11 | 12 | private Byte successed; 13 | 14 | private String startTime; 15 | 16 | private String endTime; 17 | 18 | private Long curPage; 19 | 20 | private Long start; 21 | 22 | private Integer pageSize; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/state/SyncStateHistoryThreadEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.state; 2 | 3 | public enum SyncStateHistoryThreadEnum { 4 | SYNC("SYNC","线程同步中"), 5 | SYNC_ERROR("SYNC_ERROR","线程同步出错"); 6 | 7 | private String code; 8 | private String message; 9 | 10 | private SyncStateHistoryThreadEnum(String code, String message){ 11 | this.code = code; 12 | this.message = message; 13 | } 14 | 15 | public String getCode() { 16 | return code; 17 | } 18 | 19 | public void setCode(String code) { 20 | this.code = code; 21 | } 22 | 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/state/WorldStateModifyRecord.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.state; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | /** 9 | * @author lida 10 | * @date 2019/9/26 11:01 11 | */ 12 | @ApiModel(description = "世界状态变更记录") 13 | public class WorldStateModifyRecord { 14 | /** 15 | * oldState为空,newState不为空表示新建 16 | */ 17 | @ApiModelProperty(value = "旧的世界状态") 18 | @Setter @Getter 19 | WorldState oldState; 20 | /** 21 | * newState为空,oldState不为空表示删除 22 | */ 23 | @ApiModelProperty(value = "新的世界状态") 24 | @Setter @Getter 25 | WorldState newState; 26 | 27 | /** 28 | * 该变更记录的最新更新viewNo 29 | * 用于清除不需要的变更记录 30 | * 不用blockHash是因为新建的时候,其实还不知道BlockHash 31 | */ 32 | @ApiModelProperty(value = "变更记录的最新更新viewNo") 33 | @Getter @Setter 34 | long latestUpdateViewNo; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/state/WorldStateModifyRecordResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.state; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | * 8 | */ 9 | @Data 10 | public class WorldStateModifyRecordResp { 11 | /** 12 | * oldState为空,newState不为空表示新建 13 | */ 14 | WorldStateResp oldState; 15 | /** 16 | * newState为空,oldState不为空表示删除 17 | */ 18 | WorldStateResp newState; 19 | 20 | /** 21 | * 该变更记录的最新更新viewNo 22 | * 用于清除不需要的变更记录 23 | * 不用blockHash是因为新建的时候,其实还不知道BlockHash 24 | */ 25 | long latestUpdateViewNo; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/CodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: CodeEnum 6 | * @Package com.jinninghui.newspiral.common.entity.task 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2019/12/16 17:26 10 | */ 11 | 12 | public interface CodeEnum { 13 | T getCode(); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/EnumUtil.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: EnumUtil 6 | * @Package com.jinninghui.newspiral.common.entity.task 7 | * @Description: 8 | * @author: xuxm 9 | * @date: 2019/12/16 17:33 10 | */ 11 | public class EnumUtil { 12 | public static T getByCode(String code, Class enumClass) { 13 | //通过反射取出Enum所有常量的属性值 14 | for (T each: enumClass.getEnumConstants()) { 15 | //利用code进行循环比较,获取对应的枚举 16 | if (code.equals(each.getCode())) { 17 | return each; 18 | } 19 | } 20 | return null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/LoggerEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | public enum LoggerEnum { 4 | ERROR("ERROR"), 5 | WARN("WARN"), 6 | INFO("INFO"), 7 | DEBUG("DEBUG"); 8 | 9 | private String level; 10 | LoggerEnum(String level){ 11 | this.level = level; 12 | } 13 | 14 | public String getLevel() { 15 | return level; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/TansactionShortResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: TansactionShortResp 8 | * @Package com.jinninghui.newspiral.gateway.signTest 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2020/7/13 10:22 12 | */ 13 | @Data 14 | public class TansactionShortResp { 15 | private String transHash; 16 | 17 | private Long timeStamp; 18 | } 19 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/Task.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * @author lida 12 | * @date 2019/9/10 20:22 13 | * 需要持久化的任务 14 | */ 15 | @ToString 16 | public class Task { 17 | 18 | @Getter @Setter 19 | String taskId ; 20 | 21 | @Getter @Setter 22 | TaskTypeEnum type = TaskTypeEnum.DEFAULT_TYPE; 23 | 24 | @Getter @Setter 25 | Long createTime = 0L; 26 | /** 27 | * 执行截止时间,这个截止时间是指:在这个截止时间前,需要按照频率定期尝试, 28 | * 截止时间之后,如果尝试过一次及以上,仍然未能变为成功,则将任务状态设置为失败; 29 | * 注意将任务状态设置为失败,一定要保证至少尝试过一次 30 | */ 31 | @Getter @Setter 32 | Long executeEndTime = 0L; 33 | 34 | /** 35 | * 参数列表 36 | */ 37 | @Getter @Setter 38 | List paramsList = new ArrayList<>(); 39 | 40 | /** 41 | * 任务状态 42 | */ 43 | @Getter @Setter 44 | TaskStatus status = TaskStatus.WAIT_EXEXUTE; 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/TaskStatus.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/9/11 11:03 8 | */ 9 | public enum TaskStatus implements CodeEnum { 10 | PROCESSING("PROCESSING", "处理中"), 11 | WAIT_EXEXUTE("WAIT_EXEXUTE", "等待执行开始时刻点到达"), 12 | SUCCESS("SUCCESS", "成功,终态"), 13 | FAIL("FAIL", "业务失败,终态"), 14 | OVERTIME("OVERTIME", "超出时间,终态"); 15 | public final String code; 16 | public final String message; 17 | TaskStatus(String code, String message) { 18 | this.code = code; 19 | this.message = message; 20 | } 21 | public String getCode() { 22 | return code; 23 | } 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | /** 29 | * 是否是终态,如果是,则不需要再执行 30 | * @return 31 | */ 32 | public boolean isFianlStatus() 33 | { 34 | return this == TaskStatus.SUCCESS || this==TaskStatus.FAIL 35 | ||this==TaskStatus.OVERTIME; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return JSON.toJSONString(this); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/TaskTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/9/10 20:23 8 | */ 9 | public enum TaskTypeEnum implements CodeEnum { 10 | LOCAL_PEER_ADD_TO_CHANNEL_RESULT_QUERY("LOCAL_PEER_ADD_TO_CHANNEL_RESULT_QUERY", "本地节点加入某个通道的结果查询任务"), 11 | REMOVE_PEER_FROM_CHANNEL_RESULT_QUERY("REMOVE_PEER_FROM_CHANNEL_RESULT_QUERY", "从通道中删除节点的结果查询任务"), 12 | DEFAULT_TYPE("DEFAULT_TYPE","初始化类型,默认会不处理"); 13 | public final String code; 14 | public final String message; 15 | TaskTypeEnum(String code, String message) { 16 | this.code = code; 17 | this.message = message; 18 | } 19 | public String getCode() { 20 | return code; 21 | } 22 | public String getMessage() { 23 | return message; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return JSON.toJSONString(this); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/task/TimeConsuming.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.task; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class TimeConsuming { 7 | private Long id; 8 | 9 | private Long viewNumber; 10 | 11 | private Long phaseOne; 12 | 13 | private Long phaseTwo; 14 | 15 | private Long phaseThree; 16 | 17 | private Long phaseFour; 18 | 19 | private Long timeout; 20 | 21 | private Long receiveBlock; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/transaction/TransactionAttached.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.transaction; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: TransactionAttached 10 | * @Package com.jinninghui.newspiral.common.entity.transaction 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2020/9/28 17:38 14 | */ 15 | @ApiModel(description = "交易附加信息") 16 | @Data 17 | public class TransactionAttached { 18 | 19 | /** 20 | * 区块高度 21 | */ 22 | @ApiModelProperty(value = "区块高度") 23 | private Long blockHeight; 24 | 25 | 26 | //暂时只用这一个属性 27 | /* *//** 28 | * 区块大小 29 | *//* 30 | @ApiModelProperty(value = "区块大小") 31 | private Long blockSize; 32 | 33 | *//** 34 | * 出块节点 35 | *//* 36 | @ApiModelProperty(value = "出块节点") 37 | private String builderPeerId; 38 | 39 | *//** 40 | * 通道Name 41 | *//* 42 | @ApiModelProperty(value = "通道Name") 43 | private String channleName;*/ 44 | } 45 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/transaction/TransactionCompile.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.transaction; 2 | 3 | import com.jinninghui.newspiral.common.entity.smartcontract.SmartContract; 4 | import lombok.Data; 5 | 6 | 7 | /** 8 | * 缓存预编译的交易中的智能合约,当前仅限于内存级别维护 9 | */ 10 | @Data 11 | public class TransactionCompile { 12 | /** 13 | * 为SmartContractInfo.toString(),因为对于一个智能合约中可以有多个SmartContractInfo,但是它们的内容一样,只有签名不一样。 14 | */ 15 | private String txCompileID; 16 | /** 17 | * 对应的SDKTransaction,即SDK侧(即业务程序侧)生成的交易,里面附带了未执行编译的智能合约: 18 | * SmartContractCallInstnace中的Object[] methodArgs即为SmartContractInfo列表,其中每个SmartContractInfo都一样,只有签名信息不一样 19 | */ 20 | private SDKTransaction sdkTX; 21 | /** 22 | * 已完成编译的智能合约,存储的是SDKTransaction中对应的智能合约通过编译之后的结构 23 | */ 24 | private SmartContract smartContract; 25 | 26 | /** 27 | * 默认构造输入 28 | * @param _sdkTX 29 | * @param _smartContract 30 | */ 31 | public TransactionCompile(SDKTransaction _sdkTX, SmartContract _smartContract){ 32 | this.setSdkTX(_sdkTX); 33 | this.setSmartContract(_smartContract); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/transaction/TxStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.transaction; 2 | 3 | /** 4 | * @author whj 5 | * @date 2020/10/26 6 | */ 7 | public enum TxStateEnum { 8 | TX_ACCOMPLISH_CONSENSUS(1,"已共识"), 9 | TX_WAIT_FOR_PACKAGE(2,"待打包"), 10 | TX_HAVING_CONSENSUS(3,"共识中"), 11 | TX_POOLED(4,"交易已入池"), 12 | TX_WAIT_PRE_EXEC(5,"交易等待预执行"), 13 | TX_IN_BLOCK(6,"交易已持久化在block中"); 14 | 15 | private final Integer code; 16 | private final String message; 17 | 18 | TxStateEnum(Integer code,String message){ 19 | this.code = code; 20 | this.message = message; 21 | } 22 | 23 | public Integer getCode() { 24 | return code; 25 | } 26 | 27 | public String getMessage(){return message;} 28 | 29 | } 30 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/util/SpringBeanUtil.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.util; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Data 9 | @Component 10 | public class SpringBeanUtil { 11 | 12 | private static ApplicationContext applicationContext; 13 | 14 | public static void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 15 | //这里不用加锁,因为不经常使用 16 | if (SpringBeanUtil.applicationContext == null) { 17 | SpringBeanUtil.applicationContext = applicationContext; 18 | } 19 | } 20 | 21 | public static T getBean(Class clazz) { 22 | return SpringBeanUtil.applicationContext.getBean(clazz); 23 | } 24 | 25 | public static Object getBean(String name) { 26 | return SpringBeanUtil.applicationContext.getBean(name); 27 | } 28 | 29 | public static String getProperty(String key) { 30 | return SpringBeanUtil.applicationContext.getEnvironment().getProperty(key); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common-entity/src/main/java/com/jinninghui/newspiral/common/entity/version/VersionResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.common.entity.version; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: VersionResp 9 | * @Package com.jinninghui.newspiral.common.entity.version 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2021/4/9 14:26 13 | */ 14 | @Data 15 | public class VersionResp { 16 | @ApiModelProperty(value = "系统版本号") 17 | private String version; 18 | @ApiModelProperty(value = "系统版本说明") 19 | private String remark; 20 | } 21 | -------------------------------------------------------------------------------- /consensus-interface/src/main/java/com/jinninghui/newspiral/consensus/hotstuff/DataVerifier.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.consensus.hotstuff; 2 | 3 | import com.jinninghui.newspiral.common.entity.block.Block; 4 | import com.jinninghui.newspiral.common.entity.chain.Channel; 5 | import com.jinninghui.newspiral.common.entity.consensus.GenericQC; 6 | import com.jinninghui.newspiral.common.entity.transaction.SDKTransaction; 7 | 8 | /** 9 | * @author ganzirong 10 | * @date 2020/12/21 11 | * 12 | */ 13 | public interface DataVerifier { 14 | boolean verifyBlock(Block block, String SecurityServiceKey); 15 | boolean verifyTransaction(SDKTransaction sdkTransaction, String SecurityServiceKey); 16 | boolean verifyGenericQC(GenericQC genericQC, Channel channel); 17 | } 18 | -------------------------------------------------------------------------------- /consensus/src/main/java/com/jinninghui/newspiral/consensus/impl/hotstuff/ConsensusExtendedParamEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.consensus.impl.hotstuff; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/7/11 17:50 8 | * 节点共识阶段 9 | */ 10 | public enum ConsensusExtendedParamEnum { 11 | 12 | VIEW_TIMEOUT_MS("viewTimeoutMs","View的超时时间"); 13 | public final String code; 14 | public final String message; 15 | ConsensusExtendedParamEnum(String code, String message) { 16 | this.code = code; 17 | this.message = message; 18 | } 19 | public String getCode() { 20 | return code; 21 | } 22 | public String getMessage() { 23 | return message; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return JSON.toJSONString(this); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /consensus/src/main/java/com/jinninghui/newspiral/consensus/impl/hotstuff/txexecutor/contract/compile/MemoryClassLoader.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.consensus.impl.hotstuff.txexecutor.contract.compile; 2 | 3 | import java.net.URL; 4 | import java.net.URLClassLoader; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * Load class from byte[] which is compiled in memory. 10 | * 11 | * @author 12 | */ 13 | class MemoryClassLoader extends URLClassLoader { 14 | 15 | // class name to class bytes: 16 | Map classBytes = new HashMap(); 17 | 18 | public MemoryClassLoader(Map classBytes) { 19 | super(new URL[0], MemoryClassLoader.class.getClassLoader()); 20 | this.classBytes.putAll(classBytes); 21 | } 22 | 23 | @Override 24 | protected Class findClass(String name) throws ClassNotFoundException { 25 | byte[] buf = classBytes.get(name); 26 | if (buf == null) { 27 | return super.findClass(name); 28 | } 29 | classBytes.remove(name); 30 | return defineClass(name, buf, 0, buf.length); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /consensus/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jinninghui.newspiral.consensus.hotstuff 2 | Require-Module=com.jininghui.newspiral.ledger.mgr,com.jinninghui.newspiral.security 3 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryBlockStateReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @ToString 10 | public class QueryBlockStateReq implements VerifiableData { 11 | @Getter @Setter 12 | String hash; 13 | @Getter @Setter 14 | String channelId; 15 | @Getter @Setter 16 | String blockHash; 17 | 18 | SignerIdentityKey callerIdentityKey; 19 | public SignerIdentityKey getSignerIdentityKey() { 20 | return callerIdentityKey; 21 | } 22 | public void setSignerIdentityKey(SignerIdentityKey identity){ 23 | callerIdentityKey = identity; 24 | } 25 | public void setHash(String hash) { 26 | this.hash=hash; 27 | } 28 | 29 | public String getHash() { 30 | return hash; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryChainStateReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @ToString 10 | public class QueryChainStateReq implements VerifiableData { 11 | @Getter @Setter 12 | String hash; 13 | @Getter @Setter 14 | String channelId; 15 | @Getter @Setter 16 | Long blockHeight; 17 | 18 | SignerIdentityKey signerIdentityKey; 19 | public SignerIdentityKey getSignerIdentityKey() { 20 | return signerIdentityKey; 21 | } 22 | public void setSignerIdentityKey(SignerIdentityKey identity){ 23 | signerIdentityKey = identity; 24 | } 25 | public void setHash(String hash) { 26 | this.hash=hash; 27 | } 28 | 29 | public String getHash() { 30 | return hash; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryChannelReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * @author lida 11 | * @date 2019/9/10 19:23 12 | */ 13 | @ToString 14 | public class QueryChannelReq implements VerifiableData { 15 | @Getter @Setter 16 | String hash; 17 | @Getter @Setter 18 | String channelId; 19 | SignerIdentityKey signerIdentityKey; 20 | 21 | public SignerIdentityKey getSignerIdentityKey() { 22 | return signerIdentityKey; 23 | } 24 | 25 | public void setSignerIdentityKey(SignerIdentityKey identity) { 26 | signerIdentityKey = identity; 27 | } 28 | public void setHash(String hash) { 29 | this.hash=hash; 30 | } 31 | 32 | public String getHash() { 33 | return hash; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryHistoryBlockReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Data; 6 | 7 | @Data 8 | public class QueryHistoryBlockReq implements VerifiableData { 9 | String hash; 10 | String channelId; 11 | SignerIdentityKey signerIdentityKey; 12 | String fromHash; 13 | String toHash; 14 | Long count; 15 | Long fromHeight; 16 | Long toHeight; 17 | @Override 18 | public SignerIdentityKey getSignerIdentityKey() { 19 | return signerIdentityKey; 20 | } 21 | 22 | @Override 23 | public void setSignerIdentityKey(SignerIdentityKey identity){ 24 | signerIdentityKey = identity; 25 | } 26 | @Override 27 | public void setHash(String hash) { 28 | this.hash=hash; 29 | } 30 | 31 | @Override 32 | public String getHash() { 33 | return hash; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryHistoryBlockResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.block.Block; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.List; 9 | 10 | @ToString 11 | public class QueryHistoryBlockResp { 12 | @Getter @Setter 13 | List listBlock; 14 | } 15 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryHistoryQCReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @ToString 10 | public class QueryHistoryQCReq implements VerifiableData { 11 | @Getter @Setter 12 | String hash; 13 | @Getter @Setter 14 | String channelId; 15 | @Getter @Setter 16 | Long fromHeight; 17 | @Getter @Setter 18 | Long toHeight; 19 | SignerIdentityKey signerIdentityKey; 20 | @Override 21 | public SignerIdentityKey getSignerIdentityKey() { return signerIdentityKey;} 22 | 23 | @Override 24 | public void setSignerIdentityKey(SignerIdentityKey identity) { 25 | signerIdentityKey = identity; 26 | } 27 | @Override 28 | public void setHash(String hash) { 29 | this.hash=hash; 30 | } 31 | 32 | @Override 33 | public String getHash() { 34 | return hash; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryHistoryQCResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.consensus.GenericQC; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.List; 9 | @ToString 10 | public class QueryHistoryQCResp { 11 | @Getter @Setter 12 | List listQC; 13 | } 14 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/QueryViewNoReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @ToString 10 | public class QueryViewNoReq implements VerifiableData { 11 | @Getter @Setter 12 | String hash; 13 | @Getter @Setter 14 | String channelId; 15 | @Getter @Setter 16 | Long blockHeight; 17 | 18 | SignerIdentityKey signerIdentityKey; 19 | public SignerIdentityKey getSignerIdentityKey() { 20 | return signerIdentityKey; 21 | } 22 | public void setSignerIdentityKey(SignerIdentityKey identity){ 23 | signerIdentityKey = identity; 24 | } 25 | public void setHash(String hash) { 26 | this.hash=hash; 27 | } 28 | 29 | public String getHash() { 30 | return hash; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/datasource/AddDataSourceConfigReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity.datasource; 2 | 3 | import com.jinninghui.newspiral.gateway.vo.req.RPCParam; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | import javax.validation.constraints.Min; 10 | import javax.validation.constraints.NotBlank; 11 | 12 | @ToString 13 | public class AddDataSourceConfigReq extends RPCParam { 14 | 15 | 16 | @ApiModelProperty(value = "数据库ip") 17 | @Getter 18 | @Setter 19 | @NotBlank 20 | private String ip; 21 | 22 | @ApiModelProperty(value = "数据库端口") 23 | @Getter 24 | @Setter 25 | @Min(1) 26 | private String port; 27 | 28 | @ApiModelProperty(value = "数据库名") 29 | @Getter 30 | @Setter 31 | @NotBlank 32 | private String dbName; 33 | 34 | @ApiModelProperty(value = "数据库用户名") 35 | @Getter 36 | @Setter 37 | @NotBlank 38 | private String username; 39 | 40 | @ApiModelProperty(value = "数据库密码") 41 | @Getter 42 | @Setter 43 | @NotBlank 44 | private String password; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/datasource/ConfigResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity.datasource; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | @ToString 9 | public class ConfigResp { 10 | 11 | @ApiModelProperty(value = "成功标识") 12 | @Getter@Setter 13 | private boolean successflag; 14 | 15 | @ApiModelProperty(value = "返回数据") 16 | @Getter@Setter 17 | private T data; 18 | 19 | public ConfigResp(boolean successflag, T data) { 20 | this.successflag = successflag; 21 | this.data = data; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/datasource/DataSourceConfigResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity.datasource; 2 | 3 | 4 | import com.jinninghui.newspiral.common.entity.config.ChannelShardingInfo; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | @ToString 13 | public class DataSourceConfigResp { 14 | 15 | @ApiModelProperty(value = "数据源别名") 16 | @Getter 17 | @Setter 18 | String dsName; 19 | @ApiModelProperty(value = "数据库jdbc链接") 20 | @Getter 21 | @Setter 22 | String jdbcUrl; 23 | @ApiModelProperty(value = "数据源已经能被路由到,才可以为true") 24 | @Getter 25 | @Setter 26 | boolean routeable; 27 | @ApiModelProperty(value = "分库中存在的通道数量") 28 | @Getter 29 | @Setter 30 | int channelNums; 31 | @ApiModelProperty(value = "该分库中通道的相关信息") 32 | @Getter 33 | @Setter 34 | List channelShardingInfos; 35 | } 36 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/datasource/ModifyDataSourceConfigReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity.datasource; 2 | 3 | 4 | import com.jinninghui.newspiral.gateway.vo.req.RPCParam; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | import javax.validation.constraints.Min; 11 | import javax.validation.constraints.NotBlank; 12 | 13 | @ToString 14 | public class ModifyDataSourceConfigReq extends RPCParam { 15 | @ApiModelProperty(value = "数据源别名") 16 | @Getter 17 | @Setter 18 | @NotBlank 19 | private String dsName; 20 | @ApiModelProperty(value = "数据库ip") 21 | @Getter 22 | @Setter 23 | private String ip; 24 | @ApiModelProperty(value = "数据库端口") 25 | @Getter 26 | @Setter 27 | @Min(1) 28 | private String port; 29 | @ApiModelProperty(value = "数据库名") 30 | @Getter 31 | @Setter 32 | private String dbName; 33 | @ApiModelProperty(value = "数据库用户名") 34 | @Getter 35 | @Setter 36 | private String username; 37 | @ApiModelProperty(value = "数据库密码") 38 | @Getter 39 | @Setter 40 | private String password; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/entity/datasource/ShardingRuleReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.entity.datasource; 2 | 3 | import com.jinninghui.newspiral.gateway.vo.req.RPCParam; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | import javax.validation.Valid; 10 | import javax.validation.constraints.Min; 11 | 12 | import static com.jinninghui.newspiral.common.entity.config.ConfigConstant.blockHeightBuffer; 13 | 14 | @Valid 15 | @ToString 16 | public class ShardingRuleReq extends RPCParam { 17 | 18 | /** 19 | * 分片的高度范围 20 | */ 21 | @ApiModelProperty(value = "分片范围") 22 | @Min(value = blockHeightBuffer, message = "sharding范围必须大于冗余量,当前冗余量为" + blockHeightBuffer) 23 | @Getter @Setter 24 | Long shardingRange; 25 | 26 | /** 27 | * 启用的库个数 28 | */ 29 | @ApiModelProperty(value = "当前活跃数据库个数") 30 | @Min(value = 2, message = "数据库个数必须为两个或两个以上") 31 | @Getter @Setter 32 | Integer dbActiveNum; 33 | } 34 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/AddMySelfToChannelReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.transaction.SDKTransaction; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import javax.validation.Valid; 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.NotNull; 11 | import java.util.List; 12 | 13 | /** 14 | * @version V1.0 15 | * @Title: AddMySelfToChannelReq 16 | * @Package com.jinninghui.newspiral.gateway.vo.req 17 | * @Description: 18 | * @author: xuxm 19 | * @date: 2019/12/16 10:37 20 | */ 21 | @ApiModel(description = "节点请求加入自身到通道中的请求体") 22 | @Data 23 | public class AddMySelfToChannelReq extends RPCParam { 24 | /** 25 | * 已经在通道中的节点的集合 26 | */ 27 | @ApiModelProperty("已经在通道中的节点的url集合") 28 | @Valid 29 | @NotEmpty 30 | private List serviceUrlForPeerList; 31 | /** 32 | * 新交易 33 | */ 34 | @ApiModelProperty("系统交易,新增一个节点(addOnePeer)") 35 | @Valid 36 | @NotNull 37 | private SDKTransaction newMemberTransaction; 38 | } 39 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/BlockHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: BlockHeightReq 11 | * @Package com.jinninghui.newspiral.gateway.vo.req 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2019/12/7 11:45 15 | */ 16 | @Data 17 | public class BlockHashReq extends RPCParam { 18 | /** 19 | * 区块Hash 20 | */ 21 | @ApiModelProperty(value = "区块Hash值") 22 | @NotBlank 23 | private String blockHash; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/BlockHeightRegionReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.Min; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: BlockHeightReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2019/12/7 11:45 16 | */ 17 | @Data 18 | public class BlockHeightRegionReq extends RPCParam { 19 | /** 20 | * 区块起始高度 21 | */ 22 | @ApiModelProperty("区块起始高度(高度不能小于零)") 23 | @NotNull 24 | @Min(value = 0,message = "高度不能小于零") 25 | private Long fromHeight; 26 | 27 | /** 28 | * 区块结束高度 29 | */ 30 | @ApiModelProperty(value = "区块结束高度(高度不能小于零)") 31 | @NotNull 32 | @Min(value = 0,message = "高度不能小于零") 33 | private Long toHeight; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/BlockHeightReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.Min; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: BlockHeightReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2019/12/7 11:45 16 | */ 17 | @Data 18 | public class BlockHeightReq extends RPCParam { 19 | /** 20 | * 区块高度 21 | */ 22 | @ApiModelProperty(value = "区块高度(高度不能小于零)") 23 | @NotNull 24 | @Min(value = 0,message = "高度不能小于零") 25 | private Long height; 26 | 27 | /** 28 | * 是否使用已校验数据 29 | * 仅用于校验节点数据是否合法时 30 | */ 31 | @ApiModelProperty(value = "仅用于校验节点数据是否合法时,需不需要从创世区块开始校验。" + 32 | "true代表从历史校验过的区块最高高度开始校验," + 33 | "false表示从创世块开始校验,默认为true") 34 | private boolean flag = true; 35 | } 36 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/CertDataReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.cert.CertData; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: CertDataReq 10 | * @Package com.jinninghui.newspiral.gateway.vo.req 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2021/2/3 14:33 14 | */ 15 | @Data 16 | public class CertDataReq extends RPCParam { 17 | @ApiModelProperty(value = "证书生成实体") 18 | private CertData certData; 19 | //private HttpServletResponse response; 20 | } 21 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ChangeLoggerLevelReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.task.LoggerEnum; 4 | import lombok.Data; 5 | 6 | 7 | @Data 8 | public class ChangeLoggerLevelReq extends RPCParam { 9 | /** 10 | * 日志修改级别 11 | */ 12 | private LoggerEnum logLevel; 13 | } 14 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ChannelIdReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: ChannelIdReq 10 | * @Package com.jinninghui.newspiral.gateway.vo.req 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2019/12/7 11:48 14 | */ 15 | @ApiModel(description = "通道ID请求体") 16 | @Data 17 | public class ChannelIdReq { 18 | /** 19 | * 通道ID 20 | */ 21 | @ApiModelProperty(value = "通道ID") 22 | private String channelId; 23 | } 24 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ChannelInitReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.chain.Peer; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import javax.validation.Valid; 9 | import javax.validation.constraints.NotNull; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @version V1.0 15 | * @Title: ChannelInitReq 16 | * @Package com.jinninghui.newspiral.gateway.vo.req 17 | * @Description: 18 | * @author: xuxm 19 | * @date: 2019/12/13 14:19 20 | */ 21 | @ApiModel("通道初始化请求体") 22 | @Data 23 | public class ChannelInitReq extends RPCParam { 24 | 25 | /** 26 | * 创建通道的组织id 27 | */ 28 | //private String organizationId; 29 | /** 30 | * 一条链的基本参数 31 | */ 32 | @ApiModelProperty("通道基本参数") 33 | @NotNull 34 | @Valid 35 | private ChannelBasicParamsReq channelBasicParams=new ChannelBasicParamsReq(); 36 | 37 | 38 | /** 39 | * 预留字段,除本地节点外的其他需要加入的节点 40 | */ 41 | @ApiModelProperty("预留字段,除本地节点外的其他需要加入的节点(当前版本仅支持由单个节点初始化通道,该字段参数无效)") 42 | private List addPeerList=new ArrayList<>(); 43 | } 44 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ChannelMasterPublicKeyReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.chain.Peer; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotEmpty; 9 | import java.util.List; 10 | 11 | /** 12 | * @version V1.0 13 | * @Title: ChannelMasterPublicKeyReq 14 | * @Package com.jinninghui.newspiral.gateway.vo.req 15 | * @Description: 16 | * @author: xuxm 17 | * @date: 2019/12/16 15:05 18 | */ 19 | @Data 20 | public class ChannelMasterPublicKeyReq extends RPCParam { 21 | /** 22 | * 通道主公钥 23 | */ 24 | @NotBlank 25 | private String masterPublicKey; 26 | /** 27 | *节点信息 28 | */ 29 | @Valid 30 | @NotEmpty 31 | private List channelPeerList; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ChannelPeerPrivateKeyReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.chain.Peer; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotEmpty; 8 | import java.util.List; 9 | 10 | /** 11 | * @version V1.0 12 | * @Title: ChannelPeerPrivateKeyReq 13 | * @Package com.jinninghui.newspiral.gateway.vo.req 14 | * @Description: 15 | * @author: xuxm 16 | * @date: 2019/12/16 15:02 17 | */ 18 | @Data 19 | public class ChannelPeerPrivateKeyReq extends RPCParam { 20 | /** 21 | * 节点信息列表 (此节点信息需要带着节点用户私钥哦) 22 | */ 23 | @Valid 24 | @NotEmpty 25 | private List channelPeerList; 26 | } 27 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/ExitMySelfFromChannelReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.transaction.SDKTransaction; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 16 | */ 17 | @Data 18 | public class ExitMySelfFromChannelReq extends RPCParam { 19 | /** 20 | * 新交易 21 | */ 22 | @Valid 23 | @NotNull 24 | private SDKTransaction exitTransaction; 25 | } 26 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/HeightReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.Min; 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: ChannelIdReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2019/12/7 11:48 16 | */ 17 | @Data 18 | public class HeightReq { 19 | /** 20 | * 通道ID 21 | */ 22 | @NotBlank 23 | private String channelId; 24 | @NotNull 25 | @Min(value = 0,message = "高度不能小于零") 26 | private Long height; 27 | } 28 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/IpConstraintReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.ddos.IpConstraintListParam; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import java.util.List; 9 | 10 | @Data 11 | public class IpConstraintReq extends RPCParam { 12 | 13 | /** 14 | * 黑名单列表 15 | */ 16 | @ApiModelProperty("黑名单列表") 17 | @NotEmpty 18 | private List ipConstraintListParams; 19 | } 20 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/LimitParamReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.ddos.LimitParam; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import java.util.List; 9 | 10 | @Data 11 | public class LimitParamReq extends RPCParam { 12 | 13 | /** 14 | * 限流参数列表 15 | */ 16 | @ApiModelProperty("限流参数参数列表") 17 | @NotEmpty 18 | List limitParams; 19 | } 20 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/PeerChannelIssuerReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @ClassName PeerChannelIssuerReq 10 | * @Author owen 11 | * @Date 2021-04-21 2021-04-21 15:25 12 | * @Version 1.0 13 | * @Description 查询相同通道相同组织下的节点 14 | **/ 15 | @Data 16 | public class PeerChannelIssuerReq extends RPCParam { 17 | 18 | /** 19 | * 组织ID 20 | */ 21 | @ApiModelProperty(value = "组织ID") 22 | @NotNull 23 | private String issuerID; 24 | } 25 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryChainStateReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: QueryWorldStateReq 9 | * @Package com.jinninghui.newspiral.gateway.vo.req 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/2/8 11:11 13 | */ 14 | @ApiModel(description = "节点信息") 15 | @Data 16 | public class QueryChainStateReq extends RPCParam { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryLatestBlockListReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.Max; 6 | import javax.validation.constraints.Min; 7 | 8 | @Data 9 | public class QueryLatestBlockListReq extends RPCParam { 10 | 11 | 12 | /** 13 | * 查询个数 14 | */ 15 | @Max(value = 10) 16 | @Min(value = 1) 17 | private int num; 18 | } 19 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryTransHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | import lombok.Data; 3 | import javax.validation.constraints.NotBlank; 4 | 5 | /** 6 | * @version V1.0 7 | * @Title: TransHashReq 8 | * @Package com.jinninghui.newspiral.gateway.vo.req 9 | * @Description: 10 | * @author: xuxm 11 | * @date: 2019/12/7 14:58 12 | */ 13 | @Data 14 | public class QueryTransHashReq { 15 | /** 16 | *交易hash值 17 | */ 18 | @NotBlank 19 | private String transHash; 20 | 21 | /** 22 | * 通道ID 23 | */ 24 | @NotBlank 25 | private String channelId; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryTransactionsByBlockHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotBlank; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: TransHashReq 10 | * @Package com.jinninghui.newspiral.gateway.vo.req 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2019/12/7 14:58 14 | */ 15 | @Data 16 | public class QueryTransactionsByBlockHashReq extends RPCParam { 17 | /** 18 | *blockhash值 19 | */ 20 | @NotBlank 21 | private String blockHash; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryTxReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: QueryTxReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/5/28 15:37 16 | */ 17 | @ApiModel(description = "交易账本查询请求体") 18 | @Data 19 | public class QueryTxReq extends RPCParam { 20 | /** 21 | * 账本key 22 | */ 23 | @ApiModelProperty(value = "账本key") 24 | @NotBlank 25 | private String key; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/QueryWorldStateReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: QueryWorldStateReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2020/2/8 11:11 16 | */ 17 | @ApiModel(description = "查询世界状态请求体") 18 | @Data 19 | public class QueryWorldStateReq extends RPCParam { 20 | 21 | /** 22 | * 世界状态key 23 | */ 24 | @ApiModelProperty(value = "世界状态key") 25 | @NotBlank 26 | private String key; 27 | 28 | 29 | @ApiModelProperty(value = "是否查询附属信息的表示") 30 | private boolean attachFlag; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/RPCParam.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.VerifiableData; 4 | import com.jinninghui.newspiral.common.entity.identity.SignerIdentityKey; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import javax.validation.Valid; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * @version V1.0 13 | * @Title: RPCParamImpl 14 | * @Package com.jinninghui.newspiral.gateway.vo.req 15 | * @Description: 16 | * @author: xuxm 17 | * @date: 2020/10/21 15:55 18 | */ 19 | @Data 20 | public class RPCParam implements VerifiableData { 21 | 22 | /** 23 | *入参参数除身份之外字段的hash 24 | */ 25 | @ApiModelProperty(value = "入参参数除身份之外字段的hash",hidden = true) 26 | private String hash; 27 | /** 28 | * 调用者身份 29 | */ 30 | @ApiModelProperty(value = "调用者身份标识") 31 | @NotNull 32 | @Valid 33 | private SignerIdentityKey signerIdentityKey; 34 | } 35 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/RemovePeerFromChannelReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.transaction.SDKTransaction; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 16 | */ 17 | @Data 18 | public class RemovePeerFromChannelReq extends RPCParam { 19 | 20 | /** 21 | * 新交易 22 | */ 23 | @Valid 24 | @NotNull 25 | private SDKTransaction removeTransaction; 26 | } 27 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/SDKTransactionReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.transaction.SDKTransaction; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import javax.validation.Valid; 9 | import javax.validation.constraints.NotNull; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @version V1.0 14 | * @Title: SDKTransactionReq 15 | * @Package com.jinninghui.newspiral.gateway.vo.req 16 | * @Description: 17 | * @author: xuxm 18 | * @date: 2019/12/10 16:11 19 | */ 20 | @ApiModel(description = "SDK侧交易请求体") 21 | @Data 22 | public class SDKTransactionReq extends RPCParam implements Serializable { 23 | 24 | 25 | @ApiModelProperty("SDK业务交易") 26 | @NotNull 27 | @Valid 28 | private SDKTransaction sdkTransaction; 29 | } 30 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/TransAlreadyConsensusByTimeReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @ClassName TransAlreadyConsensusByTimeReq 10 | * @Author owen 11 | * @Date 2021-04-23 2021-04-23 15:50 12 | * @Version 1.0 13 | * @Description 根据时间维度查询已经共识的通道中交易列表 14 | **/ 15 | @Data 16 | public class TransAlreadyConsensusByTimeReq extends RPCParam { 17 | 18 | @ApiModelProperty(value = "开始时间, eg: System.currentTimeMillis()") 19 | @NotNull 20 | private Long startTime; 21 | 22 | @ApiModelProperty(value = "结束时间, eg: System.currentTimeMillis()") 23 | @NotNull 24 | private Long endTime; 25 | } 26 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/TransBlockHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotBlank; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * @version V1.0 13 | * @Title: TransHashReq 14 | * @Package com.jinninghui.newspiral.gateway.vo.req 15 | * @Description: 16 | * @author: xuxm 17 | * @date: 2019/12/7 14:58 18 | */ 19 | @ApiModel(description = "区块hash和交易序号请求体") 20 | @Data 21 | public class TransBlockHashReq extends RPCParam { 22 | 23 | /** 24 | *blockhash值 25 | */ 26 | @ApiModelProperty(value = "区块hash值") 27 | @NotBlank 28 | private String blockHash; 29 | 30 | /** 31 | * 交易Index 32 | */ 33 | @ApiModelProperty(value = "交易索引,不能小于1") 34 | @NotNull 35 | @Min(value = 1,message = "大小不能小于一") 36 | private Integer indexInBlock; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/TransClientTxIdReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: TransHashReq 11 | * @Package com.jinninghui.newspiral.gateway.vo.req 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2019/12/7 14:58 15 | */ 16 | @Data 17 | public class TransClientTxIdReq extends RPCParam { 18 | /** 19 | *客户端交易ID值 20 | */ 21 | @ApiModelProperty(value = "客户端交易ID值") 22 | @NotBlank 23 | private String clientTxId; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/TransHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | /** 10 | * @version V1.0 11 | * @Title: TransHashReq 12 | * @Package com.jinninghui.newspiral.gateway.vo.req 13 | * @Description: 14 | * @author: xuxm 15 | * @date: 2019/12/7 14:58 16 | */ 17 | @ApiModel(description = "交易Hash请求体") 18 | @Data 19 | public class TransHashReq extends RPCParam { 20 | /** 21 | *交易hash值 22 | */ 23 | @ApiModelProperty(value = "交易Hash值") 24 | @NotBlank 25 | private String transHash; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/TransRegionBlockHashReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @data 2020/10/26 10 | * @author whj 11 | */ 12 | @Data 13 | public class TransRegionBlockHashReq extends RPCParam { 14 | /** 15 | *区块hash值 16 | */ 17 | @ApiModelProperty(value = "区块hash值") 18 | @NotBlank 19 | private String blockHash; 20 | 21 | /** 22 | * 交易index范围start 23 | */ 24 | @ApiModelProperty(value = "交易在区块中的开始序号") 25 | private Integer TxIndexFrom; 26 | 27 | /** 28 | *交易index范围end 29 | */ 30 | @ApiModelProperty(value = "交易在区块中的结束序号") 31 | private Integer TxIndexTo; 32 | } 33 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/UpdatePeerCertificateReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.chain.Peer; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotEmpty; 9 | import java.util.List; 10 | 11 | /** 12 | * @version V1.0 13 | * @Title: AddMySelfToChannelReq 14 | * @Package com.jinninghui.newspiral.gateway.vo.req 15 | * @Description: 16 | * @author: xuxm 17 | * @date: 2019/12/16 10:37 18 | */ 19 | @Data 20 | public class UpdatePeerCertificateReq extends RPCParam { 21 | 22 | /** 23 | * 需要修改的节点的信息 24 | */ 25 | @Valid 26 | @NotEmpty 27 | private List channelPeerList; 28 | /** 29 | * 通道ID 30 | */ 31 | @NotBlank 32 | private String channelId; 33 | } 34 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/req/UserCertDataReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.req; 2 | 3 | import com.jinninghui.newspiral.common.entity.cert.CertData; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: CertDataReq 10 | * @Package com.jinninghui.newspiral.gateway.vo.req 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2021/2/3 14:33 14 | */ 15 | @Data 16 | public class UserCertDataReq extends RPCParam { 17 | @ApiModelProperty(value = "证书生成实体") 18 | private CertData certData; 19 | //private HttpServletResponse response; 20 | 21 | @ApiModelProperty(value = "根证书文件") 22 | private String rootCert; 23 | @ApiModelProperty(value = "根证书文件私钥") 24 | private String rootPrivateKey; 25 | } 26 | -------------------------------------------------------------------------------- /gateway-interface/src/main/java/com/jinninghui/newspiral/gateway/vo/resp/CreateChannelResp.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.gateway.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: createChannelResp 9 | * @Package com.jinninghui.newspiral.gateway.vo.resp 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/8/5 17:55 13 | */ 14 | @Data 15 | public class CreateChannelResp { 16 | 17 | /** 18 | * 通道Id 19 | */ 20 | @ApiModelProperty("通道Id") 21 | private String channelId; 22 | 23 | /** 24 | * 成员身份ID 25 | */ 26 | @ApiModelProperty("成员身份ID") 27 | private String memberId; 28 | 29 | /** 30 | * 创建时间戳 31 | */ 32 | @ApiModelProperty("创建时间戳") 33 | private Long createTimestamp; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/contract/BusinessBusinessContractExample2.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.contract; 2 | 3 | 4 | import com.jinninghui.newspiral.ledger.mgr.contract.BusinessContractBase; 5 | import com.jinninghui.newspiral.ledger.mgr.contract.BussinessContractConnector; 6 | 7 | /** 8 | * @author lida 9 | * @date 2019/9/24 16:09 10 | */ 11 | public class BusinessBusinessContractExample2 extends BusinessContractBase { 12 | 13 | 14 | public BusinessBusinessContractExample2(BussinessContractConnector connector) { 15 | super(connector); 16 | } 17 | 18 | public String businessQuerySCTest(String channelId, Integer num) 19 | { 20 | System.out.println("--------call---------businessQuerySCTest--------"); 21 | String value = smartContractMgr.getBlockTest(channelId,num); 22 | System.out.println("业务合约中查key:"+channelId+",得到Value:"+value); 23 | return value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/contract/BusinessBusinessContractExample3.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.contract; 2 | 3 | 4 | import com.jinninghui.newspiral.ledger.mgr.contract.BusinessContractBase; 5 | import com.jinninghui.newspiral.ledger.mgr.contract.BussinessContractConnector; 6 | 7 | /** 8 | * @author lida 9 | * @date 2019/9/24 16:09 10 | */ 11 | public class BusinessBusinessContractExample3 extends BusinessContractBase { 12 | 13 | 14 | public BusinessBusinessContractExample3(BussinessContractConnector connector) { 15 | super(connector); 16 | } 17 | 18 | public String businessQuerySCTest3(String channelId) 19 | { 20 | System.out.println("--------call---------businessQuerySCTest--------"); 21 | String value = channelId; 22 | System.out.println("业务合约中查key:"+channelId+",得到Value:"+value); 23 | return value; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/fabric/ChaincodeBaseBusiness.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.fabric; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.contract.BusinessContractBase; 4 | import com.jinninghui.newspiral.ledger.mgr.contract.BussinessContractConnector; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: ChaincodeBase 9 | * @Package com.jinninghui.newspiral.ledger.mgr.impl.fabric 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/1/2 14:52 13 | */ 14 | public abstract class ChaincodeBaseBusiness extends BusinessContractBase implements Chaincode { 15 | public ChaincodeBaseBusiness(BussinessContractConnector connector) { 16 | super(connector); 17 | } 18 | 19 | @Override 20 | public abstract Response init(ChaincodeStub stub); 21 | 22 | @Override 23 | public abstract Response invoke(ChaincodeStub stub); 24 | } 25 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/StateAccessModeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/9/26 10:46 8 | */ 9 | public enum StateAccessModeEnum { 10 | 11 | TRANS_CREATE_FOR_STEPQC_VERIFY("TRANS_CREATE_FOR_STEPQC_VERIFY","交易执行引擎执行智能合约校验串行时候使用"), 12 | TRANS_CREATE_FOR_FIXQC_VERIFY("TRANS_CREATE_FOR_FIXQC_VERIFY","交易执行引擎执行智能合约校验并行时候使用"), 13 | PERSIST_STATE("PERSIST_STATE","存储已共识区块时使用,会修改持久化世界状态的值"), 14 | QUERY_TRANS_EXXECUTE("QUERY_TRANS_EXXECUTE","交易管理模块执行Query交易时调用"), 15 | UNDEFINED("UNDEFINED","未定义状态,账本模块将拒绝任何操作"); 16 | public final String code; 17 | public final String message; 18 | StateAccessModeEnum(String code, String message) { 19 | this.code = code; 20 | this.message = message; 21 | } 22 | public String getCode() { 23 | return code; 24 | } 25 | public String getMessage() { 26 | return message; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return JSON.toJSONString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/StateStorage.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr; 2 | 3 | 4 | 5 | /** 6 | * @author lida 7 | * @date 2019/10/5 7:53 8 | * 状态存储接口 9 | * 该接口会注入到所有的智能合约对象中 10 | * 使用StateStorage是为了限制业务智能合约所能使用到的能力范围,避免越界使用LedgerMgr的接口 11 | */ 12 | public interface StateStorage { 13 | 14 | byte[] getState(String key); 15 | 16 | void insertState(String key, byte[] value); 17 | 18 | void updateState(String key, byte[] newValue); 19 | 20 | /** 21 | * 设置key指定的状态的value为输入的value,如果不存在则新增,如果存在则更新 22 | * @param key 23 | * @param value 24 | */ 25 | void putState(String key, byte[] value); 26 | 27 | boolean existKey(String key); 28 | 29 | /** 30 | * 删除成功,返回true,否则返回false 31 | * @param key 32 | * @return 33 | */ 34 | boolean deleteKey(String key); 35 | } 36 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/contract/BusinessContractBase.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.contract; 2 | 3 | /** 4 | * @author lida 5 | * @date 2019/9/21 11:18 6 | * 所有的智能合约都需要继承这个虚类,以获得使用账本的能力 7 | */ 8 | public abstract class BusinessContractBase extends ContractBase implements BussinessContractCaller, BussinessContractConnector { 9 | 10 | protected BussinessContractConnector connector; 11 | 12 | public BusinessContractBase(BussinessContractConnector connector) { 13 | this.connector = connector; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/contract/BussinessContractCaller.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.contract; 2 | 3 | 4 | 5 | public interface BussinessContractCaller { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/contract/BussinessContractConnector.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.contract; 2 | 3 | public interface BussinessContractConnector { 4 | } 5 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/contract/ContractBase.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.contract; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.SmartContractMgr; 4 | 5 | public abstract class ContractBase { 6 | 7 | protected SmartContractMgr smartContractMgr; 8 | 9 | public SmartContractMgr getSmartContractMgr() { 10 | return smartContractMgr; 11 | } 12 | 13 | public void setSmartContractMgr(SmartContractMgr smartContractMgr) { 14 | this.smartContractMgr = smartContractMgr; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ledger-mgr-interface/src/main/java/com/jinninghui/newspiral/ledger/mgr/contract/SystemContractBase.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.contract; 2 | 3 | public abstract class SystemContractBase extends ContractBase{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/AuthModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import com.jinninghui.newspiral.common.entity.member.Auth; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class AuthModel { 10 | 11 | private Integer id; 12 | 13 | private String authName; 14 | 15 | private String authCode; 16 | 17 | private String authDescription; 18 | 19 | private Date createTime; 20 | 21 | private Date updateTime; 22 | 23 | public Auth toAuth(){ 24 | Auth auth = new Auth(); 25 | auth.setAuthId(this.getId()); 26 | auth.setAuthCode(this.getAuthCode()); 27 | auth.setAuthDescription(this.getAuthDescription()); 28 | auth.setAuthName(this.getAuthName()); 29 | return auth; 30 | } 31 | 32 | public void test(){ 33 | System.out.println("123123"); 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/ChannelShardingInfoModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import com.jinninghui.newspiral.common.entity.config.ChannelShardingInfo; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class ChannelShardingInfoModel { 8 | private String channelId; 9 | 10 | private String channelName; 11 | 12 | private long maxHeightInEachDs; 13 | 14 | public ChannelShardingInfo toChannelShardingInfo() { 15 | ChannelShardingInfo info = new ChannelShardingInfo(); 16 | info.setChannelId(this.channelId); 17 | info.setChannelName(this.channelName); 18 | info.setMaxHeightInEachDs(this.maxHeightInEachDs); 19 | return info; 20 | } 21 | 22 | public static ChannelShardingInfoModel createInstance(ChannelShardingInfo info) { 23 | ChannelShardingInfoModel model = new ChannelShardingInfoModel(); 24 | model.setChannelId(info.getChannelId()); 25 | model.setChannelName(info.getChannelName()); 26 | model.setMaxHeightInEachDs(info.getMaxHeightInEachDs()); 27 | return model; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/LocalConfigModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import com.jinninghui.newspiral.common.entity.config.LocalConfig; 4 | import lombok.Data; 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotNull; 8 | 9 | 10 | @Data 11 | @Valid 12 | public class LocalConfigModel { 13 | 14 | @NotNull 15 | private String key; 16 | @NotNull 17 | private String value; 18 | private String type; 19 | private int show; 20 | 21 | public LocalConfig toLocalConfig() { 22 | LocalConfig config = new LocalConfig(); 23 | config.setType(this.type); 24 | config.setKey(this.key); 25 | config.setValue(this.value); 26 | config.setShow(this.show); 27 | return config; 28 | } 29 | 30 | 31 | public static LocalConfigModel createInstance(LocalConfig config){ 32 | LocalConfigModel configModel = new LocalConfigModel(); 33 | configModel.setKey(config.getKey()); 34 | configModel.setValue(config.getValue()); 35 | configModel.setType(config.getType()); 36 | return configModel; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/MemberRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.UUID; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: MemberRoleModel 10 | * @Package com.jinninghui.newspiral.ledger.mgr.impl.domain 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2020/1/10 11:12 14 | */ 15 | @Data 16 | public class MemberRoleModel { 17 | /** 18 | * 主键 19 | */ 20 | private String id; 21 | /** 22 | * 成员Id 23 | */ 24 | private long memberId; 25 | /** 26 | * 角色Id 27 | */ 28 | private String roleId; 29 | /** 30 | * 通道编号 31 | */ 32 | private String channelId; 33 | 34 | public static MemberRoleModel createInstance(long memberId,String roleId,String channelId) 35 | { 36 | MemberRoleModel memberRoleModel=new MemberRoleModel(); 37 | memberRoleModel.setId(UUID.randomUUID().toString().replaceAll("-","").toUpperCase()); 38 | memberRoleModel.setMemberId(memberId); 39 | memberRoleModel.setRoleId(roleId); 40 | memberRoleModel.setChannelId(channelId); 41 | return memberRoleModel; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/MessageModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.jinninghui.newspiral.common.entity.consensus.GenericMsg; 5 | 6 | 7 | public class MessageModel { 8 | private Long id; 9 | 10 | private Long viewNumber; 11 | 12 | private String channelId; 13 | 14 | private String content; 15 | 16 | public Long getId () { return id; } 17 | 18 | public void setId (Long id) { 19 | this.id = id; 20 | } 21 | 22 | public Long getViewNumber () { return viewNumber; } 23 | 24 | public void setViewNumber (Long viewNumber) { 25 | this.viewNumber = viewNumber; 26 | } 27 | 28 | public String getChannelId() { return channelId;} 29 | 30 | public void setChannelId(String channelId) { this.channelId=channelId;} 31 | 32 | public String getContent () { return content; } 33 | 34 | public void setContent (String content) { 35 | this.content = content; 36 | } 37 | 38 | public GenericMsg toGenericMsg() { 39 | GenericMsg genericMsg = JSON.parseObject(this.content, GenericMsg.class); 40 | return genericMsg; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/PeerChannelModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | 4 | 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | @Data 10 | public class PeerChannelModel { 11 | 12 | private Integer id; 13 | //对应identityKey中的value 14 | private String peerId; 15 | 16 | private String channelId; 17 | 18 | private Date joinTimestamp; 19 | 20 | private String extendedData; 21 | 22 | private String userPrivateKey; 23 | 24 | private Long inBlockHeight; 25 | 26 | private Long outBlockHeight; 27 | 28 | private String actionType; 29 | 30 | private Date updateTimestamp; 31 | } -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/SmartContractModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class SmartContractModel extends SmartContractModelKey { 9 | private String scClassHash; 10 | 11 | private Date setupTimestamp; 12 | 13 | private String flag; 14 | 15 | private Date updateTime; 16 | 17 | /** 18 | * 扩展属性 19 | */ 20 | private String extendedData; 21 | 22 | 23 | 24 | } -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/SmartContractModelKey.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SmartContractModelKey { 7 | private String scName; 8 | 9 | private String scVersion; 10 | 11 | private String scChannelId; 12 | 13 | /** 14 | * 别名 15 | */ 16 | private String alisa; 17 | 18 | } -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/SystemVersionModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import com.jinninghui.newspiral.common.entity.version.VersionResp; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class SystemVersionModel { 10 | 11 | private Long id; 12 | 13 | private String version; 14 | 15 | private String remark; 16 | 17 | private Date createTime; 18 | 19 | 20 | public VersionResp toVersionResp(){ 21 | VersionResp versionResp = new VersionResp(); 22 | versionResp.setVersion(this.getVersion()); 23 | versionResp.setRemark(this.getRemark()); 24 | return versionResp; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/TimeConsumingModel.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class TimeConsumingModel { 7 | private Long id; 8 | 9 | private Long viewNumber; 10 | 11 | private Long phaseOne; 12 | 13 | private Long phaseTwo; 14 | 15 | private Long phaseThree; 16 | 17 | private Long phaseFour; 18 | 19 | private Long timeout; 20 | 21 | private Long receiveBlock; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/domain/TransactionModelExpandStateHistory.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.domain; 2 | 3 | import java.util.Date; 4 | 5 | 6 | public class TransactionModelExpandStateHistory extends TransactionModelWithBLOBs { 7 | 8 | private Date consensusTimeStamp; 9 | 10 | public Date getConsensusTimeStamp() { 11 | return consensusTimeStamp; 12 | } 13 | 14 | public void setConsensusTimeStamp(Date consensusTimeStamp) { 15 | this.consensusTimeStamp = consensusTimeStamp; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/AuthMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.AuthModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface AuthMapper { 9 | 10 | List selectAll(); 11 | 12 | String selectIdByMemberInfo(@Param("channelId") String channelId,@Param("publicKey") String publicKey); 13 | 14 | String selectIdByInterfaceInfo(@Param("mthFullName") String mthFullName); 15 | /** 16 | * 根据id查询权限名称 17 | */ 18 | AuthModel selectAuthById(Integer id); 19 | /** 20 | * 查询到所有的权限数组 21 | */ 22 | List selectAuthIds(); 23 | 24 | /** 25 | * 根据AuthCode查询AuthId 26 | */ 27 | String selectAuthIdByAuthCode(String authCode); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/ChannelModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.ChannelModel; 4 | 5 | import java.util.List; 6 | 7 | public interface ChannelModelMapper { 8 | int deleteByPrimaryKey(String channelId); 9 | 10 | int insert(ChannelModel record); 11 | 12 | int insertSelective(ChannelModel record); 13 | 14 | ChannelModel selectByPrimaryKey(String channelId); 15 | 16 | int updateByPrimaryKeySelective(ChannelModel record); 17 | 18 | int updateByPrimaryKey(ChannelModel record); 19 | 20 | List selectAll(); 21 | 22 | ChannelModel selectByName(String name); 23 | 24 | int updateFlagByPrimaryKey(ChannelModel record); 25 | } -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/IdentityModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.IdentityModel; 4 | 5 | import java.util.List; 6 | 7 | public interface IdentityModelMapper { 8 | int deleteByPrimaryKey(String identityId); 9 | 10 | int insert(IdentityModel record); 11 | 12 | int insertSelective(IdentityModel record); 13 | 14 | IdentityModel selectByPrimaryKey(String identityId); 15 | 16 | List selectAll(); 17 | 18 | int updateByPrimaryKeySelective(IdentityModel record); 19 | 20 | int updateByPrimaryKey(IdentityModel record); 21 | } -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/InterfaceRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.common.entity.record.InterfaceRecord; 4 | import com.jinninghui.newspiral.common.entity.record.InterfaceRecordBO; 5 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.InterfaceRecordModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface InterfaceRecordMapper { 11 | /** 12 | * 批量插入接口详细调用记录 13 | * @param interfaceRecordModelList 14 | */ 15 | void batchInsert(@Param("list")List interfaceRecordModelList); 16 | 17 | /** 18 | * 按照条件查询总数 19 | * @param interfaceRecordBO 20 | * @return 21 | */ 22 | Long slectTotalCount(@Param("interfaceBo") InterfaceRecordBO interfaceRecordBO); 23 | 24 | /** 25 | * 根据条件查询总记录数 26 | * @param interfaceRecordBO 27 | * @return 28 | */ 29 | List selectByPage(@Param("interfaceBo") InterfaceRecordBO interfaceRecordBO); 30 | 31 | /** 32 | * 删除指定日志之前的所有记录 33 | * @param beforeDayTime 34 | */ 35 | void deleteFromDayTime(@Param("beforeDayTime") String beforeDayTime); 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/InterfaceRecordSummaryMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.InterfaceRecordSummaryModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface InterfaceRecordSummaryMapper { 9 | /** 10 | * 没有则插入,有则更新指定字段 11 | * @param interfaceRecordSummaryModelList 12 | */ 13 | void duplicateKeyInsertAndUpdate(@Param("list") List interfaceRecordSummaryModelList); 14 | 15 | /** 16 | * 查询所有的接口调用记录 17 | * @return 18 | */ 19 | List selectInterfaceRecordSummary(); 20 | } 21 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/IpConstraintListMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.IpConstraintListModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface IpConstraintListMapper { 9 | 10 | 11 | public void batchInsertForIpConstraintList(@Param("list") List ipConstraintListModels); 12 | 13 | void updateForIpConstraintList(@Param("list") List ipConstraintListModels); 14 | 15 | List selectBlackList(); 16 | 17 | List selectByIpAddrAndConstraintTyep(@Param("ipAddr") String ipAddr, @Param("constraintType") String constraintType); 18 | 19 | int selectInterfaceByClassName(@Param("className") String className); 20 | 21 | int selectInterfaceByMethodName(@Param("methodName") String methodName); 22 | 23 | List selectWhiteList(); 24 | } 25 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/LocalConfigModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; 4 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.LocalConfigModel; 5 | import org.apache.ibatis.annotations.MapKey; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public interface LocalConfigModelMapper { 13 | 14 | String selectByKey(@Param("key") String key); 15 | 16 | List selectByType(@Param("type") String type); 17 | 18 | @MapKey("key") 19 | Map selectLikeKey(@Param("key") String key); 20 | 21 | List selectAll(); 22 | 23 | int insert(@Param("record") LocalConfigModel model); 24 | 25 | int update(@Param("record") LocalConfigModel model); 26 | 27 | int insertBatch(@Param("records") List modelList); 28 | 29 | int queryJdbcCount(@Param("value") String value); 30 | 31 | @DS("sharding") 32 | @MapKey("CHANNEL_ID") 33 | HashMap queryChannelMaxBlockId(); 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/MemberMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.MemberModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: MemberMapper 11 | * @Package com.jinninghui.newspiral.ledger.mgr.impl.mapper 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/11 10:48 15 | */ 16 | public interface MemberMapper { 17 | int deleteByPrimaryKey(String memberId); 18 | MemberModel selectByPrimaryKey(Long memberId); 19 | MemberModel selectByPublicKey(String channelId,String publicKey); 20 | int insert(MemberModel record); 21 | int updateByPrimaryKeySelective(MemberModel record); 22 | List selectAll(); 23 | List selectByCondition(String channelId,Long id,String roleId); 24 | List selectByChannelAndStatus(String channelId,String status); 25 | List selectMembersOfRole(String channelId, String roleName); 26 | MemberModel selectOrganziationMember(String channelId,String issuerId ); 27 | int deleteByChannelId(@Param("channelId")String channelId); 28 | } 29 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/MemberRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.MemberRoleModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: MemberRoleMapper 11 | * @Package com.jinninghui.newspiral.ledger.mgr.impl.mapper 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/1/11 10:48 15 | */ 16 | public interface MemberRoleMapper { 17 | int deleteByPrimaryKey(Long id); 18 | int deleteByMemberId(Long memberId); 19 | MemberRoleModel selectByPrimaryKey(Long id); 20 | List selectByMemberId(String shortName); 21 | int insert(MemberRoleModel record); 22 | int updateByPrimaryKeySelective(MemberRoleModel record); 23 | List selectAll(); 24 | int deleteByChannelId(@Param("channelId")String channelId); 25 | 26 | /** 27 | * 根据roleId进行删除角色成员关系 28 | * @param roleId 29 | */ 30 | void delCustomRoleRelation(String roleId); 31 | } 32 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/MessageModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.MessageModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface MessageModelMapper { 9 | int insert(@Param("record")MessageModel messageModel); 10 | 11 | List selectByViewNo (@Param("channelId") String channelId, @Param("viewNo") Long viewNo); 12 | 13 | void deleteByViewNo (@Param("channelId") String channelId, @Param("viewNo") Long viewNo); 14 | } 15 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/PersistTaskModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.PersistTaskModel; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @version V1.0 9 | * @Title: PersistTaskModelMapper 10 | * @Package com.jinninghui.newspiral.ledger.mgr.impl.mapper 11 | * @Description: 12 | * @author: xuxm 13 | * @date: 2019/10/17 15:48 14 | */ 15 | public interface PersistTaskModelMapper { 16 | 17 | int insert(PersistTaskModel record); 18 | 19 | int updateByPrimaryKey(PersistTaskModel record); 20 | 21 | List selectAllByStatus(); 22 | } 23 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/StateAttachModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.StateAttachModel; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface StateAttachModelMapper { 9 | int batchInsert(@Param("list") List list); 10 | int batchUpdateByPrimaryKey(@Param("list") List list); 11 | int batchDeleteByPrimaryKey(@Param("list") List list); 12 | } 13 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/StateHistoryModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; 4 | import com.jinninghui.newspiral.common.entity.state.StateHistoryBO; 5 | import com.jinninghui.newspiral.common.entity.state.StateHistoryModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface StateHistoryModelMapper { 11 | 12 | @DS("sharding") 13 | Long selectTotalCount(@Param("stateHistoryBO") StateHistoryBO stateHistoryBO); 14 | 15 | @DS("sharding") 16 | List selectPageTransactionList(@Param("stateHistoryBO") StateHistoryBO stateHistoryBO); 17 | 18 | @DS("sharding") 19 | void deleteLatestBlockData(@Param("channelId") String channelId); 20 | 21 | @DS("sharding") 22 | Long selectLatestBlockId(@Param("channelId") String channelId); 23 | 24 | @DS("sharding") 25 | void batchInsert(@Param("list") List batchInsertList); 26 | 27 | @DS("sharding") 28 | Long selectLatestInsertVersion(); 29 | } 30 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/SystemVersionMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.SystemVersionModel; 4 | 5 | import java.util.List; 6 | 7 | public interface SystemVersionMapper { 8 | 9 | List selectAll(); 10 | 11 | SystemVersionModel selectMaxId(); 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/java/com/jinninghui/newspiral/ledger/mgr/impl/mapper/TimeConsumingModelMapper.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.ledger.mgr.impl.mapper; 2 | 3 | import com.jinninghui.newspiral.common.entity.task.TimeConsuming; 4 | import com.jinninghui.newspiral.ledger.mgr.impl.domain.TimeConsumingModel; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TimeConsumingModelMapper { 10 | int insert(@Param("record") TimeConsumingModel messageModel); 11 | 12 | List selectALL(); 13 | 14 | int beachInsert(@Param("list") List list); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #spring: 2 | # datasource: 3 | # url: "jdbc:mysql://127.0.0.1:3306/newspiral8?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai" 4 | # username: "root" 5 | # password: "xuxm" 6 | # driver-class-name: com.mysql.cj.jdbc.Driver 7 | # application: 8 | # name: "ledger-mgr-application" 9 | #mybatis: 10 | # mapper-locations: classpath*:com/jinninghui/newspiral/ledger/mgr/impl/mysql/*.xml -------------------------------------------------------------------------------- /ledger-mgr/src/main/resources/com/jinninghui/newspiral/ledger/mgr/impl/mysql/SystemVersionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ID, VERSION, REMARK, CREATE_TIME 12 | 13 | 16 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ledger-mgr/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jininghui.newspiral.ledger.mgr 2 | -------------------------------------------------------------------------------- /member-mgr/src/main/java/com/jinninghui/newspiral/member/mgr/impl/AsynMemberTask.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.member.mgr.impl; 2 | 3 | import com.alipay.sofa.runtime.api.annotation.SofaReference; 4 | import com.jinninghui.newspiral.p2p.P2pClient; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: AsynMemberTask 11 | * @Package com.jinninghui.newspiral.member.mgr.impl 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2020/7/28 15:25 15 | */ 16 | @Slf4j 17 | @Component 18 | public class AsynMemberTask { 19 | 20 | @SofaReference 21 | private P2pClient p2pClient; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /member-mgr/src/main/resources/META-INF/spring/member-mgr-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /member-mgr/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jinninghui.newspiral.member 2 | Require-Module=com.jininghui.newspiral.ledger.mgr -------------------------------------------------------------------------------- /p2p-communicator/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jinninghui.newspiral.p2p 2 | Require-Module=com.jininghui.newspiral.ledger.mgr -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/PeerCertificateCipherReq.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security; 2 | 3 | import lombok.Data; 4 | import lombok.extern.slf4j.Slf4j; 5 | 6 | import java.security.cert.X509Certificate; 7 | 8 | /** 9 | * @version V1.0 10 | * @Title: PeerCertificateCipher 11 | * @Package com.jinninghui.newspiral.common.entity.chain 12 | * @Description: 13 | * @author: xuxm 14 | * @date: 2019/12/20 16:06 15 | */ 16 | @Data 17 | @Slf4j 18 | public class PeerCertificateCipherReq { 19 | /** 20 | * peer value 21 | */ 22 | private String peerId; 23 | 24 | /** 25 | * ca证书 26 | */ 27 | private byte[] CertificateCerFile = null; 28 | 29 | /** 30 | * 密钥库 31 | */ 32 | private byte[] CertificateKeyStoreFile = null; 33 | 34 | private java.security.PrivateKey privateKey; 35 | 36 | private X509Certificate x509Certificate; 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/SecurityServiceMgr.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security; 2 | 3 | /** 4 | * @author lida 5 | * @date 2019/7/13 17:44 6 | * 安全服务管理者,当一个安全服务实现模块实现了多组安全服务接口时(例如一个模块同时实现了国密和国际密码算法) 7 | * 则每组实现均有一个唯一的key来确定对应的安全服务具体接口实现组,安全服务管理者用于管理这种关系 8 | * key值的合法范围与具体实现模块相关,每个链可以配置使用的安全服务接口组 9 | */ 10 | public interface SecurityServiceMgr { 11 | /** 12 | * 需保证返回的所有Security 13 | * @param key 14 | * @return 15 | */ 16 | SecurityService getMatchSecurityService(String key); 17 | 18 | /** 19 | * 完成该Mgr管理的所有Security服务的初始化,框架会在初始化Bean的时候调用此方法 20 | * 外部如果使用其他方式,则应保证 21 | */ 22 | void init(); 23 | } 24 | -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/StartSecurityMgr.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security; 2 | 3 | /** 4 | * @version V1.0 5 | * @Title: StartSecurityMgr 6 | * @Package com.jinninghui.newspiral.security 7 | * @Description:peer项目是否有权限启动方法 8 | * @author: xuxm 9 | * @date: 2019/11/8 14:21 10 | */ 11 | public interface StartSecurityMgr { 12 | 13 | void init(); 14 | /** 15 | * 是否可以正常启动(配置文件做法,已经暂停使用) 16 | * @return 17 | */ 18 | boolean getStarSecurityFlag(); 19 | 20 | /** 21 | * 证书做法 22 | * @return 23 | */ 24 | boolean initVerifyCertificateValidity(String channelId); 25 | 26 | /** 27 | * 国密证书初始化 28 | * @return 29 | */ 30 | boolean initVerifyGMCertificateValidity(String channelId); 31 | 32 | /** 33 | * 检查所有证书的有效性 34 | */ 35 | void checkAllCertificateValidity(); 36 | } 37 | -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/contract/BussinessContractCallerMonitor.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | import com.jinninghui.newspiral.ledger.mgr.contract.BussinessContractConnector; 4 | 5 | public interface BussinessContractCallerMonitor extends BussinessContractConnector, Thread.UncaughtExceptionHandler { 6 | } 7 | -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/contract/SandBoxCacheMgr.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | public interface SandBoxCacheMgr { 4 | void removeBusinessContractCache(String contractId,String contractName); 5 | } 6 | -------------------------------------------------------------------------------- /security-service-interface/src/main/java/com/jinninghui/newspiral/security/serialize/ObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.serialize; 2 | 3 | public interface ObjectSerializer { 4 | 5 | byte[] serialize(Object data, Class clazz); 6 | Object deserialize(byte[] data, Class clazz); 7 | } 8 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/contract/BlackListItem.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | public class BlackListItem { 4 | String pattern; 5 | 6 | public BlackListItem(String pattern) { 7 | this.pattern= pattern; 8 | } 9 | 10 | boolean matches(String name) { 11 | return name.startsWith(pattern) && name.indexOf('.', pattern.length())<0; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/contract/ContractByteSource.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | 4 | public interface ContractByteSource { 5 | byte[] getMainByteCode(String name) ; 6 | 7 | byte[] getInnerByteCode(byte[] bytes); 8 | } 9 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/contract/SandboxException.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | public class SandboxException extends RuntimeException{ 4 | 5 | public SandboxException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public SandboxException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/contract/WhiteListItem.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.contract; 2 | 3 | public class WhiteListItem { 4 | String pattern; 5 | boolean loadHere; 6 | 7 | public WhiteListItem(String pattern, boolean loadHere) { 8 | this.pattern= pattern; 9 | this.loadHere= loadHere; 10 | } 11 | 12 | boolean matches(String name) { 13 | if (name.contains("/")) { 14 | name = name.replace("/", "."); 15 | } 16 | return name.startsWith(pattern) && name.indexOf('.', pattern.length())<0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/utils/GMBaseUtil.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.utils; 2 | 3 | public class GMBaseUtil { 4 | static { 5 | //Security.addProvider(new BouncyCastleProvider()); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /security-service/src/main/java/com/jinninghui/newspiral/security/utils/PropertyConstants.java: -------------------------------------------------------------------------------- 1 | package com.jinninghui.newspiral.security.utils; 2 | 3 | import java.io.IOException; 4 | import java.util.Properties; 5 | 6 | /** 7 | * @version V1.0 8 | * @Title: PropertyConstants 9 | * @Package com.jinninghui.newspiral.security.utils 10 | * @Description: 11 | * @author: xuxm 12 | * @date: 2020/5/26 19:22 13 | */ 14 | public class PropertyConstants { 15 | private static Properties properties; 16 | 17 | private static void setProperty(){ 18 | if (properties==null) { 19 | properties = new Properties(); 20 | ClassLoader loader = Thread.currentThread().getContextClassLoader();/**/ 21 | try { 22 | properties.load(loader.getResourceAsStream("security.properties")); 23 | } catch (IOException e) { 24 | e.printStackTrace(); 25 | } 26 | } 27 | } 28 | 29 | public static String getPropertiesKey(String key){ 30 | if (properties==null) { 31 | setProperty(); 32 | } 33 | return properties.getProperty(key, "default"); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /security-service/src/main/resources/security.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newspiral/newspiral-business/cd3c2d38448f136c0d8e305281f576903579c0a7/security-service/src/main/resources/security.properties -------------------------------------------------------------------------------- /security-service/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jinninghui.newspiral.security 2 | Require-Module=com.jininghui.newspiral.ledger.mgr -------------------------------------------------------------------------------- /sql-script/PersistTask20191018.sql: -------------------------------------------------------------------------------- 1 | 2 | 3 | SET NAMES utf8mb4; 4 | SET FOREIGN_KEY_CHECKS = 0; 5 | 6 | -- ---------------------------- 7 | -- Table structure for persist_task 8 | -- ---------------------------- 9 | DROP TABLE IF EXISTS `persist_task`; 10 | CREATE TABLE `persist_task` ( 11 | `TASK_ID` char(128) COLLATE utf8_bin NOT NULL COMMENT '使用UUID去除分隔符生成,固定32个字符;使用UUID保证全局唯一', 12 | `CREATE_TIME` bigint(20) DEFAULT NULL, 13 | `EXECUTE_END_TIME` bigint(20) DEFAULT NULL, 14 | `PARAMAS_STR` text COLLATE utf8_bin DEFAULT NULL, 15 | `TYPE` varchar(128) COLLATE utf8_bin DEFAULT NULL, 16 | `STATUS` varchar(128) COLLATE utf8_bin DEFAULT NULL, 17 | PRIMARY KEY (`TASK_ID`) USING BTREE 18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC; 19 | 20 | SET FOREIGN_KEY_CHECKS = 1; 21 | 22 | --注意设置max_allowed_packet为1024M 23 | --SHOW VARIABLES LIKE '%max_allowed_packet%'; 24 | --max_allowed_packet = 1024M; 25 | -------------------------------------------------------------------------------- /sql-script/feature_2.1.0.sql: -------------------------------------------------------------------------------- 1 | -- 修改state、state_attach表的state_key为text类型,并建立索引 2 | ALTER TABLE `state` 3 | MODIFY COLUMN `STATE_KEY` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `CHANNEL_ID`, 4 | DROP INDEX `KEY_UNIQUE`; 5 | alter table state add index STATE_KEY_INDEX(CHANNEL_ID, STATE_KEY(64)); 6 | 7 | ALTER TABLE `state_attach` 8 | MODIFY COLUMN `STATE_KEY` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `CHANNEL_ID`; 9 | -------------------------------------------------------------------------------- /sql-script/feature_2.2.0_hotfix.sql: -------------------------------------------------------------------------------- 1 | 2 | use newspiral_cluster; 3 | DROP INDEX STATE_KEY_INDEX ON state; 4 | alter table state add index STATE_KEY_INDEX(CHANNEL_ID, STATE_KEY(200)); 5 | 6 | DROP INDEX STATE_KEY_INDEX ON state_attach; 7 | alter table state_attach add index STATE_KEY_INDEX(CHANNEL_ID, STATE_KEY(200)); 8 | -------------------------------------------------------------------------------- /sql-script/feature_2.3.0.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `interface` (`ID`, `INTERFACE_NAME`, `CLASS_PATH`, `CLASS_NAME`, `METHOD_NAME`, `METHOD_ARGS`, `REMARK`, 2 | `CREATE_TIME`, `UPDATE_TIME`) 3 | values (101, '生成根证书', 'com.jinninghui.newspiral.gateway', 'ServiceForSDKImpl','createRootCert', 4 | 'CertDataReq', NULL, '2021-02-03 00:48:11', '2021-02-03 00:48:11'), 5 | (102, '生成用户证书', 'com.jinninghui.newspiral.gateway', 'ServiceForSDKImpl', 'createUserCert', 6 | 'CertDataReq', NULL, '2021-02-03 00:48:11', '2021-02-03 00:48:11'); 7 | 8 | update auth set INTERFACE_ID=concat(INTERFACE_ID,',101,102') where AUTH_NAME='节点监控'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /sql-script/index20191016.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `peer` ADD INDEX peer_is_local_peer ( `IS_LOCAL_PEER` ); 2 | -------------------------------------------------------------------------------- /sql-script/sandbox_updated.sql: -------------------------------------------------------------------------------- 1 | alter table smart_contract add column SC_INNER_CLASS_FILES longtext after SC_CLASS_FILE; 2 | -------------------------------------------------------------------------------- /transaction-mgr/src/main/resources/META-INF/spring/transaction-mgr-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /transaction-mgr/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.jinninghui.newspiral.transaction 2 | Require-Module=com.jininghui.newspiral.ledger.mgr --------------------------------------------------------------------------------