Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wavesplatform/gowaves

Go implementation of Waves node, libraries and tools for Waves blockchain
https://github.com/wavesplatform/gowaves

Last synced: 27 days ago
JSON representation

Go implementation of Waves node, libraries and tools for Waves blockchain

Awesome Lists containing this project

README

        

# gowaves

Go implementation of Waves Node, libraries and tools for Waves blockchain.

![](https://github.com/wavesplatform/gowaves/workflows/build/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/wavesplatform/gowaves)](https://goreportcard.com/report/github.com/wavesplatform/gowaves)
[![codecov](https://codecov.io/gh/wavesplatform/gowaves/branch/master/graph/badge.svg)](https://codecov.io/gh/wavesplatform/gowaves)
[![GoDoc](https://godoc.org/github.com/wavesplatform/gowaves?status.svg)](https://godoc.org/github.com/wavesplatform/gowaves)

## Waves Node

It is possible to run Waves Node on Linux, macOS or Windows. Please, download an appropriate binary file from [Releases page](https://github.com/wavesplatform/gowaves/releases).

You can either synchronize a node over network or import a downloaded blockchain file.

### How to import blockchain from file

Blockchain files are available on [MainNet](http://blockchain.wavesnodes.com), [TestNet](http://blockchain-testnet.wavesnodes.com) [StageNet](http://blockchain-stagenet.wavesnodes.com/) download pages.

Import could be done as follows:

1. Download a blockchain file
1. Download the `importer` utility from [Releases](https://github.com/wavesplatform/gowaves/releases)
1. Run the command, put the path to the blockchain file and node's state directory as parameters.
The third parameter is the number of blocks to import, it should be less than a desired height by one.

```bash
./importer -blockchain-path [path to blockchain file] -data-path [path to node state directory] -blocks-number [height - 1]
```

Import may take a few hours, after which you can run the node as described in next section.

Please note that the Go Node has its own state storage structure that is incompatible with Scala Node.

### How to run the node

Run the node as follows:

1. Download a suitable node's binary file from [Releases](https://github.com/wavesplatform/gowaves/releases)
1. Run the command, if required, put the path to the node's state directory.

```bash
./node -state-path [path to node state directory]
```

By default, the node is run as a MainNet node. To run a TestNet node put `testnet`, as a blockchain type. You may also enter a list of comma separated peers' addresses (Optional):
```bash
./node -state-path [path to node state directory] -blockchain-type testnet
```

Read more about [running the node as Linux service](https://github.com/wavesplatform/gowaves/tree/master/cmd/node#readme).

### How to set block generation

Go Node has two parameters which allow the loading of private keys from a wallet file.

```
-wallet-path [path to wallet file]
-wallet-password [password string]
```

For example:

```
./node -state-path ~/gowaves-testnet/ -blockchain-type testnet -wallet-path ~/testnet.wallet -wallet-password 'some super secret password'
```

Once the parameters were provided, the node would try loading and using private keys to generate blocks.

#### How to create a wallet file

To create a wallet file use the `wallet` utility. Please download a suitable version of the `wallet` utility from the [Releases](https://github.com/wavesplatform/gowaves/releases) page.
The following command will create and add a new seed to the wallet file:

```bash
./wallet -new
```

The utility would ask for a password to encrypt the new wallet file. If a wallet file does not exist, the file will be created.
By default, new wallet file has name `.waves` and stored in user's home directory. Different wallet's file location can be set using `-wallet` option.

Also, it's possible to import existing seed phrase. Please, use `-seed-phrase` option to do so.
```bash
./wallet -seed-phrase "words of seed phrase..."
```

If you have a Base58 encoded seed phrase from Scala node configuration file. There is an option `-seed-phrase-base58` to import it.
Also, this Base58 encoded seed phrase can be exported from Waves.Exchange wallet using `Settings | Security | Encoded Seed Phrase` menu option.
```bash
./wallet -seed-phrase-base58
```

The last import option `-account-seed-base58` allows to import a Base58 encoded account seed.
```bash
./wallet -account-seed-base58
```

To list the seeds stored in the wallet, run the following command and provide a password.
```bash
./wallet -show
```

### Client library examples

Create sender's public key from BASE58 string:
```go
sender, err := crypto.NewPublicKeyFromBase58("")
if err != nil {
panic(err)
}
```
Create sender's private key from BASE58 string:
```go
sk, err := crypto.NewSecretKeyFromBase58("")
if err != nil {
panic(err)
}
```

Create script's address:
```go
a, err := proto.NewAddressFromString("