github.com/deroproject/derosuite@v2.1.6-1.0.20200307070847-0f2e589c7a2b+incompatible/globals/struct.go (about)

     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  
    17  package globals
    18  
    19  //import  "github.com/vmihailenco/msgpack"
    20  
    21  import "github.com/deroproject/derosuite/crypto"
    22  import "github.com/deroproject/derosuite/crypto/ringct"
    23  
    24  // this structure is way blockchain sends outputs to wallet
    25  // this structure is also used internal by blockchain itself, when TXs are expanded and verified
    26  
    27  // this structure needs to be expandable without breaking legacy
    28  // This structure is the only information needed by wallet to decode previous and send new txs
    29  // This opens up the case for mobile wallets without downloading entire blockchain
    30  // Some of the fields get duplicated if a tx has multiple vouts
    31  type TX_Output_Data struct {
    32  	BLID          crypto.Hash `msgpack:"L" json:"blid,omitempty"`       // the block id in which this was found, we are duplicating it for all
    33  	TXID          crypto.Hash `msgpack:"T" json:"txid,omitempty"`       // the transaction id in which this was found, we are duplicating it for all vouts
    34  	Tx_Public_Key crypto.Key  `msgpack:"P"  json:"publickey,omitempty"` // the public key of the tx ,  we are duplicating it for all vouts within the TX
    35  	// this is extracted from the extra field
    36  
    37  	// this data is consumed by the blockchain itself while expanding tx
    38  	InKey           ringct.CtKey     `msgpack:"D"  json:"inkey,omitempty"`           // contains the vout key and encrypted commitment
    39  	ECDHTuple       ringct.ECdhTuple `msgpack:"E" json:"ecdhtuple,omitempty"`        // encrypted Amounts, will be empty for miner tx
    40  	SenderPk        crypto.Key       `msgpack:"K" json:"senderpk,omitempty"`         // from the outpk
    41  	Amount          uint64           `msgpack:"A,omitempty" json:"amount,omitempty"` // amount used for miner tx
    42  	SigType         uint64           `msgpack:"S" json:"sigtype,omitempty"`          // which ringct type the output was of
    43  	Index_within_tx uint64           `msgpack:"W" json:"indexwithintx,omitempty"`    // output index  of vout within the tx
    44  	Index_Global    uint64           `msgpack:"G" json:"indexglobal,omitempty"`      // position in global index
    45  	Height          uint64           `msgpack:"H" json:"height,omitempty"`           // height to which this belongs
    46  	Unlock_Height   uint64           `msgpack:"U" json:"unlockheight,omitempty"`     // height at which it will unlock
    47  	TopoHeight      int64            `msgpack:"TH" json:"Topoheight,omitempty"`      // Topoheight
    48  	Block_Time      uint64           `msgpack:"B"`                                   // when was this block found in epoch
    49  
    50  	Key_Images []crypto.Key `msgpack:"KI,omitempty"`                           // all the key images consumed within the TX
    51  	PaymentID  []byte       `msgpack:"I,omitempty" json:"paymentid,omitempty"` // payment ID contains both unencrypted (33byte)/encrypted (9 bytes)
    52  
    53  	// TODO this structure must also keep payment ids and encrypted payment ids
    54  }