forked from karlsen-network/karlsend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated documentation and fixed some typos and style
- Loading branch information
1 parent
d2d3ddd
commit 9f16499
Showing
23 changed files
with
322 additions
and
964 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,73 @@ | ||
wire | ||
==== | ||
# wire | ||
|
||
[](https://choosealicense.com/licenses/isc/) | ||
[](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 | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 .` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
txscript | ||
======== | ||
# Transaction Script Language | ||
|
||
[](https://choosealicense.com/licenses/isc/) | ||
[](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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.