app

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: AGPL-3.0 Imports: 30 Imported by: 0

README

Enigmachain

Install

git clone https://github.com/enigmampc/Enigmachain
cd Enigmachain
go mod tidy
make install # installs engd and engcli

Developers Quick Start

engcli config chain-id enigma-testnet-0 # now we won't need to type --chain-id enigma-testnet-0 every time
engcli config output json
engcli config indent true
engcli config trust-node true # true if you trust the full-node you are connecting to, false otherwise

engd init banana --chain-id enigma-testnet-0 # banana==moniker==user-agent of this node
perl -i -pe 's/"stake"/"uscrt"/g' ~/.engd/config/genesis.json # change the default staking denom from stake to uscrt

engcli keys add a
engcli keys add b

engd add-genesis-account $(engcli keys show -a a) 1000000000000uscrt # 1 SCRT == 10^6 uSCRT
engd add-genesis-account $(engcli keys show -a b) 2000000000000uscrt # 1 SCRT == 10^6 uSCRT

engd validate-genesis # make sure genesis file is correct

# `engd export` to send genesis.json to validators

engd gentx --name a --amount 1000000uscrt # generate a genesis transaction - this makes a a validator on genesis which stakes 1000000uscrt (1 SCRT)

engd collect-gentxs # input the genTx into the genesis file, so that the chain is aware of the validators

engd validate-genesis # make sure genesis file is correct

# `engd export` to send genesis.json to validators

engd start --pruning nothing # starts a node

Delegation & Rewards

b is a delegator of a

Now a is a validator with 1 SCRT (1000000uscrt) staked.
This is how b can delegate 0.00001 SCRT to a:

engcli tx staking delegate $(engcli keys show a --bech=val -a) 10uscrt --from b

This is how to see b's rewards from delegating to a:

engcli q distribution rewards $(engcli keys show -a b)

This is how b can withdraw its rewards:

engcli tx distribution withdraw-rewards $(engcli keys show --bech=val -a a) --from b

a is a validator and has b as a delegator

a was set up as a validator from genesis.
This is how to see a's rewards from being a validator:

engcli q distribution rewards $(engcli keys show -a a)

This is how to see a's commissions from being a validator:

engcli q distribution commission $(engcli keys show -a --bech=val a)

This is how a can withdraw its rewards + its commissions from being a validator:

engcli tx distribution withdraw-rewards $(engcli keys show --bech=val -a a) --from a --commission

(To withdraw only rewards omit the --commission)

Run your own node (after genesis)

First, init your environment:

endg init [moniker] --chain-id enigma-testnet-0

Now you need a valid running node to send you their genesis.json file (usually at ~/.engd/config/genesis.json).
Once you have the valid genesis.json, put it in ~/.engd/config/genesis.json (overwrite the existing file if needed).
Next, edit your ~/.engd/config/config.toml, set the persistent_peers:

persistent_peers = "[id]@[peer_node_ip]:26656" # `id` can be aquired from your first peer by running `engcli status`

That't it! Once you're done, just run:

engd start --pruning nothing

You will see you local bloackchain replica starting to catch up with your peer's one.

Congrats, you are now up and running!

Note: you can also run engd start --pruning nothing --p2p.persistent_peers [id]@[peer_node_ip]:26656 instead of editing the conf file.
Note: If anything goes wrong, delete the ~/.engd and ~/.engcli dirs and start again.

Join as a new Validator

After you have a private node up and running, run the following command:

engcli tx staking create-validator \
  --amount=<num of coins> \ # This is the amount of coins you put at stake. i.e. 100000uscrt
  --pubkey=$(engd tendermint show-validator) \
  --moniker="<name-of-your-moniker>" \
  --chain-id=<chain-id> \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --gas="auto" \
  --gas-prices="0.025uscrt" \
  --from=<name or address> # Name or address of your existing account

To check if you got added to the validator-set by running:

engcli q tendermint-validator-set

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultCLIHome default home directories for the application CLI
	DefaultCLIHome = os.ExpandEnv("$HOME/.engcli")

	// DefaultNodeHome sets the folder where the applcation data and configuration will be stored
	DefaultNodeHome = os.ExpandEnv("$HOME/.engd")

	// ModuleBasics The module BasicManager is in charge of setting up basic,
	// non-dependant module elements, such as codec registration
	// and genesis verification.
	ModuleBasics = module.NewBasicManager(
		genutil.AppModuleBasic{},
		auth.AppModuleBasic{},
		bank.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distr.AppModuleBasic{},
		gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler, upgradeclient.ProposalHandler),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		supply.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
	)
)

Functions

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a mapping of the application's module account permissions.

func MakeCodec

func MakeCodec() *codec.Codec

MakeCodec creates the application codec. The codec is sealed before it is returned.

func NewDefaultGenesisState

func NewDefaultGenesisState() simapp.GenesisState

NewDefaultGenesisState return a default genesis state

Types

type EnigmaChainApp

type EnigmaChainApp struct {
	*bam.BaseApp
	// contains filtered or unexported fields
}

EnigmaChainApp extended ABCI application

func NewEnigmaChainApp

func NewEnigmaChainApp(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	invCheckPeriod uint,
	skipUpgradeHeights map[int64]bool,
	baseAppOptions ...func(*bam.BaseApp),
) *EnigmaChainApp

NewEnigmaChainApp is a constructor function for enigmaChainApp

func (*EnigmaChainApp) BeginBlocker

BeginBlocker application updates every begin block

func (*EnigmaChainApp) Codec

func (app *EnigmaChainApp) Codec() *codec.Codec

Codec returns the application's sealed codec.

func (*EnigmaChainApp) EndBlocker

EndBlocker application updates every end block

func (*EnigmaChainApp) ExportAppStateAndValidators

func (app *EnigmaChainApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string,
) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)

func (*EnigmaChainApp) InitChainer

InitChainer application update at chain initialization

func (*EnigmaChainApp) LoadHeight

func (app *EnigmaChainApp) LoadHeight(height int64) error

LoadHeight loads a particular height

func (*EnigmaChainApp) ModuleAccountAddrs

func (app *EnigmaChainApp) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func (*EnigmaChainApp) Name

func (app *EnigmaChainApp) Name() string

Name returns the name of the App

func (*EnigmaChainApp) SimulationManager

func (app *EnigmaChainApp) SimulationManager() *module.SimulationManager

SimulationManager implements the SimulationApp interface

Jump to

Keyboard shortcuts

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