loom

package module
v0.0.0-...-e0cfe8b Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-3-Clause Imports: 17 Imported by: 56

README

go-loom Build Status

Go package for building Go Smart Contracts for the Loom SDK

This package is also used for building Clients to DAppChains in the Loom SDK.

The code that runs the actual DAppChain(sidechain) is in a different repository.

Requirements

  • Go 1.9+
  • Mac or Linux (Windows support coming in June)

Installation

go get github.com/loomnetwork/go-loom

Examples

The example smart contracts can be built with:

make deps
make

If you want the ethereum examples, use

make evm

instead of make. However you need the go-ethereum package.

To run the blockchain with the Samples

Note Loom binary is only available to beta testers right now

# init the blockchain
./loom init
# Copy over example genesis
cp genesis.example.json genesis.json
# run the node
./loom run

Development

  1. go get or clone the repo into your desired GOPATH.
  2. Install deps
    make deps
    
Generating protobufs
make proto
running tests
make test

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllowDebug = kitlevel.AllowDebug
	AllowInfo  = kitlevel.AllowInfo
	AllowWarn  = kitlevel.AllowWarn
	AllowError = kitlevel.AllowError
	Allow      = func(level string) kitlevel.Option {
		switch level {
		case "debug":
			return AllowDebug()
		case "info":
			return AllowInfo()
		case "warn":
			return AllowWarn()
		case "error":
			return AllowError()
		default:
			return nil
		}
	}
)
View Source
var (
	ErrInvalidAddress = errors.New("invalid address")
)

Functions

func BigZeroPB

func BigZeroPB() *types.BigUInt

func DataPrefix

func DataPrefix(addr Address) []byte

func MakeFileLoggerWriter

func MakeFileLoggerWriter(loomLogLevel, dest string) io.Writer

func PermPrefix

func PermPrefix(addr Address) []byte

func TextKey

func TextKey(addr Address) []byte

Types

type Address

type Address struct {
	ChainID string
	Local   LocalAddress
}

func MustParseAddress

func MustParseAddress(s string) Address

func ParseAddress

func ParseAddress(s string) (Address, error)

ParseAddress parses an address generated from String()

func RootAddress

func RootAddress(chainID string) Address

func UnmarshalAddressPB

func UnmarshalAddressPB(pb *types.Address) Address

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) Compare

func (a Address) Compare(other Address) int

func (Address) IsEmpty

func (a Address) IsEmpty() bool

func (Address) MarshalPB

func (a Address) MarshalPB() *types.Address

func (Address) String

func (a Address) String() string

type BigUInt

type BigUInt = common.BigUInt

func NewBigUInt

func NewBigUInt(i *big.Int) *BigUInt

NewBigUint creates a biguint from a bigint

func NewBigUIntFromInt

func NewBigUIntFromInt(i int64) *BigUInt

NewBigUintFromInt creates a biguint from a int64

type BlockHeader

type BlockHeader = types.BlockHeader

type LocalAddress

type LocalAddress = common.LocalAddress

func LocalAddressFromHexString

func LocalAddressFromHexString(hexAddr string) (LocalAddress, error)

func LocalAddressFromPublicKey

func LocalAddressFromPublicKey(pubKey []byte) LocalAddress

func LocalAddressFromPublicKeyV2

func LocalAddressFromPublicKeyV2(pubKey []byte) LocalAddress

recent versions of Tendermint > 0.22.0

type Logger

type Logger struct {
	kitlog.Logger
}

func MakeLoomLogger

func MakeLoomLogger(logLevel string, w io.Writer, tr func(w io.Writer) kitlog.Logger) *Logger

func NewFilter

func NewFilter(next kitlog.Logger, options ...kitlevel.Option) *Logger

func NewLoomLogger

func NewLoomLogger(loomLogLevel, dest string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, keyvals ...interface{})

Debug logs a message at level Debug.

func (*Logger) Error

func (l *Logger) Error(msg string, keyvals ...interface{})

Error logs a message at level Error.

func (*Logger) Info

func (l *Logger) Info(msg string, keyvals ...interface{})

Info logs a message at level Info.

func (*Logger) Warn

func (l *Logger) Warn(msg string, keyvals ...interface{})

Warn logs a message at level Debug.

type Validator

type Validator = types.Validator

type ValidatorSet

type ValidatorSet map[string]*Validator

func NewValidatorSet

func NewValidatorSet(vals ...*Validator) ValidatorSet

func (ValidatorSet) Get

func (vs ValidatorSet) Get(pubKey []byte) *Validator

func (ValidatorSet) Set

func (vs ValidatorSet) Set(v *Validator)

func (ValidatorSet) Slice

func (vs ValidatorSet) Slice() []*Validator

Jump to

Keyboard shortcuts

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