@Test(timeout=500) @Ignore("This is not really a requirement but was meant to show the supperior performance of bitcoinJ") public void generateSignaturesBitlib() throws Exception { List<SigningRequest> requests = new ArrayList<>(); for(int i = 0; i<30; i++) { requests.add(new SigningRequest(PUBLIC_KEYS[i % COUNT], HashUtils.sha256(("bla" + i).getBytes()))); } StandardTransactionBuilder.generateSignatures(requests.toArray(new SigningRequest[]{}), PRIVATE_KEY_RING); }
public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Private key not found"); } byte[] signature = signer.makeStandardBitcoinSignature(request.getToSign()); signatures.add(signature); } return signatures; }
StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Private key not found"); } byte[] signature = signer.makeStandardBitcoinSignature(request.getToSign()); signatures.add(signature); } return signatures; } }
StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Private key not found"); } byte[] signature = signer.makeStandardBitcoinSignature(request.getToSign()); signatures.add(signature); } return signatures; } StandardTransactionBuilder(NetworkParameters network); }
StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Private key not found"); } byte[] signature = signer.makeStandardBitcoinSignature(request.getToSign()); signatures.add(signature); } return signatures; } StandardTransactionBuilder(NetworkParameters network); void addOutput(Address sendTo, long value); void addOutput(TransactionOutput output); void addOutputs(OutputList outputs); static TransactionOutput createOutput(Address sendTo, long value, NetworkParameters network); static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing); UnsignedTransaction createUnsignedTransaction(Collection<UnspentTransactionOutput> inventory,
                                                        @Nonnull Address changeAddress, IPublicKeyRing keyRing,
                                                        NetworkParameters network, long minerFeeToUse); static Transaction finalizeTransaction(UnsignedTransaction unsigned, List<byte[]> signatures); }
StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Private key not found"); } byte[] signature = signer.makeStandardBitcoinSignature(request.getToSign()); signatures.add(signature); } return signatures; } StandardTransactionBuilder(NetworkParameters network); void addOutput(Address sendTo, long value); void addOutput(TransactionOutput output); void addOutputs(OutputList outputs); static TransactionOutput createOutput(Address sendTo, long value, NetworkParameters network); static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing); UnsignedTransaction createUnsignedTransaction(Collection<UnspentTransactionOutput> inventory,
                                                        @Nonnull Address changeAddress, IPublicKeyRing keyRing,
                                                        NetworkParameters network, long minerFeeToUse); static Transaction finalizeTransaction(UnsignedTransaction unsigned, List<byte[]> signatures); static final int MAX_INPUT_SIZE; }