0

I'm trying to build a Monero transaction using the mymonero-core library. So far I've been following the code from the tests, however I'm not quite sure what to do with the "rct" part of the previous output. Here (ref) the rct in constructed as the string concatenation of outpk[i],mask[i],amount[i], which is possible because the used transaction 9d37c7fdeab91abfd1e7e120f5c49eac17b7ac04a97a0c93b51c172115df21ea has all these fields:

""rct_signatures"": {
    ""type"": 3, 
    ""txnFee"": 327860000, 
    ""ecdhInfo"": [ {
        ""mask"": ""889e4a48335cbbf163ca9cd0299df86f28818ebb45960e0dd00e3f1a0549a704"", 
        ""amount"": ""9b07dcf00b7bf6cbdf269da3d9772af2ae377e1f58f13158359f6c96bfd2e50d""
      }, {
        ""mask"": ""b5b234ccdd70beca8b1fc8de4f2ceb1374e0f1fd8810849e7f11316c2cc06306"", 
        ""amount"": ""0008ffa5ac9827b776993468df21af8c963d12148622354f950cbe1369a92a0c""
      }], 
    ""outPk"": [ ""3ef9880e8fed3f5222096938a6bc773d2a12cbbc9caf30d12bc6a216b4fad70b"", ""86a2c9f1f8e66848cd99bfda7a14d4ac6c3525d06947e21e4e55fe42a368507e""]
  }, 

In my case however the transaction which I want to use UTXOs from has this structure

""rct_signatures"": {
    ""type"": 4, 
    ""txnFee"": 30790000, 
    ""ecdhInfo"": [ {
        ""amount"": ""54dd48f41f3670f3""
      }, {
        ""amount"": ""c0c11a7c62dc0f68""
      }], 
    ""outPk"": [ ""f4449d60fbc9087f9dcfa856537b4d2d02433454ba5245d4d46ea36ea5922c46"", ""29660983d695b61492d9a213c150da443997f8c9397e2910a07717fbda87f64d""]
  }, 

So the mask is missing and amount has a different format. How do I build RCT for those?

jtgrassie
  • 19,111
  • 4
  • 14
  • 51
  • This should answer your question: https://monero.stackexchange.com/a/11273/7493 – jtgrassie May 04 '20 at 15:11
  • 1
    @jtgrassie Thanks for help, however it's still not quite clear if the RCT format stays the same? Do I still need to build it using a regular string concat once I got encrypted amount and mask in the "old"(?) format? Unfortunately this step is missing from the tests with only the resulting value being hard-coded – Oleg Golovkov May 04 '20 at 15:19
  • I've reopened (for now) but perhaps you should rewrite the question. The mask and amount are discussed in the other Q/A as the masks are now deterministically derived. Therefore they do not form part of the transaction any longer. And: "if the RCT format stays the same" is clearly no. type 3 is not the same as type 4. – jtgrassie May 04 '20 at 15:26
  • 1
    @jtgrassie oh I see, do you by chance know if this implementation should be fine (for type4?)? https://github.com/monero-project/monero/blob/master/src/crypto/crypto.cpp#L515 it's really hard to find any docs or code samples for it – Oleg Golovkov May 04 '20 at 15:44
  • It is not clear what you are trying to achieve. You link (in the question) to a mock test which gets the output of an RPC call, then in the comment above link to a function which generates a signature. What precisely are you trying to do? Build a tx? Sign? – jtgrassie May 04 '20 at 16:01
  • @jtgrassie that test is using values from a real tx and passes the crypto checks. I'm trying to repeat it using my real tx but I get errors like spendable_amount can't be 0 which I assume come from the fact that I don't build a proper rct (since other parts look good). My final goal is to build a valid tx string that I could later broadcast via the daemon given the valid UTXO (posted in the question) and the spend key for it – Oleg Golovkov May 04 '20 at 16:11

0 Answers0