observer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

README

Observer

One of the 2/(holder, signer, observer), and the observer is the last backup to sign a transaction and should never be used before that point.

Observer is a single user, belongs to the keeper MTG members. And it must be deployed independent of keeper and signer.

  1. Generate observer public keys to keeper MTG.
  2. Scan Bitcoin node to send deposit information to keeper MTG.
  3. Estimate Bitcoin transaction fee to keeper MTG, it's better to use 10x the real fee to ensure confirmation.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FAVICON []byte
View Source
var FLOW []byte
View Source
var GUIDE = `` /* 2153-byte string literal not displayed */
View Source
var SCHEMA string

Functions

This section is empty.

Types

type Asset

type Asset struct {
	AssetId   string
	MixinId   string
	AssetKey  string
	Symbol    string
	Name      string
	Decimals  uint32
	Chain     byte
	CreatedAt time.Time
}

type Configuration

type Configuration struct {
	StoreDir           string `toml:"store-dir"`
	PrivateKey         string `toml:"private-key"`
	Timestamp          int64  `toml:"timestamp"`
	KeeperStoreDir     string `toml:"keeper-store-dir"`
	KeeperPublicKey    string `toml:"keeper-public-key"`
	AssetId            string `toml:"asset-id"`
	PriceAssetId       string `toml:"price-asset-id"`
	PriceAmount        string `toml:"price-amount"`
	TransactionMinimum string `toml:"transaction-minimum"`
	MixinMessengerAPI  string `toml:"mixin-messenger-api"`
	MixinRPC           string `toml:"mixin-rpc"`
	BitcoinRPC         string `toml:"bitcoin-rpc"`
	LitecoinRPC        string `toml:"litecoin-rpc"`
	EthereumRPC        string `toml:"ethereum-rpc"`
	EthereumKey        string `toml:"ethereum-key"`
	MVMRPC             string `toml:"mvm-rpc"`
	MVMKey             string `toml:"mvm-key"`
	App                struct {
		ClientId   string `toml:"client-id"`
		SessionId  string `toml:"session-id"`
		PrivateKey string `toml:"private-key"`
		PinToken   string `toml:"pin-token"`
		PIN        string `toml:"pin"`
	} `toml:"app"`
}

type Deposit

type Deposit struct {
	TransactionHash string
	OutputIndex     int64
	AssetId         string
	Amount          string
	Receiver        string
	Sender          string
	State           int
	Chain           byte
	Holder          string
	Category        byte
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(db *SQLite3Store, kd *store.SQLite3Store, conf *Configuration, keeper *mtg.Configuration, mixin *mixin.Client) *Node

func (*Node) Boot

func (node *Node) Boot(ctx context.Context)

func (*Node) StartHTTP

func (node *Node) StartHTTP(readme string)

type SQLite3Store

type SQLite3Store struct {
	// contains filtered or unexported fields
}

func OpenSQLite3Store

func OpenSQLite3Store(path string) (*SQLite3Store, error)

func (*SQLite3Store) AddTransactionPartials

func (s *SQLite3Store) AddTransactionPartials(ctx context.Context, transactionHash string, raw, sigBase64 string) error

func (*SQLite3Store) CheckAccountProposed

func (s *SQLite3Store) CheckAccountProposed(ctx context.Context, addr string) (bool, error)

func (*SQLite3Store) Close

func (s *SQLite3Store) Close() error

func (*SQLite3Store) ConfirmPendingDeposit

func (s *SQLite3Store) ConfirmPendingDeposit(ctx context.Context, transactionHash string, outputIndex int64) error

func (*SQLite3Store) DeleteObserverKey

func (s *SQLite3Store) DeleteObserverKey(ctx context.Context, pub string) error

func (*SQLite3Store) FinishTransactionSignatures

func (s *SQLite3Store) FinishTransactionSignatures(ctx context.Context, transactionHash string, raw string) error

func (*SQLite3Store) ListDeposits

func (s *SQLite3Store) ListDeposits(ctx context.Context, chain int, holder string, state int, offset int64) ([]*Deposit, error)

func (*SQLite3Store) ListPendingTransactionApprovals

func (s *SQLite3Store) ListPendingTransactionApprovals(ctx context.Context, chain byte) ([]*Transaction, error)

func (*SQLite3Store) ReadAccountantKey

func (s *SQLite3Store) ReadAccountantKey(ctx context.Context, pub string, crv byte) (string, error)

func (*SQLite3Store) ReadAssetMeta

func (s *SQLite3Store) ReadAssetMeta(ctx context.Context, id string) (*Asset, error)

func (*SQLite3Store) ReadObserverKey

func (s *SQLite3Store) ReadObserverKey(ctx context.Context, crv byte) (string, error)

func (*SQLite3Store) ReadProperty

func (s *SQLite3Store) ReadProperty(ctx context.Context, k string) (string, error)

func (*SQLite3Store) ReadTransactionApproval

func (s *SQLite3Store) ReadTransactionApproval(ctx context.Context, hash string) (*Transaction, error)

func (*SQLite3Store) RevokeTransactionApproval

func (s *SQLite3Store) RevokeTransactionApproval(ctx context.Context, transactionHash string, sigBase64 string) error

func (*SQLite3Store) UpdateTransactionApprovalPending

func (s *SQLite3Store) UpdateTransactionApprovalPending(ctx context.Context, transactionHash string) error

func (*SQLite3Store) UpdateTransactionApprovalRequestTime

func (s *SQLite3Store) UpdateTransactionApprovalRequestTime(ctx context.Context, transactionHash string) error

func (*SQLite3Store) WriteAccountProposalIfNotExists

func (s *SQLite3Store) WriteAccountProposalIfNotExists(ctx context.Context, address string, createdAt time.Time) error

func (*SQLite3Store) WriteAccountantKey

func (s *SQLite3Store) WriteAccountantKey(ctx context.Context, crv byte, pub, priv string) error

func (*SQLite3Store) WriteAssetMeta

func (s *SQLite3Store) WriteAssetMeta(ctx context.Context, asset *Asset) error

func (*SQLite3Store) WriteObserverKeys

func (s *SQLite3Store) WriteObserverKeys(ctx context.Context, crv byte, publics []string) error

func (*SQLite3Store) WritePendingDepositIfNotExists

func (s *SQLite3Store) WritePendingDepositIfNotExists(ctx context.Context, d *Deposit) error

func (*SQLite3Store) WriteProperty

func (s *SQLite3Store) WriteProperty(ctx context.Context, k, v string) error

func (*SQLite3Store) WriteTransactionApprovalIfNotExists

func (s *SQLite3Store) WriteTransactionApprovalIfNotExists(ctx context.Context, approval *Transaction) error

type Transaction

type Transaction struct {
	TransactionHash string
	RawTransaction  string
	Chain           byte
	Holder          string
	Signer          string
	Accountant      string
	Signature       string
	State           byte
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

func (*Transaction) Signers

func (t *Transaction) Signers() []string

Jump to

Keyboard shortcuts

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