Bitcoin Forum
June 24, 2024, 09:57:48 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Re: How to check my address balance in regtest? on: December 18, 2017, 07:41:11 AM
Thanks!

But how can I add an address to an account in Bitcoin-core?
2  Local / Ελληνικά (Greek) / Βοήθεια για να κάνω proof of existence χρησιμοποιώντας BitcoinJ on: November 28, 2017, 09:40:56 AM
Καλησπέρα,

στα πλαίσια μίας εργασίας μου, ένα κομμάτι χρήζει αποθήκευση δεδομένων στην Blockchain, ώστε μετέπειτα αυτά τα δεδομένα να είναι transparent ως proof of existence.
Αυτή η διαδικασία μπορεί να γίνει δημιουργώντας μία συναλλαγή τύπου OP_RETURN που ενσωματώνει δεδομένα στο output της συναλλαγής.

Έχω δημιουργήσει την συναλλαγή σε Java (θεωρώ σωστά), αλλά δεν ξέρω πως να την υπογράψω και να την κάνω broadcast στο regtest network που δημιούργησα για πειραματικούς σκοπούς.
Αρχικά θέλω να δω ότι η συναλλαγή δημιουργήθηκε και ενσωματώθηκε σε ένα block στο regtest network, έπειτα θα κάνω το αντίστοιχο αλλάζοντας το δίκτυό μου στο πραγματικό, ώστε να ενσωματώσω τα data που θέλω στην Bitcoin Blockchain, που είναι και το ζητούμενο.

Τα ερωτήματα τα έχω κάνει post στο forum εδώ:
https://bitcointalk.org/index.php?topic=2477388.0
https://bitcointalk.org/index.php?topic=2477527.msg25361235#msg25361235

αλλά και στο stackoverflow:
https://bitcoin.stackexchange.com/questions/63521/how-to-sign-an-op-return-transaction-with-bitcoinj
https://bitcoin.stackexchange.com/questions/63219/how-to-check-my-address-balance-in-regtest/63228#63228

Όποιος γνωρίζει από BitcoinJ,RPCs (Bitcoin-Core),OP_RETURN Transactions ,έχει κάνει κάτι παρόμοιο ή μπορεί να βοηθήσει θα το εκτιμούσα να επικοινωνήσει.
3  Bitcoin / Bitcoin Technical Support / How to check my address balance in regtest? on: November 28, 2017, 09:03:07 AM
I have created a regtest address and I want to check it's balance.

I have run the commands:

-regtest generate 101
-regtest getbalance
-regtest sendtoaddress n4MN27Lk7Yh3pwfjCiAbRXtRVjs4Uk67fG 10.00
-regtest generate 6
-regtest getbalance n4MN27Lk7Yh3pwfjCiAbRXtRVjs4Uk67fG
after the 5th step the balance is still 0.

Why this happened since I have already sent 10 BTC to my address? Do I have to sign any outputs in order to claim the bitcoins?


4  Bitcoin / BitcoinJ / How to sign an OP_RETURN transaction with BitcoinJ on: November 28, 2017, 08:50:11 AM
I want to create and sign an OP_RETURN transaction and broadcasting to my Regtest network. I face up two problems:

First: I have created successfully the transaction output but how to sign and broadcast my transaction to the regtest network?

Here is my code for creating the output:


Code:
public TransactionOutput createOpReturnTransaction(org.bitcoinj.core.Transaction tx, ScriptBuilder sb) {

    String myData = Main.resultHash;

    byte[] sha256 = org.apache.commons.codec.digest.DigestUtils
            .sha256(myData);
     myScript = sb.op(ScriptOpCodes.OP_RETURN).data(sha256).build();
    TransactionOutput transactionOutput = tx.addOutput(
            org.bitcoinj.core.Transaction.MIN_NONDUST_OUTPUT, myScript);

    System.out.println("My script is :" + myScript);
    System.out.println("My transaction output is : " + transactionOutput);
    System.out
            .println("The size of my message after hashing with SHA256 is : "
                    + sha256.length + " bytes.");
    return transactionOutput;
}


And here are the steps that i have to finish in Main:

Code:
 //create the OP_RETURN transaction in Main

            TransactionOutput output=dataOutput.createOpReturnTransaction(dataOutput.getTransaction(),dataOutput.getScriptbuilder());

         //sign the transaction and broadcast in Main ???



Second: Despite the fact that I have send bitcoins through the regtest network with the RPC : -regtest sendtoaddress n4MN27Lk7Yh3pwfjCiAbRXtRVjs4Uk67fG 10.00 balance in regtest.

in Java the wallet.getBalance() function returns zero concerning the balance of my wallet which has the n4MN27Lk7Yh3pwfjCiAbRXtRVjs4Uk67fG address

How it is possible to align my balance in regtest with this in BitcoinJ? I guess i will need balance in order to sign my OP_RETURN transaction.

Here is the output in the console:



5  Bitcoin / Development & Technical Discussion / Re: ECKey.ECDSASignature creation on: January 09, 2016, 05:49:04 PM
Thanks,

so the scenario trying to sign the bytes of private key is not accepted.

I made this assumption because the Sha256Hash.wrap(key.getPrivKeyBytes()); function wraps a 32 byte[] which was convenient to me to be the getPrivKeyBytes() result,as i didn't have something else to sign.

But as it gets clear to me now..that i have to sign a Transaction,which i haven't implemented in my code before.
                  
6  Bitcoin / Development & Technical Discussion / ECKey.ECDSASignature creation on: January 09, 2016, 04:39:53 PM
Hello,



I have my ECKey key;

In order to create a ECDSASignature object with BitcoinJ we have to call the :

ECDSASignature mySignature=key.sign(Sha256Hash input);
The Sha256Hash input is my message? The Sha256Hash input is the result of Sha256(byte[] myArray)?

What if i have not message to sign!! Is it acceptable to sign the key.getPrivKeyBytes()?? in order to create an ECDSASignature or it is unacceptable because it reveals information including in getPrivKeyBytes() and as a result reveal my private key??

And if it is unacceptable which must be my message? I can sign whatever i want in order to create my ECDSASignature ?
7  Local / Ελληνικά (Greek) / Re: BitcoinJ(Java Library for Bitcoin Protocol) on: January 05, 2016, 02:23:42 PM
Βεβαίως.

Ουσιαστικά δεν χρειάζεται κάποιος αλγόριθμος γιατί έχοντας το κλειδί σου, το key στην προκειμένη περίπτωση της κλάσης ECKey που παρέχει η βιβλιοθήκη BitcoinJ....απλά καλείς την toAddress() function που είναι υλοποιημένη από την βιβλιοθήκη BitcoinJ επί του αντικειμένου key,η οποία σου επιστρέφει την διεύθυνση Bitcoin(όπως την βλέπουμε με το 1 μπροστά) η οποία αντιστοιχεί στο public key του ECKey.

με βάση αυτό:https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-


Προσοχή όταν λέμε ECKey, αυτό είναι το Elliptic Curve Key που περιέχει και το public αλλά και το private μέρος του κλειδιού.


ECKey key = ...;
String addr = key.toAddress(MainNetParams.get()).toString();
8  Bitcoin / Development & Technical Discussion / Re: Creation of <20-byte hash of redeem Script> in a P2SH Transaction on: January 05, 2016, 12:26:46 PM
Thanks for the help!

I created the redeem Script as follows:
Script redeemScript=scriptbuilder.createRedeemScript(2, pubkeys);

Then in order to get the bytes of the script i used the :
byte[] bytesFromScript=myScript.getProgram();

and finally in got the hash of the Script using the  RIPEMD160(SHA256(bytesFromScript)) procedure.

The Script class doesn't have any other function to get the bytes so i used the getProgram() function.
Am i wrong to this?


 
9  Bitcoin / Development & Technical Discussion / Creation of <20-byte hash of redeem Script> in a P2SH Transaction on: January 04, 2016, 05:33:42 PM
Hello.

According to this example:

Redeem Script: 2 PubKey1 PubKey2 PubKey3 PubKey4 PubKey5 5 OP_CHECKMULTISIG

Locking Script: OP_HASH160 <20-byte hash of redeem script> OP_EQUAL

Unlocking Script: Sig1 Sig2 redeem script

I want to calculate the <20-byte hash of redeem script> with BitcoinJ but i don't know how to do it.

This <20-byte hash of redeem script> is the result of :

RIPEMD160(SHA256(PubKey1.getPublicKeyAsHex() || PubKey2.getPublicKeyAsHex() || PubKey3.getPublicKeyAsHex() || PubKey4.getPublicKeyAsHex() || PubKey5.getPublicKeyAsHex())) or RIPEMD160(SHA256(input))Huh

The input (which is String type) from above is the concatenation of each public key of all participants in the redeem script.

And if <20-byte hash of redeem script> it is not the result that i mentioned above...how can i estimate this hash with BitcoinJ?

Thanks in advance.
10  Local / Ελληνικά (Greek) / Re: BitcoinJ(Java Library for Bitcoin Protocol) on: January 02, 2016, 11:50:12 PM
@chek2fire ευχαριστώ για την επισήμανση. Ισχύει ότι στο αγγλικό forum υπάρχουν συζητήσεις για technical κομμάτια.
Τελικά λύθηκε η απορία μου παρόλα αυτά Smiley.
11  Local / Ελληνικά (Greek) / BitcoinJ(Java Library for Bitcoin Protocol) on: December 31, 2015, 10:59:55 AM
Καλησπέρα,

αυτήν την περίοδο προγραμματίζω τις basic transactions του Bitcoin σε Java χρησιμοποιώντας την βιβλιοθήκη του BitcoinJ.
Ξέρει κάποιος που έχει ασχοληθεί αν υπάρχει κάποια function σε java ή κάποιος αλγόριθμος που να μετατρέπει την getPubKeyHash() του ECKey σε base58 διεύθυνση μαζί με το checksum;

Εδώ έχω το ερώτημά μου στην Bitcoin Beta:
http://bitcoin.stackexchange.com/questions/42101/encoding-my-bitcoin-address-with-base58-encoding
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!