| @@ -10,7 +10,7 @@ import com.jd.blockchain.consensus.bftsmart.service.BftsmartServerSettingConfig; | |||
| import com.jd.blockchain.consensus.service.ServerSettings; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.utils.PropertiesUtils; | |||
| import com.jd.blockchain.utils.io.BytesUtils; | |||
| import com.jd.blockchain.utils.net.NetworkAddress; | |||
| @@ -62,7 +62,7 @@ public class proxyClientTest { | |||
| BftsmartNodeSettings[] nodesSettings = new BftsmartNodeSettings[nodeNum]; | |||
| for (int i = 0; i < nodeNum; i++) { | |||
| BlockchainKeyPair keyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair keyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| PubKey pubKey = keyPair.getPubKey(); | |||
| NetworkAddress peerNodeServ = new NetworkAddress("127.0.0.1", peerStartPort + i * 10); | |||
| NodeSettings node = new BftsmartNodeConfig(pubKey, i, peerNodeServ); | |||
| @@ -87,7 +87,7 @@ public class proxyClientTest { | |||
| public void proxyClientSend(BftsmartNodeServer nodeServer) { | |||
| BftsmartClientIncomingConfig clientIncomingConfig = new BftsmartClientIncomingConfig(); | |||
| BlockchainKeyPair keyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair keyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| clientIncomingConfig.setPubKey(keyPair.getPubKey()); | |||
| clientIncomingConfig.setClientId(0); | |||
| clientIncomingConfig.setConsensusSettings(nodeServer.getConsensusSetting()); | |||
| @@ -4,7 +4,7 @@ import com.jd.blockchain.contract.model.ContractDeployExeUtil; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.tools.keygen.KeyGenCommand; | |||
| import com.jd.blockchain.utils.codec.Base58Utils; | |||
| import com.jd.blockchain.utils.io.FileUtils; | |||
| @@ -104,7 +104,7 @@ public class ContractDeployMojo extends AbstractMojo { | |||
| PrivKey prv = KeyGenCommand.decodePrivKeyWithRawPassword(prvKey, password); | |||
| PubKey pub = KeyGenCommand.decodePubKey(pubKey); | |||
| BlockchainKeyPair blockchainKeyPair = new BlockchainKeyPair(pub, prv); | |||
| BlockchainKeypair blockchainKeyPair = new BlockchainKeypair(pub, prv); | |||
| HashDigest ledgerHash = new HashDigest(Base58Utils.decode(ledger)); | |||
| StringBuffer sb = new StringBuffer(); | |||
| @@ -12,7 +12,7 @@ import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.ledger.BlockchainIdentity; | |||
| import com.jd.blockchain.ledger.BlockchainIdentityData; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.ContractCodeDeployOperation; | |||
| import com.jd.blockchain.ledger.ContractEventSendOperation; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| @@ -43,7 +43,7 @@ public enum ContractDeployExeUtil { | |||
| private BlockchainService bcsrv; | |||
| private Bytes contractAddress; | |||
| public BlockchainKeyPair getKeyPair(String pubPath, String prvPath, String rawPassword){ | |||
| public BlockchainKeypair getKeyPair(String pubPath, String prvPath, String rawPassword){ | |||
| PubKey pub = null; | |||
| PrivKey prv = null; | |||
| try { | |||
| @@ -54,14 +54,14 @@ public enum ContractDeployExeUtil { | |||
| e.printStackTrace(); | |||
| } | |||
| return new BlockchainKeyPair(pub, prv); | |||
| return new BlockchainKeypair(pub, prv); | |||
| } | |||
| public PubKey getPubKey(String pubPath){ | |||
| PubKey pub = null; | |||
| try { | |||
| if(pubPath == null){ | |||
| BlockchainKeyPair contractKeyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractKeyPair = BlockchainKeyGenerator.getInstance().generate(); | |||
| pub = contractKeyPair.getPubKey(); | |||
| }else { | |||
| pub = KeyGenCommand.readPubKey(pubPath); | |||
| @@ -123,7 +123,7 @@ public enum ContractDeployExeUtil { | |||
| return bcsrv; | |||
| } | |||
| public boolean deploy(HashDigest ledgerHash, BlockchainIdentity contractIdentity, BlockchainKeyPair ownerKey, byte[] chainCode){ | |||
| public boolean deploy(HashDigest ledgerHash, BlockchainIdentity contractIdentity, BlockchainKeypair ownerKey, byte[] chainCode){ | |||
| register(); | |||
| TransactionTemplate txTpl = bcsrv.newTransaction(ledgerHash); | |||
| @@ -139,7 +139,7 @@ public enum ContractDeployExeUtil { | |||
| System.out.println("contract's address="+contractAddress); | |||
| return txResp.isSuccess(); | |||
| } | |||
| public boolean deploy(String host, int port, HashDigest ledgerHash, BlockchainKeyPair ownerKey, byte[] chainCode){ | |||
| public boolean deploy(String host, int port, HashDigest ledgerHash, BlockchainKeypair ownerKey, byte[] chainCode){ | |||
| register(); | |||
| BlockchainIdentity contractIdentity = BlockchainKeyGenerator.getInstance().generate().getIdentity(); | |||
| @@ -154,7 +154,7 @@ public enum ContractDeployExeUtil { | |||
| BlockchainIdentity contractIdentity = new BlockchainIdentityData(pubKey); | |||
| byte[] chainCode = getChainCode(chainCodePath); | |||
| BlockchainKeyPair ownerKey = getKeyPair(ownerPubPath, ownerPrvPath, ownerPassword); | |||
| BlockchainKeypair ownerKey = getKeyPair(ownerPubPath, ownerPrvPath, ownerPassword); | |||
| HashDigest ledgerHash = new HashDigest(Base58Utils.decode(ledger)); | |||
| initBcsrv(host,port); | |||
| return deploy(ledgerHash, contractIdentity, ownerKey, chainCode); | |||
| @@ -162,7 +162,7 @@ public enum ContractDeployExeUtil { | |||
| public boolean exeContract(String ledger,String ownerPubPath, String ownerPrvPath, | |||
| String ownerPassword,String event,String contractArgs){ | |||
| BlockchainKeyPair ownerKey = getKeyPair(ownerPubPath, ownerPrvPath, ownerPassword); | |||
| BlockchainKeypair ownerKey = getKeyPair(ownerPubPath, ownerPrvPath, ownerPassword); | |||
| HashDigest ledgerHash = new HashDigest(Base58Utils.decode(ledger)); | |||
| // 定义交易,传输最简单的数字、字符串、提取合约中的地址; | |||
| @@ -10,7 +10,7 @@ import com.jd.blockchain.crypto.CryptoAlgorithm; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.core.AccountSet; | |||
| import com.jd.blockchain.ledger.core.BaseAccount; | |||
| import com.jd.blockchain.ledger.core.CryptoConfig; | |||
| @@ -32,7 +32,7 @@ public class AccountSetTest { | |||
| String keyPrefix = ""; | |||
| AccountSet accset = new AccountSet(cryptoConf,keyPrefix, storage, storage, accessPolicy); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| accset.register(userKey.getAddress(), userKey.getPubKey()); | |||
| BaseAccount userAcc = accset.getAccount(userKey.getAddress()); | |||
| @@ -9,7 +9,7 @@ import org.springframework.util.StringUtils; | |||
| import com.jd.blockchain.crypto.CryptoAlgorithm; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.core.BaseAccount; | |||
| import com.jd.blockchain.ledger.core.CryptoConfig; | |||
| import com.jd.blockchain.ledger.core.impl.OpeningAccessPolicy; | |||
| @@ -35,7 +35,7 @@ public class BaseAccountTest { | |||
| OpeningAccessPolicy accPlc = new OpeningAccessPolicy(); | |||
| BlockchainKeyPair bck = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair bck = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 新建账户; | |||
| BaseAccount baseAccount = new BaseAccount(bck.getIdentity(), cryptoConf, keyPrefix, testStorage, testStorage, | |||
| @@ -16,7 +16,7 @@ import com.jd.blockchain.crypto.CryptoAlgorithm; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.ParticipantNode; | |||
| import com.jd.blockchain.ledger.core.CryptoConfig; | |||
| import com.jd.blockchain.ledger.core.LedgerAdminAccount; | |||
| @@ -38,7 +38,7 @@ public class LedgerAdminAccountTest { | |||
| String keyPrefix = ""; | |||
| LedgerInitSettingData initSetting = new LedgerInitSettingData(); | |||
| ConsensusParticipantData[] parties = new ConsensusParticipantData[5]; | |||
| BlockchainKeyPair[] bckeys = new BlockchainKeyPair[parties.length]; | |||
| BlockchainKeypair[] bckeys = new BlockchainKeypair[parties.length]; | |||
| for (int i = 0; i < parties.length; i++) { | |||
| bckeys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| parties[i] = new ConsensusParticipantData(); | |||
| @@ -184,7 +184,7 @@ public class LedgerAdminAccountTest { | |||
| new NetworkAddress("192.168.10." + (10 + newParti.getAddress()), 10010 + 10 * newParti.getId())); | |||
| newParti.setName("Participant[" + newParti.getAddress() + "]"); | |||
| BlockchainKeyPair newKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair newKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| newParti.setPubKey(newKey.getPubKey()); | |||
| Throwable ex = null; | |||
| @@ -13,7 +13,7 @@ import com.jd.blockchain.crypto.AsymmetricKeypair; | |||
| import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.LedgerInitSetting; | |||
| import com.jd.blockchain.ledger.LedgerTransaction; | |||
| @@ -62,7 +62,7 @@ public class LedgerEditerTest { | |||
| @Test | |||
| public void testWriteDataAccoutKvOp() { | |||
| BlockchainKeyPair dataKP = new BlockchainKeyPair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| BlockchainKeypair dataKP = new BlockchainKeypair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| DataAccount dataAccount = ldgDS.getDataAccountSet().register(dataKP.getAddress(), dataKP.getPubKey(), null); | |||
| @@ -83,7 +83,7 @@ public class LedgerEditerTest { | |||
| @Test | |||
| public void testLedgerEditorCreation() { | |||
| BlockchainKeyPair userKP = new BlockchainKeyPair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| BlockchainKeypair userKP = new BlockchainKeypair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| UserAccount userAccount = ldgDS.getUserAccountSet().register(userKP.getAddress(), userKP.getPubKey()); | |||
| userAccount.setProperty("Name", "孙悟空", -1); | |||
| userAccount.setProperty("Age", "10000", -1); | |||
| @@ -6,7 +6,7 @@ import com.jd.blockchain.crypto.AddressEncoding; | |||
| import com.jd.blockchain.crypto.CryptoAlgorithm; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerInitOperation; | |||
| import com.jd.blockchain.ledger.LedgerInitSetting; | |||
| import com.jd.blockchain.ledger.core.CryptoConfig; | |||
| @@ -60,7 +60,7 @@ public class LedgerInitOperationTest { | |||
| @Test | |||
| public void test_LedgerInitOperation_ConsensusParticipantData() { | |||
| ConsensusParticipantData[] parties = new ConsensusParticipantData[4]; | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[parties.length]; | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[parties.length]; | |||
| for (int i = 0; i < parties.length; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| parties[i] = new ConsensusParticipantData(); | |||
| @@ -96,7 +96,7 @@ public class LedgerInitOperationTest { | |||
| @Test | |||
| public void test_LedgerInitOperation_ParticipantCertData() { | |||
| ParticipantCertData[] parties = new ParticipantCertData[4]; | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[parties.length]; | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[parties.length]; | |||
| for (int i = 0; i < parties.length; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| @@ -6,7 +6,7 @@ import com.jd.blockchain.crypto.AddressEncoding; | |||
| import com.jd.blockchain.crypto.CryptoAlgorithm; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerInitOperation; | |||
| import com.jd.blockchain.ledger.LedgerInitSetting; | |||
| import com.jd.blockchain.ledger.core.CryptoConfig; | |||
| @@ -61,7 +61,7 @@ public class LedgerInitSettingTest { | |||
| public void test_ledgerinitsetting_ConsensusParticipantData() { | |||
| ConsensusParticipantData[] parties = new ConsensusParticipantData[4]; | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[parties.length]; | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[parties.length]; | |||
| for (int i = 0; i < parties.length; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| parties[i] = new ConsensusParticipantData(); | |||
| @@ -103,7 +103,7 @@ public class LedgerInitSettingTest { | |||
| public void test_ledgerinitsetting_ParticipantCertData() { | |||
| ParticipantCertData[] parties = new ParticipantCertData[4]; | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[parties.length]; | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[parties.length]; | |||
| for (int i = 0; i < parties.length; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| @@ -18,7 +18,7 @@ import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockBody; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountRegisterOperation; | |||
| import com.jd.blockchain.ledger.DigitalSignature; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| @@ -81,7 +81,7 @@ public class LedgerManagerTest { | |||
| // 记录交易,注册用户; | |||
| LedgerTransactionContext txCtx = ldgEdt.newTransaction(genesisTxReq); | |||
| LedgerDataSet ldgDS = txCtx.getDataSet(); | |||
| BlockchainKeyPair userKP = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKP = BlockchainKeyGenerator.getInstance().generate(); | |||
| ; | |||
| UserAccount userAccount = ldgDS.getUserAccountSet().register(userKP.getAddress(), userKP.getPubKey()); | |||
| userAccount.setProperty("Name", "孙悟空", -1); | |||
| @@ -122,7 +122,7 @@ public class LedgerManagerTest { | |||
| LedgerEditor editor1 = reloadLedgerRepo.createNextBlock(); | |||
| TxBuilder txBuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txBuilder.dataAccounts().register(dataKey.getIdentity()); | |||
| TransactionRequestBuilder txReqBuilder = txBuilder.prepareRequest(); | |||
| DigitalSignature dgtsign = txReqBuilder.signAsEndpoint(userKP); | |||
| @@ -23,7 +23,7 @@ import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.crypto.SignatureDigest; | |||
| import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.DigitalSignature; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| @@ -252,7 +252,7 @@ public class LedgerTransactionDataTest { | |||
| private TransactionContent initTransactionContent() throws Exception { | |||
| TxContentBlob contentBlob = null; | |||
| BlockchainKeyPair id = BlockchainKeyGenerator.getInstance().generate(ClassicCryptoService.ED25519_ALGORITHM); | |||
| BlockchainKeypair id = BlockchainKeyGenerator.getInstance().generate(ClassicCryptoService.ED25519_ALGORITHM); | |||
| HashDigest ledgerHash = CryptoServiceProviders.getHashFunction("SHA256") | |||
| .hash(UUID.randomUUID().toString().getBytes("UTF-8")); | |||
| BlockchainOperationFactory opFactory = new BlockchainOperationFactory(); | |||
| @@ -15,7 +15,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import org.junit.Test; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.ContractCodeDeployOperation; | |||
| import com.jd.blockchain.ledger.ContractEventSendOperation; | |||
| import com.jd.blockchain.ledger.CryptoSetting; | |||
| @@ -64,10 +64,10 @@ public class TransactionSetTest { | |||
| HashDigest ledgerHash = LedgerTestUtils.generateRandomHash(); | |||
| TransactionBuilder txBuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| UserRegisterOperation userRegOp = txBuilder.users().register(userKey.getIdentity()); | |||
| BlockchainKeyPair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| DataAccountRegisterOperation dataAccRegOp = txBuilder.dataAccounts().register(dataKey.getIdentity()); | |||
| DataAccountKVSetOperation kvsetOP = txBuilder.dataAccount(dataKey.getAddress()) | |||
| @@ -75,7 +75,7 @@ public class TransactionSetTest { | |||
| byte[] chainCode = new byte[128]; | |||
| rand.nextBytes(chainCode); | |||
| BlockchainKeyPair contractKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| ContractCodeDeployOperation contractDplOP = txBuilder.contracts().deploy(contractKey.getIdentity(), chainCode); | |||
| ContractEventSendOperation contractEvtSendOP = txBuilder.contractEvents().send(contractKey.getAddress(), "test", | |||
| @@ -83,9 +83,9 @@ public class TransactionSetTest { | |||
| TransactionRequestBuilder txReqBuilder = txBuilder.prepareRequest(); | |||
| BlockchainKeyPair sponsorKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair sponsorKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txReqBuilder.signAsEndpoint(sponsorKey); | |||
| BlockchainKeyPair gatewayKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair gatewayKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txReqBuilder.signAsNode(gatewayKey); | |||
| TransactionRequest txReq = txReqBuilder.buildRequest(); | |||
| @@ -22,19 +22,19 @@ public class BlockchainKeyGenerator { | |||
| return new BlockchainKeyGenerator(); | |||
| } | |||
| public BlockchainKeyPair generate() { | |||
| public BlockchainKeypair generate() { | |||
| return generate(DEFAULT_ALGORITHM); | |||
| } | |||
| public BlockchainKeyPair generate(String algorithmName) { | |||
| public BlockchainKeypair generate(String algorithmName) { | |||
| CryptoAlgorithm algorithm = CryptoServiceProviders.getAlgorithm(algorithmName); | |||
| return generate(algorithm); | |||
| } | |||
| public BlockchainKeyPair generate(CryptoAlgorithm signatureAlgorithm) { | |||
| public BlockchainKeypair generate(CryptoAlgorithm signatureAlgorithm) { | |||
| SignatureFunction signFunc = CryptoServiceProviders.getSignatureFunction(signatureAlgorithm); | |||
| AsymmetricKeypair cryptoKeyPair = signFunc.generateKeypair(); | |||
| return new BlockchainKeyPair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| return new BlockchainKeypair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| } | |||
| } | |||
| @@ -11,7 +11,7 @@ import com.jd.blockchain.utils.Bytes; | |||
| * @author huanghaiquan | |||
| * | |||
| */ | |||
| public class BlockchainKeyPair extends AsymmetricKeypair { | |||
| public class BlockchainKeypair extends AsymmetricKeypair { | |||
| private BlockchainIdentity id; | |||
| @@ -20,7 +20,7 @@ public class BlockchainKeyPair extends AsymmetricKeypair { | |||
| // privKey = new PrivKey(algorithm, privKeyBytes.bytes()); | |||
| // } | |||
| public BlockchainKeyPair(String address, PubKey pubKey, PrivKey privKey) { | |||
| public BlockchainKeypair(String address, PubKey pubKey, PrivKey privKey) { | |||
| super(pubKey, privKey); | |||
| if (pubKey.getAlgorithm() != privKey.getAlgorithm()) { | |||
| throw new IllegalArgumentException("The PublicKey's algorithm is different from the PrivateKey's!"); | |||
| @@ -28,7 +28,7 @@ public class BlockchainKeyPair extends AsymmetricKeypair { | |||
| this.id = new BlockchainIdentityData(Bytes.fromBase58(address), pubKey); | |||
| } | |||
| public BlockchainKeyPair(PubKey pubKey, PrivKey privKey) { | |||
| public BlockchainKeypair(PubKey pubKey, PrivKey privKey) { | |||
| super(pubKey, privKey); | |||
| if (pubKey.getAlgorithm() != privKey.getAlgorithm()) { | |||
| throw new IllegalArgumentException("The PublicKey's algorithm is different from the PrivateKey's!"); | |||
| @@ -5,12 +5,12 @@ import java.util.Random; | |||
| import com.jd.blockchain.crypto.AddressEncoding; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| public class AddressEncodingTest { | |||
| public static void main(String[] args) { | |||
| BlockchainKeyPair bkp = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair bkp = BlockchainKeyGenerator.getInstance().generate(); | |||
| PubKey pk = bkp.getPubKey(); | |||
| byte[] data =new byte[64]; | |||
| Random rand = new Random(); | |||
| @@ -14,7 +14,7 @@ import com.jd.blockchain.binaryproto.DataContractRegistry; | |||
| import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.HashObject; | |||
| import com.jd.blockchain.ledger.Operation; | |||
| @@ -34,7 +34,7 @@ public class TxContentBlobTest { | |||
| DataContractRegistry.register(TransactionContent.class); | |||
| DataContractRegistry.register(HashObject.class); | |||
| BlockchainKeyPair id = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| BlockchainKeypair id = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| HashDigest ledgerHash = CryptoServiceProviders.getHashFunction("SHA256") | |||
| .hash(UUID.randomUUID().toString().getBytes("UTF-8")); | |||
| @@ -24,7 +24,7 @@ import com.jd.blockchain.crypto.HashFunction; | |||
| import com.jd.blockchain.crypto.SignatureDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.DigitalSignature; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| @@ -195,7 +195,7 @@ public class TxRequestMessageTest { | |||
| private TransactionContent initTransactionContent() throws Exception { | |||
| TxContentBlob contentBlob = null; | |||
| BlockchainKeyPair id = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| BlockchainKeypair id = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| HashFunction hashFunc = CryptoServiceProviders.getHashFunction("SHA256"); | |||
| HashDigest ledgerHash = hashFunc.hash(UUID.randomUUID().toString().getBytes("UTF-8")); | |||
| BlockchainOperationFactory opFactory = new BlockchainOperationFactory(); | |||
| @@ -7,7 +7,7 @@ import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.SignatureDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DigitalSignature; | |||
| import com.jd.blockchain.ledger.TransactionContent; | |||
| import com.jd.blockchain.ledger.TransactionRequest; | |||
| @@ -29,11 +29,11 @@ public class GatewayServiceFactory implements BlockchainServiceFactory, Closeabl | |||
| private ServiceConnectionManager httpConnectionManager; | |||
| private BlockchainKeyPair userKey; | |||
| private BlockchainKeypair userKey; | |||
| private BlockchainService blockchainService; | |||
| protected GatewayServiceFactory(ServiceEndpoint gatewayEndpoint, BlockchainKeyPair userKey) { | |||
| protected GatewayServiceFactory(ServiceEndpoint gatewayEndpoint, BlockchainKeypair userKey) { | |||
| httpConnectionManager = new ServiceConnectionManager(); | |||
| this.userKey = userKey; | |||
| @@ -73,7 +73,7 @@ public class GatewayServiceFactory implements BlockchainServiceFactory, Closeabl | |||
| return connect(gatewayAddress.getHost(), gatewayAddress.getPort(), gatewayAddress.isSecure(), null); | |||
| } | |||
| public static GatewayServiceFactory connect(NetworkAddress gatewayAddress, BlockchainKeyPair userKey) { | |||
| public static GatewayServiceFactory connect(NetworkAddress gatewayAddress, BlockchainKeypair userKey) { | |||
| return connect(gatewayAddress.getHost(), gatewayAddress.getPort(), gatewayAddress.isSecure(), userKey); | |||
| } | |||
| @@ -82,7 +82,7 @@ public class GatewayServiceFactory implements BlockchainServiceFactory, Closeabl | |||
| } | |||
| public static GatewayServiceFactory connect(String gatewayHost, int gatewayPort, boolean secure, | |||
| BlockchainKeyPair userKey) { | |||
| BlockchainKeypair userKey) { | |||
| // if (userKey == null) { | |||
| // throw new IllegalArgumentException("User key is null!"); | |||
| // } | |||
| @@ -122,9 +122,9 @@ public class GatewayServiceFactory implements BlockchainServiceFactory, Closeabl | |||
| private TransactionService innerService; | |||
| private BlockchainKeyPair userKey; | |||
| private BlockchainKeypair userKey; | |||
| public EndpointAutoSigner(TransactionService innerService, BlockchainKeyPair userKey) { | |||
| public EndpointAutoSigner(TransactionService innerService, BlockchainKeypair userKey) { | |||
| this.innerService = innerService; | |||
| this.userKey = userKey; | |||
| } | |||
| @@ -5,7 +5,7 @@ import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionTemplate; | |||
| import com.jd.blockchain.sdk.BlockchainService; | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.utils.serialize.json.JSONSerializeUtils; | |||
| */ | |||
| public class SDKDemo_Contract { | |||
| public static BlockchainKeyPair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| public static BlockchainKeypair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| /** | |||
| * 演示合约执行的过程; | |||
| @@ -5,7 +5,7 @@ import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionTemplate; | |||
| import com.jd.blockchain.sdk.BlockchainTransactionService; | |||
| @@ -14,7 +14,7 @@ import com.jd.blockchain.utils.net.NetworkAddress; | |||
| public class SDKDemo_DataAccount { | |||
| public static BlockchainKeyPair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| public static BlockchainKeypair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| /** | |||
| @@ -51,7 +51,7 @@ public class SDKDemo_DataAccount { | |||
| // 在本地产生要注册的账户的秘钥; | |||
| BlockchainKeyGenerator generator = BlockchainKeyGenerator.getInstance(); | |||
| BlockchainKeyPair dataAccount = generator.generate("ED25519"); | |||
| BlockchainKeypair dataAccount = generator.generate("ED25519"); | |||
| txTemp.dataAccounts().register(dataAccount.getIdentity()); | |||
| @@ -5,7 +5,7 @@ import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionTemplate; | |||
| import com.jd.blockchain.sdk.BlockchainService; | |||
| @@ -21,7 +21,7 @@ import com.jd.blockchain.utils.net.NetworkAddress; | |||
| */ | |||
| public class SDKDemo_InsertData { | |||
| public static BlockchainKeyPair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| public static BlockchainKeypair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| /** | |||
| @@ -3,7 +3,7 @@ package com.jd.blockchain.sdk.samples; | |||
| import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.KVDataEntry; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.LedgerTransaction; | |||
| @@ -20,7 +20,7 @@ import com.jd.blockchain.utils.net.NetworkAddress; | |||
| */ | |||
| public class SDKDemo_Query { | |||
| public static BlockchainKeyPair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| public static BlockchainKeypair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate("ED25519"); | |||
| public static final HashDigest LEDGER_HASH = CryptoServiceProviders.getHashFunction("SHA256") | |||
| .hash("xkxjcioewfqwe".getBytes()); | |||
| @@ -26,7 +26,7 @@ public class SDKDemo_RegisterAccount { | |||
| DataContractRegistry.register(EndpointRequest.class); | |||
| DataContractRegistry.register(TransactionResponse.class); | |||
| BlockchainKeyPair CLIENT_CERT = new BlockchainKeyPair(SDKDemo_Params.pubKey0, SDKDemo_Params.privkey0); | |||
| BlockchainKeypair CLIENT_CERT = new BlockchainKeypair(SDKDemo_Params.pubKey0, SDKDemo_Params.privkey0); | |||
| boolean SECURE = false; | |||
| GatewayServiceFactory serviceFactory = GatewayServiceFactory.connect(GATEWAY_IPADDR, GATEWAY_PORT, SECURE, | |||
| CLIENT_CERT); | |||
| @@ -37,9 +37,9 @@ public class SDKDemo_RegisterAccount { | |||
| TransactionTemplate txTemp = service.newTransaction(ledgerHashs[0]); | |||
| //existed signer | |||
| AsymmetricKeypair keyPair = new BlockchainKeyPair(SDKDemo_Params.pubKey1, SDKDemo_Params.privkey1); | |||
| AsymmetricKeypair keyPair = new BlockchainKeypair(SDKDemo_Params.pubKey1, SDKDemo_Params.privkey1); | |||
| BlockchainKeyPair dataAcount = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAcount = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 注册 | |||
| txTemp.dataAccounts().register(dataAcount.getIdentity()); | |||
| @@ -46,7 +46,7 @@ public class SDKDemo_RegisterUser { | |||
| PrivKey privKey = SDKDemo_Params.privkey1; | |||
| PubKey pubKey = SDKDemo_Params.pubKey1; | |||
| BlockchainKeyPair CLIENT_CERT = new BlockchainKeyPair(SDKDemo_Params.pubKey0, SDKDemo_Params.privkey0); | |||
| BlockchainKeypair CLIENT_CERT = new BlockchainKeypair(SDKDemo_Params.pubKey0, SDKDemo_Params.privkey0); | |||
| boolean SECURE = false; | |||
| GatewayServiceFactory serviceFactory = GatewayServiceFactory.connect(GATEWAY_IPADDR, GATEWAY_PORT, SECURE, | |||
| @@ -58,9 +58,9 @@ public class SDKDemo_RegisterUser { | |||
| TransactionTemplate txTemp = service.newTransaction(ledgerHashs[0]); | |||
| //existed signer | |||
| AsymmetricKeypair keyPair = new BlockchainKeyPair(pubKey, privKey); | |||
| AsymmetricKeypair keyPair = new BlockchainKeypair(pubKey, privKey); | |||
| BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 注册 | |||
| txTemp.users().register(user.getIdentity()); | |||
| @@ -5,7 +5,7 @@ import com.jd.blockchain.crypto.CryptoServiceProviders; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionTemplate; | |||
| import com.jd.blockchain.sdk.BlockchainTransactionService; | |||
| @@ -14,7 +14,7 @@ import com.jd.blockchain.utils.net.NetworkAddress; | |||
| public class SDKDemo_User { | |||
| public static BlockchainKeyPair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate(); | |||
| public static BlockchainKeypair CLIENT_CERT = BlockchainKeyGenerator.getInstance().generate(); | |||
| /** | |||
| * 生成一个区块链用户,并注册到区块链; | |||
| @@ -65,7 +65,7 @@ public class SDKDemo_User { | |||
| SignatureFunction signatureFunction = CryptoServiceProviders.getSignatureFunction("ED25519"); | |||
| AsymmetricKeypair cryptoKeyPair = signatureFunction.generateKeypair(); | |||
| BlockchainKeyPair user = new BlockchainKeyPair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| BlockchainKeypair user = new BlockchainKeypair(cryptoKeyPair.getPubKey(), cryptoKeyPair.getPrivKey()); | |||
| txTemp.users().register(user.getIdentity()); | |||
| @@ -20,7 +20,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.HashFunction; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| import com.jd.blockchain.ledger.NodeRequest; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| @@ -46,7 +46,7 @@ public class SDK_GateWay_BatchInsertData_Test_ { | |||
| String ledgerHash = ""; | |||
| private BlockchainKeyPair CLIENT_CERT = null; | |||
| private BlockchainKeypair CLIENT_CERT = null; | |||
| private String GATEWAY_IPADDR = null; | |||
| @@ -18,7 +18,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.HashFunction; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| import com.jd.blockchain.ledger.NodeRequest; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| @@ -41,7 +41,7 @@ import com.jd.blockchain.sdk.client.GatewayServiceFactory; | |||
| public class SDK_GateWay_DataAccount_Test_ { | |||
| private BlockchainKeyPair CLIENT_CERT = null; | |||
| private BlockchainKeypair CLIENT_CERT = null; | |||
| private String GATEWAY_IPADDR = null; | |||
| @@ -53,7 +53,7 @@ public class SDK_GateWay_DataAccount_Test_ { | |||
| @Before | |||
| public void init() { | |||
| CLIENT_CERT = new BlockchainKeyPair(SDK_GateWay_KeyPair_Para.pubKey0, SDK_GateWay_KeyPair_Para.privkey0); | |||
| CLIENT_CERT = new BlockchainKeypair(SDK_GateWay_KeyPair_Para.pubKey0, SDK_GateWay_KeyPair_Para.privkey0); | |||
| GATEWAY_IPADDR = "127.0.0.1"; | |||
| GATEWAY_PORT = 8081; | |||
| SECURE = false; | |||
| @@ -81,9 +81,9 @@ public class SDK_GateWay_DataAccount_Test_ { | |||
| // CryptoKeyPair cryptoKeyPair = signatureFunction.generateKeyPair(); | |||
| //existed signer | |||
| AsymmetricKeypair keyPair = new BlockchainKeyPair(SDK_GateWay_KeyPair_Para.pubKey1, SDK_GateWay_KeyPair_Para.privkey1); | |||
| AsymmetricKeypair keyPair = new BlockchainKeypair(SDK_GateWay_KeyPair_Para.pubKey1, SDK_GateWay_KeyPair_Para.privkey1); | |||
| BlockchainKeyPair dataAcount = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAcount = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 注册 | |||
| txTemp.dataAccounts().register(dataAcount.getIdentity()); | |||
| @@ -20,7 +20,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.HashFunction; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| import com.jd.blockchain.ledger.NodeRequest; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| @@ -43,7 +43,7 @@ import com.jd.blockchain.sdk.client.GatewayServiceFactory; | |||
| public class SDK_GateWay_InsertData_Test_ { | |||
| private BlockchainKeyPair CLIENT_CERT = null; | |||
| private BlockchainKeypair CLIENT_CERT = null; | |||
| private String GATEWAY_IPADDR = null; | |||
| @@ -23,7 +23,7 @@ import com.jd.blockchain.crypto.serialize.ByteArrayObjectDeserializer; | |||
| import com.jd.blockchain.crypto.serialize.ByteArrayObjectSerializer; | |||
| import com.jd.blockchain.ledger.AccountHeader; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DigitalSignature; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| import com.jd.blockchain.ledger.KVDataEntry; | |||
| @@ -64,7 +64,7 @@ public class SDK_GateWay_Query_Test_ { | |||
| } | |||
| } | |||
| private BlockchainKeyPair CLIENT_CERT = null; | |||
| private BlockchainKeypair CLIENT_CERT = null; | |||
| private String GATEWAY_IPADDR = null; | |||
| @@ -184,10 +184,10 @@ public class SDK_GateWay_Query_Test_ { | |||
| return CryptoServiceProviders.getSignatureFunction("ED25519"); | |||
| } | |||
| private BlockchainKeyPair getSponsorKey() { | |||
| private BlockchainKeypair getSponsorKey() { | |||
| SignatureFunction signatureFunction = getSignatureFunction(); | |||
| AsymmetricKeypair cryptoKeyPair = signatureFunction.generateKeypair(); | |||
| BlockchainKeyPair blockchainKeyPair = new BlockchainKeyPair(cryptoKeyPair.getPubKey(), | |||
| BlockchainKeypair blockchainKeyPair = new BlockchainKeypair(cryptoKeyPair.getPubKey(), | |||
| cryptoKeyPair.getPrivKey()); | |||
| return blockchainKeyPair; | |||
| } | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.crypto.SignatureFunction; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.EndpointRequest; | |||
| import com.jd.blockchain.ledger.NodeRequest; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| @@ -54,7 +54,7 @@ public class SDK_GateWay_User_Test_ { | |||
| private PrivKey privKey; | |||
| private PubKey pubKey; | |||
| private BlockchainKeyPair CLIENT_CERT = null; | |||
| private BlockchainKeypair CLIENT_CERT = null; | |||
| private String GATEWAY_IPADDR = null; | |||
| @@ -80,7 +80,7 @@ public class SDK_GateWay_User_Test_ { | |||
| privKey = SDK_GateWay_KeyPair_Para.privkey1; | |||
| pubKey = SDK_GateWay_KeyPair_Para.pubKey1; | |||
| CLIENT_CERT = new BlockchainKeyPair(SDK_GateWay_KeyPair_Para.pubKey0, SDK_GateWay_KeyPair_Para.privkey0); | |||
| CLIENT_CERT = new BlockchainKeypair(SDK_GateWay_KeyPair_Para.pubKey0, SDK_GateWay_KeyPair_Para.privkey0); | |||
| GATEWAY_IPADDR = "127.0.0.1"; | |||
| GATEWAY_PORT = 8081; | |||
| SECURE = false; | |||
| @@ -103,9 +103,9 @@ public class SDK_GateWay_User_Test_ { | |||
| TransactionTemplate txTemp = service.newTransaction(ledgerHashs[0]); | |||
| //existed signer | |||
| AsymmetricKeypair keyPair = new BlockchainKeyPair(pubKey, privKey); | |||
| AsymmetricKeypair keyPair = new BlockchainKeypair(pubKey, privKey); | |||
| BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 注册 | |||
| txTemp.users().register(user.getIdentity()); | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.AccountHeader; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.KVDataEntry; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| @@ -54,8 +54,8 @@ import test.com.jd.blockchain.intgr.perf.LedgerInitializeWebTest; | |||
| public class IntegrationTest { | |||
| // 合约测试使用的初始化数据; | |||
| BlockchainKeyPair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeyPair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| private String contractZipName = "AssetContract1.contract"; | |||
| private String eventName = "issue-asset"; | |||
| HashDigest txContentHash; | |||
| @@ -171,7 +171,7 @@ public class IntegrationTest { | |||
| AsymmetricKeypair adminKey = context.getNode(0).getPartiKeyPair(); | |||
| BlockchainKeyPair newUserAcount = testSDK_RegisterUser(adminKey, ledgerHashs[0], bcsrv, context); | |||
| BlockchainKeypair newUserAcount = testSDK_RegisterUser(adminKey, ledgerHashs[0], bcsrv, context); | |||
| // BlockchainKeyPair newDataAccount = testSDK_RegisterDataAccount(adminKey, | |||
| // ledgerHashs[0], bcsrv, context); | |||
| @@ -223,10 +223,10 @@ public class IntegrationTest { | |||
| } | |||
| } | |||
| private static BlockchainKeyPair testSDK_RegisterUser(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| private static BlockchainKeypair testSDK_RegisterUser(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, IntegratedContext context) { | |||
| // 注册用户,并验证最终写入; | |||
| BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -253,10 +253,10 @@ public class IntegrationTest { | |||
| return user; | |||
| } | |||
| private BlockchainKeyPair testSDK_RegisterDataAccount(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| private BlockchainKeypair testSDK_RegisterDataAccount(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, IntegratedContext context) { | |||
| // 注册数据账户,并验证最终写入; | |||
| BlockchainKeyPair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -287,7 +287,7 @@ public class IntegrationTest { | |||
| } | |||
| private void testSDK_Query(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainService blockchainService, | |||
| IntegratedContext context, BlockchainKeyPair newUserAcount, BlockchainKeyPair newDataAcount) { | |||
| IntegratedContext context, BlockchainKeypair newUserAcount, BlockchainKeypair newDataAcount) { | |||
| Bytes userAddress = newUserAcount.getAddress(); | |||
| Bytes dataAddress = newDataAcount.getAddress(); | |||
| @@ -552,7 +552,7 @@ public class IntegrationTest { | |||
| // valid the basic data in contract; | |||
| prepareContractData(adminKey, ledgerHash, blockchainService, context); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -585,7 +585,7 @@ public class IntegrationTest { | |||
| return block; | |||
| } | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeyPair userKey, | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeypair userKey, | |||
| BlockchainService blockchainService, IntegratedContext context) { | |||
| LedgerInfo ledgerInfo = blockchainService.getLedger(ledgerHash); | |||
| LedgerBlock previousBlock = blockchainService.getBlock(ledgerHash, ledgerInfo.getLatestBlockHeight() - 1); | |||
| @@ -20,7 +20,7 @@ import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.SignatureDigest; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionContent; | |||
| @@ -115,7 +115,7 @@ public class ConsensusTest { | |||
| BlockchainService blockchainService = gwsrvFact.getBlockchainService(); | |||
| int batchSize = CONCURRENT_USER_COUNT * USER_TX_COUNT; | |||
| BlockchainKeyPair[] keys = generateKeys(batchSize); | |||
| BlockchainKeypair[] keys = generateKeys(batchSize); | |||
| HashDigest ledgerHash = node0.getLedgerManager().getLedgerHashs()[0]; | |||
| LedgerRepository ledger = node0.getLedgerManager().getLedger(ledgerHash); | |||
| @@ -153,15 +153,15 @@ public class ConsensusTest { | |||
| elapsedTs, (batchSize * 1000.00D / elapsedTs)); | |||
| } | |||
| private static BlockchainKeyPair[] generateKeys(int count) { | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[count]; | |||
| private static BlockchainKeypair[] generateKeys(int count) { | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[count]; | |||
| for (int i = 0; i < count; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| } | |||
| return keys; | |||
| } | |||
| private static PreparedTransaction[] prepareTransactions_RegisterDataAcount(BlockchainKeyPair[] userKeys, | |||
| private static PreparedTransaction[] prepareTransactions_RegisterDataAcount(BlockchainKeypair[] userKeys, | |||
| AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainService blockchainService) { | |||
| PreparedTransaction[] ptxs = new PreparedTransaction[userKeys.length]; | |||
| for (int i = 0; i < ptxs.length; i++) { | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.SignatureDigest; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| import com.jd.blockchain.ledger.TransactionContent; | |||
| @@ -113,7 +113,7 @@ public class GlobalPerformanceTest { | |||
| BlockchainService blockchainService = gwsrvFact.getBlockchainService(); | |||
| int batchSize = CONCURRENT_USER_COUNT * USER_TX_COUNT; | |||
| BlockchainKeyPair[] keys = generateKeys(batchSize); | |||
| BlockchainKeypair[] keys = generateKeys(batchSize); | |||
| HashDigest ledgerHash = node0.getLedgerManager().getLedgerHashs()[0]; | |||
| LedgerRepository ledger = node0.getLedgerManager().getLedger(ledgerHash); | |||
| @@ -151,15 +151,15 @@ public class GlobalPerformanceTest { | |||
| elapsedTs, (batchSize * 1000.00D / elapsedTs)); | |||
| } | |||
| private static BlockchainKeyPair[] generateKeys(int count) { | |||
| BlockchainKeyPair[] keys = new BlockchainKeyPair[count]; | |||
| private static BlockchainKeypair[] generateKeys(int count) { | |||
| BlockchainKeypair[] keys = new BlockchainKeypair[count]; | |||
| for (int i = 0; i < count; i++) { | |||
| keys[i] = BlockchainKeyGenerator.getInstance().generate(); | |||
| } | |||
| return keys; | |||
| } | |||
| private static PreparedTransaction[] prepareTransactions_RegisterDataAcount(BlockchainKeyPair[] userKeys, | |||
| private static PreparedTransaction[] prepareTransactions_RegisterDataAcount(BlockchainKeypair[] userKeys, | |||
| AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainService blockchainService) { | |||
| PreparedTransaction[] ptxs = new PreparedTransaction[userKeys.length]; | |||
| for (int i = 0; i < ptxs.length; i++) { | |||
| @@ -23,7 +23,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.ledger.BlockchainIdentity; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.DataAccountRegisterOperation; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| @@ -361,7 +361,7 @@ public class LedgerPerformanceTest { | |||
| List<TransactionRequest> txList = new ArrayList<>(); | |||
| for (int i = 0; i < count; i++) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txbuilder.users().register(userKey.getIdentity()); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||
| reqBuilder.signAsEndpoint(adminKey); | |||
| @@ -382,7 +382,7 @@ public class LedgerPerformanceTest { | |||
| List<TransactionRequest> txList = new ArrayList<>(); | |||
| for (int i = 0; i < count; i++) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| dataAccounts[i] = dataAccountKey.getIdentity(); | |||
| txbuilder.dataAccounts().register(dataAccounts[i]); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||
| @@ -442,12 +442,12 @@ public class LedgerPerformanceTest { | |||
| return null; | |||
| } | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair contractAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainIdentity contractIdentity = contractAccountKey.getIdentity(); | |||
| txbuilder.contracts().deploy(contractIdentity, chainCode); | |||
| // create data account | |||
| BlockchainKeyPair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainIdentity dataIdentity = dataAccountKey.getIdentity(); | |||
| txbuilder.dataAccounts().register(dataIdentity); | |||
| @@ -75,7 +75,7 @@ public class IntegrationBase { | |||
| public static KeyPairResponse testSDK_RegisterUser(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainService blockchainService) { | |||
| // 注册用户,并验证最终写入; | |||
| BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -100,7 +100,7 @@ public class IntegrationBase { | |||
| public static KeyPairResponse testSDK_RegisterDataAccount(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainService blockchainService) { | |||
| // 注册数据账户,并验证最终写入; | |||
| BlockchainKeyPair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -163,7 +163,7 @@ public class IntegrationBase { | |||
| public static void validKeyPair(IntegrationBase.KeyPairResponse keyPairResponse, LedgerRepository ledgerRepository, KeyPairType keyPairType) { | |||
| TransactionResponse txResp = keyPairResponse.txResp; | |||
| HashDigest transactionHash = keyPairResponse.txHash; | |||
| BlockchainKeyPair keyPair = keyPairResponse.keyPair; | |||
| BlockchainKeypair keyPair = keyPairResponse.keyPair; | |||
| long index = validLong.incrementAndGet(); | |||
| System.out.printf("validKeyPair start %s \r\n", index); | |||
| ledgerRepository.retrieveLatestBlock(); | |||
| @@ -187,7 +187,7 @@ public class IntegrationBase { | |||
| TransactionResponse txResp = keyPairResponse.txResp; | |||
| HashDigest transactionHash = keyPairResponse.txHash; | |||
| BlockchainKeyPair keyPair = keyPairResponse.keyPair; | |||
| BlockchainKeypair keyPair = keyPairResponse.keyPair; | |||
| ledgerRepository.retrieveLatestBlock(); | |||
| assertEquals(txResp.getExecutionState(), TransactionState.SUCCESS); | |||
| @@ -368,11 +368,11 @@ public class IntegrationBase { | |||
| public static class KeyPairResponse { | |||
| HashDigest txHash; | |||
| BlockchainKeyPair keyPair; | |||
| BlockchainKeypair keyPair; | |||
| TransactionResponse txResp; | |||
| public BlockchainKeyPair getKeyPair() { | |||
| public BlockchainKeypair getKeyPair() { | |||
| return keyPair; | |||
| } | |||
| @@ -430,8 +430,8 @@ public class IntegrationBase { | |||
| } | |||
| // 合约测试使用的初始化数据; | |||
| BlockchainKeyPair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeyPair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 保存资产总数的键; | |||
| private static final String KEY_TOTAL = "TOTAL"; | |||
| // 第二个参数; | |||
| @@ -443,7 +443,7 @@ public class IntegrationBase { | |||
| public LedgerBlock testSDK_Contract(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService,LedgerRepository ledgerRepository) { | |||
| System.out.println("adminKey="+ AddressEncoding.generateAddress(adminKey.getPubKey())); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| System.out.println("userKey="+userKey.getAddress()); | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| txTpl.users().register(userKey.getIdentity()); | |||
| @@ -475,7 +475,7 @@ public class IntegrationBase { | |||
| return block; | |||
| } | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeyPair userKey, | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeypair userKey, | |||
| BlockchainService blockchainService,LedgerRepository ledgerRepository) { | |||
| LedgerInfo ledgerInfo = blockchainService.getLedger(ledgerHash); | |||
| LedgerBlock previousBlock = blockchainService.getBlock(ledgerHash, ledgerInfo.getLatestBlockHeight() - 1); | |||
| @@ -23,7 +23,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.LedgerInfo; | |||
| import com.jd.blockchain.ledger.PreparedTransaction; | |||
| @@ -49,7 +49,7 @@ import test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsT | |||
| */ | |||
| public class IntegrationTest2 { | |||
| // 合约测试使用的初始化数据; | |||
| BlockchainKeyPair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| private String contractZipName = "AssetContract3.contract"; | |||
| private String eventName = "issue-asset"; | |||
| @@ -287,7 +287,7 @@ public class IntegrationTest2 { | |||
| private void testSDK_Contract(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, IntegratedContext context) { | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -307,7 +307,7 @@ public class IntegrationTest2 { | |||
| testContractExe(adminKey, ledgerHash, userKey, blockchainService, context); | |||
| } | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeyPair userKey, | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeypair userKey, | |||
| BlockchainService blockchainService, IntegratedContext context) { | |||
| LedgerInfo ledgerInfo = blockchainService.getLedger(ledgerHash); | |||
| LedgerBlock previousBlock = blockchainService.getBlock(ledgerHash, ledgerInfo.getLatestBlockHeight()-1); | |||
| @@ -5,7 +5,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.core.LedgerRepository; | |||
| import com.jd.blockchain.sdk.BlockchainService; | |||
| import com.jd.blockchain.sdk.client.GatewayServiceFactory; | |||
| @@ -132,7 +132,7 @@ public class IntegrationTest4Bftsmart { | |||
| validKeyPair(dataAccountResponse, ledgerRepository, IntegrationBase.KeyPairType.DATAACCOUNT); | |||
| if (isWriteKv) { | |||
| BlockchainKeyPair da = dataAccountResponse.keyPair; | |||
| BlockchainKeypair da = dataAccountResponse.keyPair; | |||
| IntegrationBase.KvResponse kvResponse = IntegrationBase.testSDK_InsertData(adminKey, ledgerHash, blockchainService, da.getAddress()); | |||
| validKvWrite(kvResponse, ledgerRepository, blockchainService); | |||
| } | |||
| @@ -127,7 +127,7 @@ public class IntegrationTest4MQ { | |||
| validKeyPair(dataAccountResponse, ledgerRepository, IntegrationBase.KeyPairType.DATAACCOUNT); | |||
| if (isWriteKv) { | |||
| BlockchainKeyPair da = dataAccountResponse.keyPair; | |||
| BlockchainKeypair da = dataAccountResponse.keyPair; | |||
| IntegrationBase.KvResponse kvResponse = IntegrationBase.testSDK_InsertData(adminKey, ledgerHash, blockchainService, da.getAddress()); | |||
| validKvWrite(kvResponse, ledgerRepository, blockchainService); | |||
| } | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.KVDataEntry; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| @@ -66,12 +66,12 @@ public class IntegrationTestAll4Redis { | |||
| "177gk2VtYeGbK5TS2xWhbSZA4BsT9Xj5Fb8hqCzxzgbojVVcqaDSFFrFPsLbZBx7rszyCNy" }; | |||
| // batch transactions keys | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeyPair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 合约测试使用的初始化数据; | |||
| BlockchainKeyPair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeyPair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDataKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair contractDeployKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| private String contractZipName = "AssetContract1.contract"; | |||
| private String eventName = "issue-asset"; | |||
| HashDigest txContentHash; | |||
| @@ -263,8 +263,8 @@ public class IntegrationTestAll4Redis { | |||
| BlockchainService bcsrv = gwsrvFact.getBlockchainService(); | |||
| HashDigest[] ledgerHashs = bcsrv.getLedgerHashs(); | |||
| BlockchainKeyPair newUserAcount = testSDK_RegisterUser(adminKey, ledgerHashs[0], bcsrv, ledgerRepository); | |||
| BlockchainKeyPair newDataAccount = testSDK_RegisterDataAccount(adminKey, ledgerHashs[0], bcsrv, | |||
| BlockchainKeypair newUserAcount = testSDK_RegisterUser(adminKey, ledgerHashs[0], bcsrv, ledgerRepository); | |||
| BlockchainKeypair newDataAccount = testSDK_RegisterDataAccount(adminKey, ledgerHashs[0], bcsrv, | |||
| ledgerRepository); | |||
| testSDK_InsertData(adminKey, ledgerHashs[0], bcsrv, newDataAccount.getAddress(), ledgerRepository); | |||
| LedgerBlock latestBlock = testSDK_Contract(adminKey, ledgerHashs[0], bcsrv, ledgerRepository); | |||
| @@ -315,10 +315,10 @@ public class IntegrationTestAll4Redis { | |||
| } | |||
| } | |||
| private BlockchainKeyPair testSDK_RegisterDataAccount(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| private BlockchainKeypair testSDK_RegisterDataAccount(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, LedgerRepository ledgerRepository) { | |||
| // 注册数据账户,并验证最终写入; | |||
| BlockchainKeyPair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccount = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -350,10 +350,10 @@ public class IntegrationTestAll4Redis { | |||
| return dataAccount; | |||
| } | |||
| private BlockchainKeyPair testSDK_RegisterUser(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| private BlockchainKeypair testSDK_RegisterUser(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, LedgerRepository ledgerRepository) { | |||
| // 注册用户,并验证最终写入; | |||
| BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| // 定义交易; | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); | |||
| @@ -393,7 +393,7 @@ public class IntegrationTestAll4Redis { | |||
| private LedgerBlock testSDK_Contract(AsymmetricKeypair adminKey, HashDigest ledgerHash, | |||
| BlockchainService blockchainService, LedgerRepository ledgerRepository) { | |||
| System.out.println("adminKey=" + AddressEncoding.generateAddress(adminKey.getPubKey())); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| System.out.println("userKey=" + userKey.getAddress()); | |||
| // valid the basic data in contract; | |||
| // prepareContractData(adminKey, ledgerHash, | |||
| @@ -442,7 +442,7 @@ public class IntegrationTestAll4Redis { | |||
| return block; | |||
| } | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeyPair userKey, | |||
| private void testContractExe(AsymmetricKeypair adminKey, HashDigest ledgerHash, BlockchainKeypair userKey, | |||
| BlockchainService blockchainService, LedgerRepository ledgerRepository) { | |||
| LedgerInfo ledgerInfo = blockchainService.getLedger(ledgerHash); | |||
| LedgerBlock previousBlock = blockchainService.getBlock(ledgerHash, ledgerInfo.getLatestBlockHeight() - 1); | |||
| @@ -22,7 +22,7 @@ import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties.KeyPairConfig; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.DataAccountKVSetOperation; | |||
| import com.jd.blockchain.ledger.KVDataEntry; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| @@ -147,7 +147,7 @@ public class IntegrationTestDataAccount { | |||
| TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHashs[0]); | |||
| // BlockchainKeyPair user = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeyPair data = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair data = BlockchainKeyGenerator.getInstance().generate(); | |||
| // regist user account | |||
| // txTpl.users().register(user.getIdentity()); | |||
| @@ -13,7 +13,7 @@ import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.crypto.PubKey; | |||
| import com.jd.blockchain.gateway.GatewayConfigProperties; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.core.LedgerRepository; | |||
| import com.jd.blockchain.peer.PeerServerBooter; | |||
| import com.jd.blockchain.sdk.BlockchainService; | |||
| @@ -20,7 +20,7 @@ import com.jd.blockchain.crypto.AsymmetricKeypair; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.crypto.PrivKey; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.LedgerBlock; | |||
| import com.jd.blockchain.ledger.TransactionRequest; | |||
| import com.jd.blockchain.ledger.TransactionRequestBuilder; | |||
| @@ -110,7 +110,7 @@ public class LedgerBlockGeneratingTest { | |||
| List<TransactionRequest> txList = new ArrayList<>(); | |||
| for (int i = 0; i < count; i++) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txbuilder.users().register(userKey.getIdentity()); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||
| reqBuilder.signAsEndpoint(adminKey); | |||
| @@ -25,7 +25,7 @@ import com.jd.blockchain.crypto.AsymmetricKeypair; | |||
| import com.jd.blockchain.crypto.HashDigest; | |||
| import com.jd.blockchain.ledger.BlockchainIdentity; | |||
| import com.jd.blockchain.ledger.BlockchainKeyGenerator; | |||
| import com.jd.blockchain.ledger.BlockchainKeyPair; | |||
| import com.jd.blockchain.ledger.BlockchainKeypair; | |||
| import com.jd.blockchain.ledger.TransactionRequest; | |||
| import com.jd.blockchain.ledger.TransactionRequestBuilder; | |||
| import com.jd.blockchain.ledger.data.TxBuilder; | |||
| @@ -319,7 +319,7 @@ public class RemoteTransactionService { | |||
| private TransactionRequest userRegisterRequest(HashDigest ledgerHash, AsymmetricKeypair adminKey) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair userKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| txbuilder.users().register(userKey.getIdentity()); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||
| reqBuilder.signAsEndpoint(adminKey); | |||
| @@ -328,7 +328,7 @@ public class RemoteTransactionService { | |||
| private TransactionRequest dataAccountRegisterRequest(HashDigest ledgerHash, AsymmetricKeypair adminKey, boolean isSave) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainIdentity identity = dataAccountKey.getIdentity(); | |||
| txbuilder.dataAccounts().register(identity); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||
| @@ -341,7 +341,7 @@ public class RemoteTransactionService { | |||
| private TransactionRequest dataAccountRegisterRequest(HashDigest ledgerHash, AsymmetricKeypair adminKey) { | |||
| TxBuilder txbuilder = new TxBuilder(ledgerHash); | |||
| BlockchainKeyPair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainKeypair dataAccountKey = BlockchainKeyGenerator.getInstance().generate(); | |||
| BlockchainIdentity identity = dataAccountKey.getIdentity(); | |||
| txbuilder.dataAccounts().register(identity); | |||
| TransactionRequestBuilder reqBuilder = txbuilder.prepareRequest(); | |||