Skip to content

Commit

Permalink
Updated documentation and fixed some typos and style
Browse files Browse the repository at this point in the history
  • Loading branch information
lemois-1337 committed Feb 22, 2024
1 parent d2d3ddd commit 9f16499
Show file tree
Hide file tree
Showing 23 changed files with 322 additions and 964 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ developers, users, and investors within the Cosmos ecosystem.

## Installation

### Install from binaries
### Install from Binaries

Pre-compiled binaries for Linux `x86_64` and `aarch64`, Windows `x64`
and macOS `x64` as universal binary can be downloaded at: [https://github.com/karlsen-network/karlsend/releases](https://github.com/karlsen-network/karlsend/releases)
Expand Down
99 changes: 50 additions & 49 deletions app/appmessage/README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
wire
====
# wire

[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](https://choosealicense.com/licenses/isc/)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/karlsen-network/karlsend/wire)
=======

Package wire implements the kaspa wire protocol.
Package wire implements the karlsen wire protocol.

## Kaspa Message Overview
## Karlsen Message Overview

The kaspa protocol consists of exchanging messages between peers. Each message
is preceded by a header which identifies information about it such as which
kaspa network it is a part of, its type, how big it is, and a checksum to
verify validity. All encoding and decoding of message headers is handled by this
package.
The karlsen protocol consists of exchanging messages between peers.
Each message is preceded by a header which identifies information
about it such as which karlsen network it is a part of, its type, how
big it is, and a checksum to verify validity. All encoding and
decoding of message headers is handled by this package.

To accomplish this, there is a generic interface for kaspa messages named
`Message` which allows messages of any type to be read, written, or passed
around through channels, functions, etc. In addition, concrete implementations
of most all kaspa messages are provided. All of the details of marshalling and
unmarshalling to and from the wire using kaspa encoding are handled so the
caller doesn't have to concern themselves with the specifics.
To accomplish this, there is a generic interface for karlsen messages
named `Message` which allows messages of any type to be read, written,
or passed around through channels, functions, etc. In addition,
concrete implementations of most all karlsen messages are provided.
All of the details of marshalling and unmarshalling to and from the
wire using karlsen encoding are handled so the caller doesn't have
to concern themselves with the specifics.

## Reading Messages Example

In order to unmarshal kaspa messages from the wire, use the `ReadMessage`
function. It accepts any `io.Reader`, but typically this will be a `net.Conn`
to a remote node running a kaspa peer. Example syntax is:
In order to unmarshal karlsen messages from the wire, use the
`ReadMessage` function. It accepts any `io.Reader`, but typically
this will be a `net.Conn` to a remote node running a karlsen peer.
Example syntax is:

```Go
// Use the most recent protocol version supported by the package and the
// main kaspa network.
pver := wire.ProtocolVersion
kaspanet := wire.Mainnet
// Use the most recent protocol version supported by the package and the
// main karlsen network.
pver := wire.ProtocolVersion
karlsennet := wire.Mainnet

// Reads and validates the next kaspa message from conn using the
// protocol version pver and the kaspa network kaspanet. The returns
// are a appmessage.Message, a []byte which contains the unmarshalled
// raw payload, and a possible error.
msg, rawPayload, err := wire.ReadMessage(conn, pver, kaspanet)
if err != nil {
// Log and handle the error
}
// Reads and validates the next karlsen message from conn using the
// protocol version pver and the karlsen network karlsennet. The returns
// are a appmessage.Message, a []byte which contains the unmarshalled
// raw payload, and a possible error.
msg, rawPayload, err := wire.ReadMessage(conn, pver, karlsennet)
if err != nil {
// Log and handle the error
}
```

See the package documentation for details on determining the message type.
See the package documentation for details on determining the message
type.

## Writing Messages Example

In order to marshal kaspa messages to the wire, use the `WriteMessage`
function. It accepts any `io.Writer`, but typically this will be a `net.Conn`
to a remote node running a kaspa peer. Example syntax to request addresses
from a remote peer is:
In order to marshal karlsen messages to the wire, use the
`WriteMessage` function. It accepts any `io.Writer`, but typically
this will be a `net.Conn` to a remote node running a karlsen peer.
Example syntax to request addresses from a remote peer is:

```Go
// Use the most recent protocol version supported by the package and the
// main bitcoin network.
pver := wire.ProtocolVersion
kaspanet := wire.Mainnet
// Use the most recent protocol version supported by the package and the
// main bitcoin network.
pver := wire.ProtocolVersion
karlsennet := wire.Mainnet

// Create a new getaddr kaspa message.
msg := wire.NewMsgGetAddr()
// Create a new getaddr karlsen message.
msg := wire.NewMsgGetAddr()

// Writes a kaspa message msg to conn using the protocol version
// pver, and the kaspa network kaspanet. The return is a possible
// error.
err := wire.WriteMessage(conn, msg, pver, kaspanet)
if err != nil {
// Log and handle the error
}
// Writes a karlsen message msg to conn using the protocol version
// pver, and the karlsen network karlsennet. The return is a possible
// error.
err := wire.WriteMessage(conn, msg, pver, karlsennet)
if err != nil {
// Log and handle the error
}
```
10 changes: 5 additions & 5 deletions cmd/genkeypair/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
genkeypair
========
# genkeypair

A tool for generating private-key-address pairs.

Note: This tool prints unencrypted private keys and is not recommended for day
to day use, and is intended mainly for tests.
Note: This tool prints unencrypted private keys and is not
recommended for day to day use, and is intended mainly for tests.

In order to manage your funds it's recommended to use [karlsenwallet](../karlsenwallet)
In order to manage your funds it's recommended to use
[karlsenwallet](../karlsenwallet)
36 changes: 18 additions & 18 deletions cmd/karlsenctl/README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
# karlsenctl

karlsenctl is an RPC client for karlsend
`karlsenctl` is an RPC client for `karlsend`.

## Requirements

Go 1.19 or later.

## Installation
## Build from Source

#### Build from Source

- Install Go according to the installation instructions here:
* Install Go according to the installation instructions here:
http://golang.org/doc/install

- Ensure Go was installed properly and is a supported version:
* Ensure Go was installed properly and is a supported version:

```bash
$ go version
go version
```

- Run the following commands to obtain and install karlsend including all dependencies:
* Run the following commands to obtain and install `karlsend`
including all dependencies:

```bash
$ git clone https://github.com/karlsen-network/karlsend/
$ cd karlsend/cmd/karlsenctl
$ go install .
git clone https://github.com/karlsen-network/karlsend
cd karlsend/cmd/karlsenctl
go install .
```

- karlsenctl should now be installed in `$(go env GOPATH)/bin`. If you did not already add the bin directory to your
system path during Go installation, you are encouraged to do so now.
* `karlsenctl` should now be installed in `$(go env GOPATH)/bin`. If
you did not already add the bin directory to your system path
during Go installation, you are encouraged to do so now.

## Usage

The full kaspctl configuration options can be seen with:
The full `karlsenctl` configuration options can be seen with:

```bash
$ kaspctl --help
karlsenctl --help
```

But the minimum configuration needed to run it is:

```bash
$ karlsenctl <REQUEST_JSON>
karlsenctl <REQUEST_JSON>
```

For example:

```
$ karlsenctl '{"getBlockDagInfoRequest":{}}'
karlsenctl '{"getBlockDagInfoRequest":{}}'
```

For a list of all available requests check out the [RPC documentation](infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md)
For a list of all available requests check out the [RPC documentation](infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md)
36 changes: 18 additions & 18 deletions cmd/karlsenminer/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# karlsenminer

karlsenminer is a CPU-based miner for karlsend
`karlsenminer` is a CPU-based miner for `karlsend`.

## Requirements

Go 1.19 or later.

## Installation
## Build from Source

#### Build from Source

- Install Go according to the installation instructions here:
* Install Go according to the installation instructions here:
http://golang.org/doc/install

- Ensure Go was installed properly and is a supported version:
* Ensure Go was installed properly and is a supported version:

```bash
$ go version
go version
```

- Run the following commands to obtain and install karlsend including all dependencies:
* Run the following commands to obtain and install `karlsend`
including all dependencies:

```bash
$ git clone https://github.com/karlsen-network/karlsend/
$ cd karlsend/cmd/karlsenminer
$ go install .
git clone https://github.com/karlsen-network/karlsend
cd karlsend/cmd/karlsenminer
go install .
```

- Kapaminer should now be installed in `$(go env GOPATH)/bin`. If you did
not already add the bin directory to your system path during Go installation,
you are encouraged to do so now.
* `karlsenminer` should now be installed in `$(go env GOPATH)/bin`.
If you did not already add the bin directory to your system path
during Go installation, you are encouraged to do so now.

## Usage

The full karlsenminer configuration options can be seen with:
The full `karlsenminer` configuration options can be seen with:

```bash
$ karlsenminer --help
karlsenminer --help
```

But the minimum configuration needed to run it is:

```bash
$ karlsenminer --miningaddr=<YOUR_MINING_ADDRESS>
```
karlsenminer --miningaddr=<YOUR_MINING_ADDRESS>
```
5 changes: 2 additions & 3 deletions domain/consensus/database/serialization/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
serialization
=============
# Serialization

1. Download and place in your PATH: https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip
2. `go get github.com/golang/protobuf/protoc-gen-go`
3. `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc`
4. In the protowire directory: `go generate .`
4. In the protowire directory: `go generate .`
20 changes: 10 additions & 10 deletions domain/consensus/utils/txscript/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
txscript
========
# Transaction Script Language

[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](https://choosealicense.com/licenses/isc/)
[![GoDoc](https://godoc.org/github.com/karlsen-network/karlsend/txscript?status.png)](http://godoc.org/github.com/karlsen-network/karlsend/txscript)

Package txscript implements the kaspa transaction script language. There is
a comprehensive test suite.
Package txscript implements the karlsen transaction script language.
There is a comprehensive test suite.

## Kaspa Scripts

Kaspa provides a stack-based, FORTH-like language for the scripts in
the kaspa transactions. This language is not turing complete
although it is still fairly powerful.
the karlsen transactions. This language is not turing complete although
it is still fairly powerful.

## Examples

* [Standard Pay-to-pubkey Script](http://godoc.org/github.com/karlsen-network/karlsend/txscript#example-PayToAddrScript)
Demonstrates creating a script which pays to a kaspa address. It also
prints the created script hex and uses the DisasmString function to display
the disassembled script.
Demonstrates creating a script which pays to a karlsen address. It
also prints the created script hex and uses the DisasmString
function to display the disassembled script.

* [Extracting Details from Standard Scripts](http://godoc.org/github.com/karlsen-network/karlsend/txscript#example-ExtractPkScriptAddrs)
Demonstrates extracting information from a standard public key script.
Demonstrates extracting information from a standard public key
script.
9 changes: 4 additions & 5 deletions domain/dagconfig/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
dagconfig
========
# DAG Configuration

[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](https://choosealicense.com/licenses/isc/)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/karlsen-network/karlsend/dagconfig)

Package dagconfig defines DAG configuration parameters for the standard
Karlsend networks and provides the ability for callers to define their own custom
Karlsend networks.
Package dagconfig defines DAG configuration parameters for the
standard Karlsend networks and provides the ability for callers to
define their own custom Karlsend networks.

## Sample Use

Expand Down
Loading

0 comments on commit 9f16499

Please sign in to comment.