Bitcoin Forum
October 17, 2017, 12:33:02 AM *
News: Latest stable version of Bitcoin Core: 0.15.0.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: sendrawtransaction over 1000 times every minutes?  (Read 438 times)
gyouny
Newbie
*
Offline Offline

Activity: 1


View Profile
May 10, 2017, 04:55:35 AM
 #1


I am developing a Document Signing Solution using Bitcoin.

1. A User sign a document and post the signed document to Server.

2. Server calculate the hash(sha-256) of the signed document.

3. Server create a new Bitcoin Raw-Transaction with the hashed value of document as OP_RETURN and finally send to Bitcoin network.

(
I have Bitcoin Server running bitcoin-qt.exe as Daemon on testnet and communicating by JSON-RPC with bitcoinj-core.jar.
A Wallet's account has enough bitcoin has received from the free bitcoin charge site like "http://tpfaucet.appspot.com/".
)





Problem: Now Bitcoin Server send one transaction successfully but has to wait long time(i don't know exactly) to send next transaction until the previouse one has been confirmed.
 
Question: I want to send over 1000 transactions every minutes.

How can i obtain available UnspentOutput at any time?

Do you have any idea?








This is my real test code.

NetworkParameters np = TestNet3Params.get();
URI server = new URI("");
String username = "";
String password = "";
BitcoinExtendedClient  client = new BitcoinExtendedClient(np, server, username, password);   

List<UnspentOutput> lst = client.listUnspent(); // How can i obtain available UnspentOutput at any time?
if (lst.size() == 0) {
   System.out.println("No UnspentOutput.");
} else {
   ECKey senderKey = null;            
   for(int n=0; n<lst.size(); ++n) {
      UnspentOutput item = lst.get(n);
      Coin ownAmount = item.getAmount();               
      if (ownAmount.value >= Coin.SATOSHI.value) {
         senderKey = client.dumpPrivKey(item.getAddress());
         break;
      }
   }   
   if (senderKey != null) {               
      Coin sendingAmount = Coin.ZERO;
      Address receiverAddress = client.getNewAddress();
      byte[] opRetData = BlockSignAlg.sign("test", BlockSignAlg.TEST_NET);               
      if (opRetData != null) {
         Transaction tx = client.createSignedTransaction(senderKey, receiverAddress, sendingAmount, opRetData);
         //Coin coinFee = tx.getFee();
         tx.verify();                  
         Sha256Hash txId = client.sendRawTransaction(tx);
         System.out.println("txId : " + txId.toString());                  
      } else {
         System.out.println("Can't generate OpReturn Data.");
      }
   } else {
      System.out.println("No UnspentOutput.");
   }
}   
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1508200382
Hero Member
*
Offline Offline

Posts: 1508200382

View Profile Personal Message (Offline)

Ignore
1508200382
Reply with quote  #2

1508200382
Report to moderator
achow101
Staff
Legendary
*
Offline Offline

Activity: 1190


17kKQppUsngUiByDsce4JXoZEjjpvX9bpR


View Profile WWW
May 10, 2017, 01:17:44 PM
 #2

Try doing
Code:
listunspent 0
instead. The default (without any parameters) is to have a minimum of 1 confirmation. With that one parameter, you set the minimum confirmation requirement to 0, so it should return the outputs for unconfirmed transactions.

You are going to have a problem after making the 25th transaction. Core will not allow you to have unconfirmed transaction chains of more than 25.

          ▄█████▄
        ▄█████████▄
      ▄████▀   ▀████▄
    ▄████▀   ▄ ▄█▀████▄
  ▄████▀   ▄███▀   ▀████▄
▄████▀   ▄███▀   ▄   ▀████▄
█████   ███▀   ▄███   █████
▀████▄   ▀██▄▄███▀   ▄████▀
  ▀████▄   ▀███▀   ▄████▀
    ▀████▄       ▄████▀
      ▀████▄   ▄████▀
        ▀███  ████▀
          ▀█▄███▀
.
|
.
|
          ▄█████▄
        ▄█████████▄
      ▄████▀   ▀████▄
    ▄████▀   ▄ ▄█▀████▄
  ▄████▀   ▄███▀   ▀████▄
▄████▀   ▄███▀   ▄   ▀████▄
█████   ███▀   ▄███   █████
▀████▄   ▀██▄▄███▀   ▄████▀
  ▀████▄   ▀███▀   ▄████▀
    ▀████▄       ▄████▀
      ▀████▄   ▄████▀
        ▀███  ████▀
          ▀█▄███▀
unthy
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!