Created
February 25, 2019 22:04
-
-
Save RaghavSood/d27cabeb91d6cea2a8fd775bdda059da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package grintx | |
type Transaction struct { | |
NumParticipants int `json:"num_participants"` | |
ID string `json:"id"` | |
Tx TxData `json:"tx"` | |
Amount int `json:"amount"` | |
Fee int `json:"fee"` | |
Height int `json:"height"` | |
LockHeight int `json:"lock_height"` | |
ParticipantData []ParticipantData `json:"participant_data"` | |
} | |
type ParticipantData struct { | |
ID int `json:"id"` | |
PublicBlindExcess []uint8 `json:"public_blind_excess"` | |
PublicNonce []uint8 `json:"public_nonce"` | |
PartSig []uint8 `json:"part_sig"` | |
Message string `json:"message"` | |
MessageSig []uint8 `json:"message_sig"` | |
} | |
type Output struct { | |
Features string `json:"features"` | |
Commit []uint8 `json:"commit"` | |
Proof []uint8 `json:"proof"` | |
} | |
type Input struct { | |
Features string `json:"features"` | |
Commit []uint8 `json:"commit"` | |
} | |
type Kernel struct { | |
Features string `json:"features"` | |
Fee int `json:"fee"` | |
LockHeight int `json:"lock_height"` | |
Excess []uint8 `json:"excess"` | |
ExcessSig []uint8 `json:"excess_sig"` | |
} | |
type TxBody struct { | |
Inputs []Input `json:"inputs"` | |
Outputs []Output `json:"outputs"` | |
Kernels []Kernel `json:"kernels"` | |
} | |
type TxData struct { | |
Offset []int `json:"offset"` | |
Body TxBody `json:"body"` | |
} | |
func (tx Transaction) OutputCommits() []string { | |
list := make([]string, len(tx.Tx.Body.Outputs)) | |
for i, o := range tx.Tx.Body.Outputs { | |
list[i] = hex.EncodeToString(o.Commit) | |
} | |
return list | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment