testchain

package
v0.101.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ValidatorsCount = 4

ValidatorsCount returns the number of validators in the testchain.

Variables

This section is empty.

Functions

func CommitteeAddress

func CommitteeAddress() string

CommitteeAddress return committee address as string.

func CommitteeScriptHash

func CommitteeScriptHash() util.Uint160

CommitteeScriptHash returns committee address as Uint160.

func CommitteeSize

func CommitteeSize() int

CommitteeSize returns testchain committee size.

func CommitteeVerificationScript

func CommitteeVerificationScript() []byte

CommitteeVerificationScript returns script hash of the committee multisig address.

func IDToOrder

func IDToOrder(id int) int

IDToOrder returns node's order in privnet.

func MultisigAddress

func MultisigAddress() string

MultisigAddress return consensus address as string.

func MultisigScriptHash

func MultisigScriptHash() util.Uint160

MultisigScriptHash returns consensus address as Uint160.

func MultisigVerificationScript

func MultisigVerificationScript() []byte

MultisigVerificationScript returns script hash of the consensus multisig address.

func Network

func Network() netmode.Magic

Network returns testchain network's magic number.

func NewBlock

func NewBlock(t *testing.T, bc Ledger, offset uint32, primary uint32, txs ...*transaction.Transaction) *block.Block

NewBlock creates a new block for the given blockchain with the given offset (usually, 1), primary node index and transactions.

func NewDeployTx

func NewDeployTx(bc Ledger, name string, sender util.Uint160, r gio.Reader, confFile *string) (*transaction.Transaction, util.Uint160, []byte, error)

NewDeployTx returns a new deployment transaction for a contract with the source from r and a name equal to the filename without '.go' suffix.

func NewTransferFromOwner

func NewTransferFromOwner(bc Ledger, contractHash, to util.Uint160, amount int64,
	nonce, validUntil uint32) (*transaction.Transaction, error)

NewTransferFromOwner returns a transaction transferring funds from NEO and GAS owner.

func PrivateKey

func PrivateKey(i int) *keys.PrivateKey

PrivateKey returns the private key of node #i.

func PrivateKeyByID

func PrivateKeyByID(id int) *keys.PrivateKey

PrivateKeyByID returns private keys of a node with the specified id.

func Sign

func Sign(h hash.Hashable) []byte

Sign signs data by all consensus nodes and returns invocation script.

func SignCommittee

func SignCommittee(h hash.Hashable) []byte

SignCommittee signs data by a majority of committee members.

func SignTx

func SignTx(bc Ledger, txs ...*transaction.Transaction) error

SignTx signs the provided transactions with validator keys.

func SignTxCommittee added in v0.93.0

func SignTxCommittee(bc Ledger, txs ...*transaction.Transaction) error

SignTxCommittee signs transactions by committee.

func Size

func Size() int

Size returns testchain initial validators amount.

func WIF

func WIF(i int) string

WIF returns the unencrypted wif of the specified validator.

Types

type Ledger added in v0.99.1

type Ledger interface {
	BlockHeight() uint32
	FeePerByte() int64
	GetBaseExecFee() int64
	GetHeader(hash util.Uint256) (*block.Header, error)
	GetHeaderHash(uint32) util.Uint256
	HeaderHeight() uint32
	ManagementContractHash() util.Uint160
}

Ledger is an interface that abstracts the implementation of the blockchain.

Jump to

Keyboard shortcuts

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