types

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorNoError                              = 0
	ErrorInvalidDigest                        = 1
	ErrorInvalidSignature                     = 2
	ErrorInvalidRawTransaction                = 3
	ErrorNoPermission                         = 4
	ErrorRawTransactionReplayAttack           = 5
	ErrorInvalidSubmitDatabaseHashTransaction = 6
	ErrorInvalidQuery                         = 7
	ErrorNoSuchPath                           = 8
)
View Source
const (
	TransactionDataUnknown       = 0
	TransactionDataOriginalData  = 1
	TransactionDataMetaData      = 2
	TransactionDataRegulatorData = 3
	TransactionDataChangedData   = 4
)
View Source
const (
	TransactionUnknown                       = 0
	TransactionSubmitDatabaseHashTransaction = 1
	TransactionSpectrumTransaction           = 2
)

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(message string, pubX *big.Int, pubY *big.Int) (rX, rY, s, hashX *big.Int)

func FindCollision

func FindCollision(message string, rX *big.Int, rY *big.Int, s *big.Int, hashX *big.Int, newMessage string, priv []byte) (newRX, newRY, newS *big.Int)

func ReadUserAttrs

func ReadUserAttrs(filename string) *abe.UserAttrs

Types

type BlockTransactions

type BlockTransactions struct {
	ContentDigests []ItemDigest `json:"content_digests"`
}

type ItemCount

type ItemCount struct {
	Count int64 `json:"count"`
}

type ItemDigest

type ItemDigest struct {
	ContentDigest string `json:"content-digest"`
}

type PubParams

type PubParams struct {
	Org       *abe.Org     `json:"-"`
	Org_      string       `json:"org"`
	AuthPub0  *abe.AuthPub `json:"-"`
	AuthPub0_ string       `json:"authpub0"`
}

func ReadPub

func ReadPub(filename string) PubParams

func (*PubParams) OfJsonObj

func (pubparams *PubParams) OfJsonObj() *PubParams

type QueryAccountNonceReply

type QueryAccountNonceReply struct {
	Nonce uint64 `json:"nonce"`
}

type QueryAccountNonceRequest

type QueryAccountNonceRequest struct {
	Account string `json:"account"`
}

type QueryByBlockNumberReply

type QueryByBlockNumberReply struct {
	Existed bool         `json:"existed"`
	Item    []ItemDigest `json:"contentdigest"`
}

type QueryByBlockNumberRequest

type QueryByBlockNumberRequest struct {
	BLockNumber int64 `json:"block_number"`
}

query by block number

type QueryCountsByOneReply

type QueryCountsByOneReply struct {
	Existed bool       `json:"existed"`
	Item    *ItemCount `json:"count"`
}

type QueryCountsByOneRequest

type QueryCountsByOneRequest struct {
	One int64 `json:"query_counts"`
}

type QueryDatabaseItem

type QueryDatabaseItem DatabaseHashItem

type QueryDatabaseItemReply

type QueryDatabaseItemReply struct {
	Existed bool               `json:"existed"`
	Item    *QueryDatabaseItem `json:"item"`
}

type QueryDatabaseItemRequest

type QueryDatabaseItemRequest struct {
	TimeStart int64 `json:"time_start"`
	TimeEnd   int64 `json:"time_end"`
}

type QueryRawTransactionReply

type QueryRawTransactionReply struct {
	Existed bool            `json:"existed"`
	Item    *RawTransaction `json:"rawtransction"`
}

type QueryRawTransactionRequest

type QueryRawTransactionRequest struct {
	ContentDigest string `json:"content_digest"`
}

type QueryTransactionTypeReply

type QueryTransactionTypeReply struct {
	Item []ItemDigest `json:"contentdigests"`
}

type QueryTransactionTypeRequest

type QueryTransactionTypeRequest struct {
	DataType int64 `json:"transaction_datatype"`
}

can be 0 to 4

type RawTransaction

type RawTransaction struct {
	TxDataType    uint32 `json:"tx_data_type"`
	Type          uint32 `json:"type"`
	Nonce         []byte `json:"nonce"`
	Content       []byte `json:"content"` // json string of a particular transaction
	HashMethod    string `json:"hash_method"`
	ContentDigest []byte `json:"content_digest"` // sha256 or chameleon of Value
	SignMethod    string `json:"sign_method"`
	Signature     []byte `json:"signature"`  // the signature of ValueHash
	PublicKey     []byte `json:"public_key"` // the corresponding public key of the signature, ed25519
	ChameleonRx   []byte `json:"chameleon_hash_rx"`
	ChameleonRy   []byte `json:"chameleon_hash_rY"`
	ChameleonS    []byte `json:"chameleon_hash_s"`
	ChameleonPubx []byte `json:"chameleon_hash_pubX"`
	ChameleonPuby []byte `json:"chameleon_hash_pubY"`
	ChameleonPriv []byte `json:"chameleon_hash_priv"` //encryption
}

func ChangeRawTransaction

func ChangeRawTransaction(txNonce uint64, privKey ed25519.PrivKey, oldTransaction *RawTransaction, newMessage []byte, RePri []byte) (*RawTransaction, error)

func NewRawTransaction

func NewRawTransaction(txDataType uint32, txType uint32, txContent []byte, txNonce uint64, privKey ed25519.PrivKey, Repub []byte) (*RawTransaction, error)

func (*RawTransaction) GetAccount

func (self *RawTransaction) GetAccount() (string, error)

func (*RawTransaction) GetNonceAsNumber

func (self *RawTransaction) GetNonceAsNumber() uint64

func (*RawTransaction) GetPublicKey

func (self *RawTransaction) GetPublicKey() (crypto.PubKey, error)

func (*RawTransaction) VerifyHash

func (self *RawTransaction) VerifyHash() (bool, error)

func (*RawTransaction) VerifySignature

func (self *RawTransaction) VerifySignature() (bool, error)

type RegulatorKey

type RegulatorKey struct {
	RePub []byte `json:"repub"`
	RePri []byte `json:"repri"`
}

type SpectrumItem

type SpectrumItem SpectrumTransaction

type SpectrumTransaction

type SpectrumTransaction struct {
	EncryptionContent []byte `json:"content"`
	EncryptionAbeKey  []byte `json:"abe_key"`
}

type SubmitDatabaseHashTransaction

type SubmitDatabaseHashTransaction struct {
	DatabaseName string `json:"database_name"`
	TimeStart    int64  `json:"time_start"`
	TimeEnd      int64  `json:"time_end"`
	HashMethod   string `json:"hash_method"`
	Value        []byte `json:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL