Author

Topic: sendrawtransaction over 1000 times every minutes? (Read 549 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
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.
newbie
Activity: 1
Merit: 0

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 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      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.");
   }
}   
Jump to: