Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNormalOperation

func IsNormalOperation(t OperationType) bool

Types

type Body

type Body interface {
	//
	// Check that this transaction is self consistent
	//
	// This routine is used by the transaction checker and thus is part of consensus
	//
	// Params:
	//   config = Consensus configuration
	//
	// Returns:
	//   An `error` if that transaction is invalid, `nil` otherwise
	//
	IsWellFormed(common.Config) error
	HasFee() bool
}

func UnmarshalBodyJSON

func UnmarshalBodyJSON(t OperationType, b []byte) (Body, error)

type CollectTxFee

type CollectTxFee struct {
	Target    string        `json:"target"`
	Amount    common.Amount `json:"amount"`
	Txs       uint64        `json:"txs"`
	Height    uint64        `json:"block-height"`
	BlockHash string        `json:"block-hash"`
	TotalTxs  uint64        `json:"total-txs"`
	TotalOps  uint64        `json:"total-ops"`
}

    OperationBodyTransactionFee is the operation to send the collected transacton fee to certain account. To prevent the hash duplication of transaction, OperationBodyTransactionFee has block related data.

    func NewCollectTxFee

    func NewCollectTxFee(
    	target string,
    	amount common.Amount,
    	txs uint64,
    	blockHeight uint64,
    	blockHash string,
    	totalTxs uint64,
    ) CollectTxFee

    func (CollectTxFee) GetAmount

    func (o CollectTxFee) GetAmount() common.Amount

    func (CollectTxFee) HasFee

    func (o CollectTxFee) HasFee() bool

    func (CollectTxFee) IsWellFormed

    func (o CollectTxFee) IsWellFormed(common.Config) (err error)

    func (CollectTxFee) TargetAddress

    func (o CollectTxFee) TargetAddress() string

    type CongressVoting

    type CongressVoting struct {
    	Contract string `json:"contract"`
    	Voting   struct {
    		Start uint64 `json:"start"`
    		End   uint64 `json:"end"`
    	} `json:"voting"`
    	FundingAddress string        `json:"funding_address"`
    	Amount         common.Amount `json:"amount"`
    }

    func NewCongressVoting

    func NewCongressVoting(contract string, start, end uint64, amount common.Amount, fundingAddress string) CongressVoting

    func (CongressVoting) HasFee

    func (o CongressVoting) HasFee() bool

    func (CongressVoting) IsWellFormed

    func (o CongressVoting) IsWellFormed(common.Config) (err error)

    type CongressVotingResult

    type CongressVotingResult struct {
    	BallotStamps struct {
    		Hash string   `json:"hash"`
    		Urls []string `json:"urls"`
    	} `json:"ballot_stamps"`
    	Voters struct {
    		Hash string   `json:"hash"`
    		Urls []string `json:"urls"`
    	} `json:"voters"`
    	Result struct {
    		Count uint64 `json:"count"`
    		Yes   uint64 `json:"yes"`
    		No    uint64 `json:"no"`
    		ABS   uint64 `json:"abs"`
    	} `json:"result"`
    	CongressVotingHash string `json:"congress_voting_hash"`
    	Membership         struct {
    		Hash string   `json:"hash"`
    		Urls []string `json:"urls"`
    	} `json:"membership"`
    }

    func NewCongressVotingResult

    func NewCongressVotingResult(
    	ballotHash string, ballotUrls []string,
    	votersHash string, votersUrls []string,
    	membershipHash string, membershipUrls []string,
    	resultCount, resultYes, resultNo, resultABS uint64,
    	congressVotingHash string,
    ) CongressVotingResult

    func (CongressVotingResult) HasFee

    func (o CongressVotingResult) HasFee() bool

    func (CongressVotingResult) IsWellFormed

    func (o CongressVotingResult) IsWellFormed(common.Config) (err error)

    type CreateAccount

    type CreateAccount struct {
    	Target string        `json:"target"`
    	Amount common.Amount `json:"amount"`
    	Linked string        `json:"linked,omitempty"`
    }

    func NewCreateAccount

    func NewCreateAccount(target string, amount common.Amount, linked string) CreateAccount

    func (CreateAccount) GetAmount

    func (o CreateAccount) GetAmount() common.Amount

    func (CreateAccount) HasFee

    func (o CreateAccount) HasFee() bool

    func (CreateAccount) IsWellFormed

    func (o CreateAccount) IsWellFormed(common.Config) (err error)

      Implement transaction/operation : IsWellFormed

      func (CreateAccount) TargetAddress

      func (o CreateAccount) TargetAddress() string
      type Header struct {
      	Type OperationType `json:"type"`
      }

      type Inflation

      type Inflation struct {
      	Target         string        `json:"target"`
      	Amount         common.Amount `json:"amount"`
      	InitialBalance common.Amount `json:"initial_balance"`
      	Ratio          string        `json:"ratio"`
      	Height         uint64        `json:"block-height"`
      	BlockHash      string        `json:"block-hash"`
      	TotalTxs       uint64        `json:"total-txs"`
      	TotalOps       uint64        `json:"total-ops"`
      }

        Inflation is the operation to raise inflation in every block. To prevent the hash duplication of transaction, Inflation has block related data.

        func NewOperationBodyInflation

        func NewOperationBodyInflation(
        	target string,
        	amount common.Amount,
        	initialBalance common.Amount,
        	blockHeight uint64,
        	blockHash string,
        	totalTxs uint64,
        ) Inflation

        func (Inflation) GetAmount

        func (o Inflation) GetAmount() common.Amount

        func (Inflation) HasFee

        func (o Inflation) HasFee() bool

        func (Inflation) IsWellFormed

        func (o Inflation) IsWellFormed(common.Config) (err error)

        func (Inflation) TargetAddress

        func (o Inflation) TargetAddress() string

        type InflationPF

        type InflationPF struct {
        	FundingAddress string        `json:"funding_address"`
        	Amount         common.Amount `json:"amount"`
        	VotingResult   string        `json:"voting-result"`
        }

        func NewInflationPF

        func NewInflationPF(
        	fundingAddress string,
        	amount common.Amount,
        	votingResult string,
        ) InflationPF

        func (InflationPF) GetAmount

        func (o InflationPF) GetAmount() common.Amount

        func (InflationPF) HasFee

        func (o InflationPF) HasFee() bool

        func (InflationPF) IsWellFormed

        func (o InflationPF) IsWellFormed(common.Config) (err error)

        type Operation

        type Operation struct {
        	H Header
        	B Body
        }

        func MakeTestPayment

        func MakeTestPayment(amount int) Operation

        func MakeTestPaymentTo

        func MakeTestPaymentTo(amount int, address string) Operation

        func NewOperation

        func NewOperation(opb Body) (op Operation, err error)

        func (*Operation) DecodeRLP

        func (op *Operation) DecodeRLP(s *common.RLPStream) error

          Implement `common.Decoder`

          func (Operation) EncodeRLP

          func (op Operation) EncodeRLP(w io.Writer) error

            Implement `common.Encoder` The implementation MUST use value type, not pointer

            func (Operation) HasFee

            func (o Operation) HasFee() bool

            func (Operation) IsWellFormed

            func (o Operation) IsWellFormed(conf common.Config) (err error)

            func (Operation) String

            func (o Operation) String() string

            func (*Operation) UnmarshalJSON

            func (o *Operation) UnmarshalJSON(b []byte) (err error)

            type OperationType

            type OperationType byte
            const (
            	TypeCreateAccount OperationType = iota
            	TypePayment
            	TypeCongressVoting
            	TypeCongressVotingResult
            	TypeCollectTxFee
            	TypeInflation
            	TypeUnfreezingRequest
            	TypeInflationPF
            )

            func (OperationType) MarshalText

            func (ot OperationType) MarshalText() (text []byte, err error)

              Implement encoding.TextMarshaler Also used in the API to avoid breaking clients

              func (OperationType) String

              func (ot OperationType) String() string

                Implement `fmt.Stringer`

                func (*OperationType) UnmarshalText

                func (ot *OperationType) UnmarshalText(text []byte) (err error)

                  Implement encoding.TextUnmarshaler

                  type Payable

                  type Payable interface {
                  	Body
                  	TargetAddress() string
                  	GetAmount() common.Amount
                  }

                  type Payment

                  type Payment struct {
                  	Target string        `json:"target"`
                  	Amount common.Amount `json:"amount"`
                  }

                  func NewPayment

                  func NewPayment(target string, amount common.Amount) Payment

                  func (Payment) GetAmount

                  func (o Payment) GetAmount() common.Amount

                  func (Payment) HasFee

                  func (o Payment) HasFee() bool

                  func (Payment) IsWellFormed

                  func (o Payment) IsWellFormed(common.Config) (err error)

                    Implement transaction/operation : IsWellFormed

                    func (Payment) TargetAddress

                    func (o Payment) TargetAddress() string

                    type Targetable

                    type Targetable interface {
                    	TargetAddress() string
                    }

                    type UnfreezeRequest

                    type UnfreezeRequest struct{}

                    func NewUnfreezeRequest

                    func NewUnfreezeRequest() UnfreezeRequest

                    func (UnfreezeRequest) HasFee

                    func (o UnfreezeRequest) HasFee() bool

                    func (UnfreezeRequest) IsWellFormed

                    func (o UnfreezeRequest) IsWellFormed(common.Config) (err error)