generateblock

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 5 Imported by: 0

README

generate-block-for-testing

This application is used to perform block generation in a testing network for the bitcoin or the liquid network.

function

  • generatetoaddress
    • use address
    • (in the future) generate address by bip32
    • (in the future) show the generated block's hash.
  • generate block for dynamic federation (liquid network)
    • set fedpeg script
    • set pak entry
    • (in the future) block sign
    • (in the future) maximum witness size
    • (in the future) show the generated block's hash.

usage

command-line argument
Usage: generateblock.exe [--host HOST] [--fedpegscript FEDPEGSCRIPT] [--pak PAK] [--network NETWORK] [--address ADDRESS] [--rpcuserid RPCUSERID] [--rpcpassword RPCPASSWORD] [--logging]

Options:
  --host HOST            connection host & port
  --fedpegscript FEDPEGSCRIPT, -s FEDPEGSCRIPT
                         fedpeg script on dynafed
  --pak PAK, -p PAK      pak entries
  --network NETWORK, -n NETWORK
                         network. (bitcoin:mainnet/testnet/regtest, liquid:liquidv1/liquidregtest/elementsregtest)
  --address ADDRESS, -a ADDRESS
                         bitcoin address for generatetoaddress
  --rpcuserid RPCUSERID
                         connection rpc userID
  --rpcpassword RPCPASSWORD
                         connection rpc password
  --logging, -l          log output
  --help, -h             display this help and exit
environment variable
  • GENERATE_BLOCK_CONNECTION_HOST: host & port.
  • GENERATE_BLOCK_CONNECTION_NETWORK: network type.
    • bitcoin: mainnet, testnet, regtest
    • liquid network: liquidv1, liquidregtest, (elementsregtest)
  • CONNECTION_PRC_USERID: connection rpc userID
  • CONNECTION_PRC_PASSWORD: connection rpc password
  • (for generatetoaddress)
    • GENERATE_BLOCK_GENERATETOADDRESS: bitcoin address
  • (liquid network parameter)
    • DYNAFED_FEDPEG_SCRIPT: fedpeg script.
    • DYNAFED_PAK: pak entry. To set multiple items, separate them with commas.

If both environment variable and command-line argument are set, the value set for command-line argument will take precedence.

example

bitcoin:

generateblock -l --host localhost:18443 --rpcuserid bitcoinrpc --rpcpassword password -n regtest -a bcrt1qpaujknvwumkwplvpdlh6gtsv7hrl60a37fc9tx

liquid network:

generateblock -l --host localhost:18447 --rpcuserid elementsrpc --rpcpassword password -n elementsregtest -s 5121024241bff4d20f2e616bef2f6e5c25145c068d45a78da3ddba433b3101bbe9a37d51ae -p 02b6991705d4b343ba192c2d1b10e7b8785202f51679f26a1f2cdbe9c069f8dceb024fb0908ea9263bedb5327da23ff914ce1883f851337d71b3ca09b32701003d05 -p 030e07d4f657c0c169e04fac5d5a8096adb099874834be59ad1e681e22d952ccda0214156e4ae9168289b4d0c034da94025121d33ad8643663454885032d77640e3d

build

go build ./cmd/generateblock/
make build
format
make format

use library

import gb "github.com/cryptogarageinc/generate-block-for-testing"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBlock

func GenerateBlock(
	ctx context.Context,
	nodeInfo *Connection,
	network string,
	address string,
	generateCount uint,
) error

func GenerateElementsDynafedBlock

func GenerateElementsDynafedBlock(
	ctx context.Context,
	nodeInfo *Connection,
	network string,
	fedpegScript string,
	pakEntries []string,
	generateCount uint,
) error

Types

type Connection

type Connection struct {
	Host        string
	RpcUserID   string
	RpcPassword string
}

type Generator added in v0.0.5

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

func NewGenerator added in v0.0.5

func NewGenerator(
	nodeInfo *Connection,
	network string,
) *Generator

func (*Generator) GenerateBlock added in v0.0.5

func (g *Generator) GenerateBlock(
	ctx context.Context,
	address string,
	generateCount uint,
) error

func (*Generator) GenerateElementsDynafedBlock added in v0.0.5

func (g *Generator) GenerateElementsDynafedBlock(
	ctx context.Context,
	fedpegScript string,
	pakEntries []string,
	generateCount uint,
) error

func (*Generator) WithCheckInitialBlockDownload added in v0.0.7

func (g *Generator) WithCheckInitialBlockDownload(hasCheckInitialBlkDl bool) *Generator

func (*Generator) WithIgnoreEmptyMempool added in v0.0.5

func (g *Generator) WithIgnoreEmptyMempool(ignoreEmptyMempool bool) *Generator

Jump to

Keyboard shortcuts

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