node

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2020 The the-blockchain-bar Authors This file is part of the the-blockchain-bar library.

The the-blockchain-bar library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The the-blockchain-bar library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Copyright 2020 The the-blockchain-bar Authors This file is part of the the-blockchain-bar library.

The the-blockchain-bar library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The the-blockchain-bar library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Copyright 2020 The the-blockchain-bar Authors This file is part of the the-blockchain-bar library.

The the-blockchain-bar library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The the-blockchain-bar library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Copyright 2020 The the-blockchain-bar Authors This file is part of the the-blockchain-bar library.

The the-blockchain-bar library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The the-blockchain-bar library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Copyright 2020 The the-blockchain-bar Authors This file is part of the the-blockchain-bar library.

The the-blockchain-bar library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The the-blockchain-bar library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const DefaultBootstrapAcc = "0x50543e830590fD03a0301fAA0164d731f0E2ff7D"

The Web3Coach's Genesis account with 1M TBB tokens

View Source
const DefaultBootstrapIp = "node.tbb.web3.coach"
View Source
const DefaultIP = "127.0.0.1"
View Source
const DefaultMiner = "0x0000000000000000000000000000000000000000"
View Source
const DefaultMiningDifficulty = 2
View Source
const HttpSSLPort = 443

Variables

This section is empty.

Functions

func Mine

Types

type AddPeerRes

type AddPeerRes struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

type BalanceReq added in v0.0.1

type BalanceReq struct {
	Account string `json:"account"`
}

type BalanceRes added in v0.0.1

type BalanceRes struct {
	Balance uint `json:"balance"`
}

type BalancesRes

type BalancesRes struct {
	Hash     database.Hash           `json:"block_hash"`
	Balances map[common.Address]uint `json:"balances"`
}

type ErrRes

type ErrRes struct {
	Error string `json:"error"`
}

type NextNonceReq

type NextNonceReq struct {
	Account string `json:"account"`
}

type NextNonceRes

type NextNonceRes struct {
	Nonce uint `json:"nonce"`
}

type Node

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

func New

func New(dataDir string, ip string, port uint64, acc common.Address, bootstrap PeerNode, version string, miningDifficulty uint64) *Node

func (*Node) AddPeer

func (n *Node) AddPeer(peer PeerNode)

func (*Node) AddPendingTX

func (n *Node) AddPendingTX(tx database.SignedTx, fromPeer PeerNode) error

func (*Node) ChangeMiningDifficulty

func (n *Node) ChangeMiningDifficulty(newDifficulty uint64)

func (*Node) IsKnownPeer

func (n *Node) IsKnownPeer(peer PeerNode) bool

func (*Node) LatestBlockHash

func (n *Node) LatestBlockHash() database.Hash

func (*Node) RemovePeer

func (n *Node) RemovePeer(peer PeerNode)

func (*Node) Run

func (n *Node) Run(ctx context.Context, isSSLDisabled bool, sslEmail string) error

type PeerNode

type PeerNode struct {
	IP          string         `json:"ip"`
	Port        uint64         `json:"port"`
	IsBootstrap bool           `json:"is_bootstrap"`
	Account     common.Address `json:"account"`
	NodeVersion string         `json:"node_version"`
	// contains filtered or unexported fields
}

func NewPeerNode

func NewPeerNode(ip string, port uint64, isBootstrap bool, acc common.Address, connected bool, version string) PeerNode

func (PeerNode) ApiProtocol

func (pn PeerNode) ApiProtocol() string

func (PeerNode) TcpAddress

func (pn PeerNode) TcpAddress() string

type PendingBlock

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

func NewPendingBlock

func NewPendingBlock(parent database.Hash, number uint64, miner common.Address, difficulty uint64, txs []database.SignedTx) PendingBlock

type StatusRes

type StatusRes struct {
	Hash        database.Hash       `json:"block_hash"`
	Number      uint64              `json:"block_number"`
	KnownPeers  map[string]PeerNode `json:"peers_known"`
	PendingTXs  []database.SignedTx `json:"pending_txs"`
	NodeVersion string              `json:"node_version"`
	Account     common.Address      `json:"account"`
}

type SyncRes

type SyncRes struct {
	Blocks []database.BlockFS `json:"blocks"`
}

type TxAddReq

type TxAddReq struct {
	RawTx string `json:"tx"`
}

type TxAddRes

type TxAddRes struct {
	Success bool `json:"success"`
}

Jump to

Keyboard shortcuts

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