Skip to content

Instantly share code, notes, and snippets.

@RaghavSood
Created February 25, 2019 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaghavSood/d27cabeb91d6cea2a8fd775bdda059da to your computer and use it in GitHub Desktop.
Save RaghavSood/d27cabeb91d6cea2a8fd775bdda059da to your computer and use it in GitHub Desktop.
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