rpc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcServer

type GrpcServer struct {
	pb.UnimplementedBlockchainServiceServer
	pb.UnimplementedNodeServiceServer
	pb.UnimplementedWalletServiceServer
	// contains filtered or unexported fields
}

GrpcServer is the gRPC server implementation. It holds all the objects necessary to serve the RPCs and implements the ilxdrpc.proto interface.

func NewGrpcServer

func NewGrpcServer(cfg *GrpcServerConfig) *GrpcServer

NewGrpcServer returns a new GrpcServer which has not yet be started.

func (*GrpcServer) AddPeer

func (s *GrpcServer) AddPeer(ctx context.Context, req *pb.AddPeerRequest) (*pb.AddPeerResponse, error)

AddPeer attempts to connect to the provided peer

func (*GrpcServer) BlockPeer

func (s *GrpcServer) BlockPeer(ctx context.Context, req *pb.BlockPeerRequest) (*pb.BlockPeerResponse, error)

BlockPeer blocks the given peer for the provided time period

func (*GrpcServer) ChangeWalletPassphrase

ChangeWalletPassphrase changes the passphrase used to encrypt the wallet private keys

func (*GrpcServer) Close

func (s *GrpcServer) Close()

func (*GrpcServer) CreateMultiSignature

CreateMultiSignature generates and returns a signature for use when proving a multisig transaction

func (*GrpcServer) CreateMultisigAddress

CreateMultisigAddress generates a new multisig address using the provided public keys

Note this address is *not* imported. You will need to call `ImportAddress` if you want to watch it.

func (*GrpcServer) CreateMultisigSpendKeypair

CreateMultisigSpendKeypair generates a spend keypair for use in a multisig address

func (*GrpcServer) CreateMultisigViewKeypair

CreateMultisigViewKeypair generates a view keypair for use in a multisig address

func (*GrpcServer) CreateRawStakeTransaction

CreateRawStakeTransaction creates a new, unsigned (unproven) stake transaction using the given parameters

func (*GrpcServer) CreateRawTransaction

CreateRawTransaction creates a new, unsigned (unproven) transaction using the given parameters

func (*GrpcServer) DeletePrivateKeys

DeletePrivateKeys deletes the wallet's private keys and seed from disk essentially turning the wallet into a watch-only wallet. It will still record incoming transactions but cannot spend them.

**Requires wallet to be unlocked**

func (*GrpcServer) GetAccumulatorCheckpoint

GetAccumulatorCheckpoint returns the accumulator at the requested height.

func (*GrpcServer) GetAddress

GetAddress returns the most recent address of the wallet.

func (*GrpcServer) GetAddressInfo

GetAddressInfo returns additional metadata about an address.

func (*GrpcServer) GetAddresses

GetAddresses returns all the addresses create by the wallet.

func (*GrpcServer) GetBalance

GetBalance returns the combined balance of all addresses in the wallet

func (*GrpcServer) GetBlock

func (s *GrpcServer) GetBlock(ctx context.Context, req *pb.GetBlockRequest) (*pb.GetBlockResponse, error)

GetBlock returns the detailed data for a block.

func (*GrpcServer) GetBlockInfo

GetBlockInfo returns a BlockHeader plus some extra metadata.

func (*GrpcServer) GetBlockSizeSoftLimit

GetBlockSizeSoftLimit returns the node's current blocksize soft limit.

func (*GrpcServer) GetBlockchainInfo

GetBlockchainInfo returns data about the blockchain including the most recent block hash and height.

func (*GrpcServer) GetCompressedBlock

GetCompressedBlock returns a block that is stripped down to just the outputs.

func (*GrpcServer) GetCompressedBlocks

GetCompressedBlocks returns a batch of CompressedBlocks according to the request parameters.

func (*GrpcServer) GetHeaders

GetHeaders returns a batch of headers according to the request parameters.

func (*GrpcServer) GetHostInfo

GetHostInfo returns info about the libp2p host

func (*GrpcServer) GetMempool

GetMempool returns all the transactions in the mempool

func (*GrpcServer) GetMempoolInfo

GetMempoolInfo returns the state of the current mempool

func (*GrpcServer) GetMerkleProof

GetMerkleProof returns a Merkle (SPV) proof for a specific transaction in the provided block.

func (*GrpcServer) GetMinFeePerKilobyte

GetMinFeePerKilobyte returns the node's current minimum transaction fee needed to relay transactions and admit them into the mempool.

func (*GrpcServer) GetMinStake

GetMinStake returns the node's current minimum stake policy.

func (*GrpcServer) GetNetworkKey

GetNetworkKey returns the node's network private key

func (*GrpcServer) GetNewAddress

GetNewAddress generates a new address and returns it. Both a new spend key and view key will be derived from the mnemonic seed.

func (*GrpcServer) GetPeers

func (s *GrpcServer) GetPeers(ctx context.Context, req *pb.GetPeersRequest) (*pb.GetPeersResponse, error)

GetPeers returns a list of peers that this node is connected to

func (*GrpcServer) GetPrivateKey

GetPrivateKey returns the serialized spend and view keys for the given address

**Requires wallet to be unlocked**

func (*GrpcServer) GetTransaction

GetTransaction returns the transaction for the given transaction ID.

func (*GrpcServer) GetTransactions

GetTransactions returns the list of transactions for the wallet

func (*GrpcServer) GetTreasuryWhitelist

GetTreasuryWhitelist returns the current treasury whitelist for the node.

func (*GrpcServer) GetUtxos

func (s *GrpcServer) GetUtxos(ctx context.Context, req *pb.GetUtxosRequest) (*pb.GetUtxosResponse, error)

GetUtxos returns a list of the wallet's current unspent transaction outputs (UTXOs)

func (*GrpcServer) GetValidator

GetValidator returns all the information about the given validator including number of staked coins.

func (*GrpcServer) GetValidatorSet

GetValidatorSet returns all the validators in the current validator set.

func (*GrpcServer) GetValidatorSetInfo

GetValidatorSetInfo returns information about the validator set.

func (*GrpcServer) GetWalletSeed

GetWalletSeed returns the mnemonic seed for the wallet. If the wallet seed has been deleted via the `DeletePrivateKeys` RPC an error will be returned.

**Requires wallet to be unlocked**

func (*GrpcServer) ImportAddress

ImportAddress imports a watch address into the wallet.

func (*GrpcServer) ProveMultisig

ProveMultisig creates a proof for a transaction with a multisig input

func (*GrpcServer) ProveRawTransaction

ProveRawTransaction creates the zk-proof for the transaction. Assuming there are no errors, this transaction should be ready for broadcast.

func (*GrpcServer) RecomputeChainState

RecomputeChainState deletes the accumulator, validator set, and nullifier set and rebuilds them by loading and re-processing all blocks from genesis.

func (*GrpcServer) ReconsiderBlock

ReconsiderBlock tries to reprocess the given block

func (*GrpcServer) SetAutoStakeRewards

SetAutoStakeRewards make it such that any validator rewards that are earned are automatically staked

**Requires wallet to be unlocked**

func (*GrpcServer) SetBlockSizeSoftLimit

SetBlockSizeSoftLimit sets the node's blocksize soft limit policy.

func (*GrpcServer) SetLogLevel

SetLogLevel changes the logging level of the node

func (*GrpcServer) SetMinFeePerKilobyte

SetMinFeePerKilobyte sets the node's fee policy

func (*GrpcServer) SetMinStake

SetMinStake sets the node's minimum stake policy

func (*GrpcServer) SetWalletPassphrase

SetWalletPassphrase encrypts the wallet for the first time

func (*GrpcServer) Spend

func (s *GrpcServer) Spend(ctx context.Context, req *pb.SpendRequest) (*pb.SpendResponse, error)

Spend sends coins from the wallet according to the provided parameters

**Requires wallet to be unlocked**

func (*GrpcServer) Stake

func (s *GrpcServer) Stake(ctx context.Context, req *pb.StakeRequest) (*pb.StakeResponse, error)

Stake stakes the selected wallet UTXOs and turns the node into a validator

**Requires wallet to be unlocked**

func (*GrpcServer) SubmitTransaction

SubmitTransaction validates a transaction and submits it to the network. An error will be returned if it fails validation.

func (*GrpcServer) SubscribeBlocks

SubscribeBlocks returns a stream of notifications when new blocks are finalized and connected to the chain.

func (*GrpcServer) UnblockPeer

UnblockPeer removes a peer from the block list

func (*GrpcServer) UpdateTreasuryWhitelist

UpdateTreasuryWhitelist adds or removes a transaction to from the treasury whitelist

func (*GrpcServer) WalletLock

WalletLock encrypts the wallet's private keys

func (*GrpcServer) WalletUnlock

WalletUnlock decrypts the wallet seed and holds it in memory for the specified period of time

type GrpcServerConfig

type GrpcServerConfig struct {
	Server     *grpc.Server
	HTTPServer *http.Server

	Chain                *blockchain.Blockchain
	Network              *net.Network
	Wallet               *walletlib.Wallet
	Policy               *policy.Policy
	BroadcastTxFunc      func(tx *transactions.Transaction) error
	SetLogLevelFunc      func(level zapcore.Level)
	ReindexChainFunc     func() error
	RequestBlockFunc     func(blockID types.ID, remotePeer peer.ID)
	AutoStakeFunc        func(bool) error
	NetworkKeyFunc       func() (crypto.PrivKey, error)
	ChainParams          *params.NetworkParams
	Ds                   repo.Datastore
	TxMemPool            *mempool.Mempool
	DisableNodeService   bool
	DisableWalletService bool

	TxIndex *indexers.TxIndex
}

GrpcServerConfig hols the various objects needed by the GrpcServer to perform its functions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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