You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
3.2 KiB

  1. // Copyright 2017-2018 DERO Project. All rights reserved.
  2. // Use of this source code in any form is governed by RESEARCH license.
  3. // license can be found in the LICENSE file.
  4. // GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8
  5. //
  6. //
  7. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  8. // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  9. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10. // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  11. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  13. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  14. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  15. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16. package globals
  17. //import "github.com/vmihailenco/msgpack"
  18. import "github.com/arnaucode/derosuite/crypto"
  19. import "github.com/arnaucode/derosuite/crypto/ringct"
  20. // this structure is way blockchain sends outputs to wallet
  21. // this structure is also used internal by blockchain itself, when TXs are expanded and verified
  22. // this structure needs to be expandable without breaking legacy
  23. // This structure is the only information needed by wallet to decode previous and send new txs
  24. // This opens up the case for mobile wallets without downloading entire blockchain
  25. // Some of the fields get duplicated if a tx has multiple vouts
  26. type TX_Output_Data struct {
  27. TXID crypto.Hash `msgpack:"T"` // the transaction id in which this was found, we are duplicating it for all vouts
  28. Tx_Public_Key crypto.Key `msgpack:"P"` // the public key of the tx , we are duplicating it for all vouts within the TX
  29. // this is extracted from the extra field
  30. // this data is consumed by the blockchain itself while expanding tx
  31. InKey ringct.CtKey `msgpack:"D"` // contains the vout key and encrypted commitment
  32. ECDHTuple ringct.ECdhTuple `msgpack:"E"` // encrypted Amounts, will be empty for miner tx
  33. SenderPk crypto.Key `msgpack:"K"` // from the outpk
  34. Amount uint64 `msgpack:"A,omitempty"` // amount used for miner tx
  35. SigType uint64 `msgpack:"S"` // which ringct type the output was of
  36. Index_within_tx uint64 `msgpack:"W"` // output index of vout within the tx
  37. Index_Global uint64 `msgpack:"G"` // position in global index
  38. Height uint64 `msgpack:"H"` // height to which this belongs
  39. Unlock_Height uint64 `msgpack:"U"` // height at which it will unlock
  40. Block_Time uint64 `msgpack:"B"` // when was this block found in epoch
  41. Key_Images []crypto.Key `msgpack:"KI,omitempty"` // all the key images consumed within the TX
  42. PaymentID []byte `msgpack:"I,omitempty"` // payment ID contains both unencrypted (33byte)/encrypted (9 bytes)
  43. // TODO this structure must also keep payment ids and encrypted payment ids
  44. }