Trying to use the command sendwithmetadata

+2 votes
Hello!

I'm trying to do the validation files (converted to MD5 hash) using the sendwithmetadata command.

I believe that I did not understand the correct functioning of this command and parameter data-hex.
I thought that if I send the same data-hex twice, the second time, he would return saying that this data-hex has been validated.
But it does not. The command is accepted usually with the same hex-date and because of that I did not understand what use to pass the data-hex.

There is another command to do this validation? Or what is the proper way to use the sendwithmetadata and not allow data-hex same?

Thanks!
asked Dec 31, 2015 by sola.carol

1 Answer

+1 vote
 
Best answer
You can use the blockchain to store the hash, and then retrieve that hash from the blockchain for comparison yourself. However there's not currently a built-in function in MultiChain to check for duplicate or unique hashes.
answered Dec 31, 2015 by MultiChain
selected Jan 5, 2016 by sola.carol
Thanks for your help

I managed to use the getblockhash to see if the hash already exists or not before using the sendwithmetadata.

You suggest another command?

I can use these two commands through the BitcoinJ API?
I'm afraid getblockhash is not what you're looking for. There is no function in MultiChain "check if this hash exists" - rather you need to monitor the transactions coming in from each node and then extract the hash as appropriate.
So I did not understand the functioning of getblockhash command, which must be received?

How can I monitor transactions?
How to extract the hash of each transaction?

Thank you for your help
It's not yet so easy to do this - you need to use a few different APIs to check for new blocks, get the transaction IDs out of those blocks, then the data out of those transactions. We are working on a set of features to make this kind of thing much easier - maybe you want to wait till that's available?
I will try to use the return command getrawtransaction, as one of the returned data is the hash to transaction.

Now I'm trying to execute the commands and receive the returns through the Bitcoin-JSON-RPC-Client
...