Skip to content

Commit

Permalink
Merge pull request #3 from frank-origo/update
Browse files Browse the repository at this point in the history
Update documents with GPU mining tutorial
  • Loading branch information
cowboyorigo authored Oct 1, 2019
2 parents d2b1eaa + 787ef19 commit 5ccb423
Show file tree
Hide file tree
Showing 9 changed files with 720 additions and 68 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ Please follow [private transaction tutorial](docs/pt_tutorial.md)
### CPU Mining Tutorial
Please follow [cpu mining tutorial](docs/cpu_mining_tutorial.md)

### GPU Mining Tutorial
Please follow [gpu mining tutorial](docs/gpu_mining_tutorial.md)

## Issues
Please submit any issue, bugs or feature requests via [here](https://github.com/origolab/origo-binary/issues/new).

## Current Version
**0.2.0-alpha Sep 17th 2019**
**0.2.5-beta Sep 30th 2019**
54 changes: 7 additions & 47 deletions docs/cpu_mining_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We choose [EquiHash](https://en.wikipedia.org/wiki/Equihash) as our PoW algorith

### Stratum

Miner client connects to Origo node by [Stratum Protocol](https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol). Default ip:port binding is `0.0.0.0:8008`. There are two major messages `subscribe` and `submit` for client to mine with node.
Miner client connects to Origo node by [Stratum Protocol](https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol). Default ip:port binding is `0.0.0.0:6002`. There are two major messages `subscribe` and `submit` for client to mine with node.

#### Subscribe

Expand Down Expand Up @@ -67,59 +67,19 @@ Download the Origo Blockchain Binary from [releases](https://github.com/origolab
To start the testnet, save below content as `config_miner.toml`:

```
# This config should be placed in following path:
[parity]
# Chain
chain = "medietas"
# Blockchain and settings
base_path = "../origo"
# Databases path
db_path = "../origo/chains"
[network]
# P2P port.
port = 30323
# Min peers.
min_peers = 2
# Network ID
id = 27
# Enable or disable new peers discovery.
discovery = true
# Specify a path to a file with peers' enodes to be always connected to.
#reserved_peers = "peers.toml"
[mining]
# Account address to receive reward when block is mined.
author = "0x7364874994b0b180f3165454f8ea85fde38c611f"
# Prepare a block to seal even when there are no miners connected.
# Change this address to your own mining wallet address
author = "0x7a93b005d71d402ff5b88f812e0e04db7e2fb2f4"
force_sealing = true
# New pending block will be created for all transactions (both local and external).
reseal_on_txs = "all"
# New pending block will be created only once per 4000 milliseconds.
reseal_min_period = 4000
# Most transactions in queue.
tx_queue_size = 2048
[footprint]
cache_size = 256
reseal_max_period = 60000
tx_queue_size = 8192
[stratum]
# Enable stratum
disable = false
[rpc]
# JSON-RPC over HTTP will be accessible on port 9023.
port = 9023
# JSON-RPC will be listening for connections on IP 0.0.0.0.
interface = "0.0.0.0"
# Allows Cross-Origin Requests from domain 'all'.
cors = ["all"]
[websockets]
# UI won't work and WebSockets server will be not available.
disable = true
```

Then start full node via this command:
Expand All @@ -146,8 +106,8 @@ python server.py

If everything is correctly configured, you will see these logs:
```
DEBUG:stratum-client:connecting to 127.0.0.1:8008...
INFO:stratum-client:connected to 127.0.0.1:8008
DEBUG:stratum-client:connecting to 127.0.0.1:6002...
INFO:stratum-client:connected to 127.0.0.1:6002
DEBUG:stratum-client:mining.subscribe(()) took 0.572919845581ms
Miner starting
Nonce: 0
Expand Down
63 changes: 63 additions & 0 deletions docs/gpu_mining_tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## GPU Mining Tutorial

In this tutorial, we will guide you step by step doing GPU mining for Medietas testnet on AWS.

### Requirements

We only verified this tutorial in the below environment:

* Ubuntu 18.04 LTS
* AWS G3 or P3 instances
* OpenCL

#### Nvidia OpenCL Driver

Install NVIDIA driver on AWS Linux instances, by following [this document](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html).

#### Python 3

Install Python3 and OpenCL headers:

```
sudo apt update
sudo apt install -y nvidia-opencl-dev python3
```

### Tutorial

#### Step 1: Download the Origo blockchain binary

Download the Origo Blockchain Binary from [releases](https://github.com/origolab/origo-binary/releases), please choose right version for your operating system.

#### Step 2: Connecting to medietas testnet

Create a `config.toml` file as below:

```
[mining]
# Change this address to your own mining wallet address
author = "0x7a93b005d71d402ff5b88f812e0e04db7e2fb2f4"
force_sealing = true
reseal_on_txs = "all"
reseal_min_period = 4000
reseal_max_period = 60000
tx_queue_size = 8192
[stratum]
# Enable stratum
disable = false
```

Starting full node as below:

```
./origo --chain medietas-testnet --config config.toml
```

#### Step 3: Start mining

Download [GPU Miner](../tools/miner/gpuminer) to your instance, then run miner as below:

```
./ogominer -u 0 -v
```
12 changes: 6 additions & 6 deletions docs/private_transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Params: [


```
curl --data '{"method":"personal_sendShieldTransaction","params":[{ "from":"0x00a329c0648769a73afac7f9381e08fb43dbea72","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "shieldAmounts": [{"address":"ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw", "amount": 32, "memo":"test" }] }, "password123"] ,"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"method":"personal_sendShieldTransaction","params":[{ "from":"0x00a329c0648769a73afac7f9381e08fb43dbea72","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "shieldAmounts": [{"address":"ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw", "amount": 32, "memo":"test" }] }, "password123"] ,"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down Expand Up @@ -108,7 +108,7 @@ None


```
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down Expand Up @@ -146,7 +146,7 @@ None


```
curl --data '{"jsonrpc":"2.0","method":"origo_listAddresses","id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_listAddresses","id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down Expand Up @@ -187,7 +187,7 @@ Returns the balance of a private address belonging to the node’s wallet.


```
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw"],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw"],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down Expand Up @@ -230,7 +230,7 @@ Returns array of unspent shielded notes with between minconf and maxconf (inclus


```
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw",2, 5, false],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw",2, 5, false],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down Expand Up @@ -276,7 +276,7 @@ Send multiple private transactions. Amounts are decimal numbers with at most 8 d


```
curl --data '{"jsonrpc":"2.0","method":"origo_sendMany", "params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw", [{"address":"ogo1gs2uw342alp7z49xgm2a4hshj53cwnl4ml0ardxqe8ewtl3ynut2dhq6f0n2rzf7rglv7jeksxe", "amount": 32, "memo":"test" }], 5, 12],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_sendMany", "params":["ogo127hk2tmx3pktg0pvdskrtjal5yt9en5zn67vm3tuxau5v5vvvl8p34phy0n4znfq7h4f5n6l2yw", [{"address":"ogo1gs2uw342alp7z49xgm2a4hshj53cwnl4ml0ardxqe8ewtl3ynut2dhq6f0n2rzf7rglv7jeksxe", "amount": 32, "memo":"test" }], 5, 12],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down
24 changes: 12 additions & 12 deletions docs/pt_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Perform the following steps to submit a private transaction to the full node on

Download the Origo Blockchain Binary from [releases](https://github.com/origolab/origo-binary/releases), please choose right version for your operating system.

**Step 2: Start Origo testnet**
**Step 2: Connecting to Medietas testnet**

To start the testnet, change to the binary directory and run the command as below:


```
./origo --chain=dev --jsonrpc-apis=all
./origo --chain=medietas-testnet --jsonrpc-apis=all
```


Expand All @@ -37,7 +37,7 @@ To start the testnet, change to the binary directory and run the command as bel
In the develop mode we have a preloaded public address **0x00a329c0648769a73afac7f9381e08fb43dbea72** holds enough origo for testing. Its password is empty string. We run the unlock command to verify we have access to it:

```
curl --data '{"method":"personal_unlockAccount","params":["0x00a329c0648769a73afac7f9381e08fb43dbea72","",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"method":"personal_unlockAccount","params":["0x00a329c0648769a73afac7f9381e08fb43dbea72","",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:6622
```

It should return a success result like this:
Expand All @@ -56,7 +56,7 @@ To create A’s private address, using the origo_getNewAddress shown in [JSON-RP


```
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -76,7 +76,7 @@ To create B’s private address, repeat the command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getNewAddress","id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -96,7 +96,7 @@ To list all the private addresses you have created, enter this command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_listAddresses","id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_listAddresses","id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -117,7 +117,7 @@ To send balance from A’s public address to A’s private address, the command
_Note: Please **replace the address ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6** to A’s private address.

```
curl --data '{"method":"personal_sendShieldTransaction","params":[{ "from":"0x00a329c0648769a73afac7f9381e08fb43dbea72","gas": "0x76c00", "gasPrice": "0x9184e72a000", "value": "0x20", "shieldAmounts": [{"address":"ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6","amount": 32, "memo":"test" }] }, ""] ,"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"method":"personal_sendShieldTransaction","params":[{ "from":"0x00a329c0648769a73afac7f9381e08fb43dbea72","gas": "0x76c00", "gasPrice": "0x9184e72a000", "value": "0x20", "shieldAmounts": [{"address":"ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6","amount": 32, "memo":"test" }] }, ""] ,"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -135,7 +135,7 @@ To show the unspent transaction for A’s address, the command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6"],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6"],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -153,7 +153,7 @@ To show the balance for A’s private address, the command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6"],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6"],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -175,7 +175,7 @@ To submit the private transaction from A’s private address to B’s private ad


```
curl --data '{"jsonrpc":"2.0","method":"origo_sendMany", "params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6", [{"address":"ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel", "amount":10, "memo":"test" }]],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_sendMany", "params":["ogo180m058urhazk8j98zvz9fsq5zd0vd9dpsc8c6ednwd2xkc3l8z9thmxsezepzx4aascp6nrlkd6", [{"address":"ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel", "amount":10, "memo":"test" }]],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -193,7 +193,7 @@ To show the unspent transaction for B’s address, the command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel"],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_listUnspent","params":["ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel"],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand All @@ -211,7 +211,7 @@ To show the balance for B’s private address, the command:


```
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel"],"id":1}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"jsonrpc":"2.0","method":"origo_getBalance","params":["ogo175j7xj6jgn3w0trmxzmssydmdq5rd9vxydwdqmd9t6qkykrr0y24w6xfp44knukqjweuxxa9mel"],"id":1}' -H "Content-Type: application/json" -X POST localhost:6622
```


Expand Down
4 changes: 2 additions & 2 deletions tools/miner/cpuminer-py/stratum/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
PROTO_VERSION = "1.0"

DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 8008
DEFAULT_PORT = 6002

TIMEOUT = 5

Expand Down Expand Up @@ -281,4 +281,4 @@ def take(self):
conn = Connection(1)
result = conn.call("mining.subscribe")["result"]
print("result ", result)
7 changes: 7 additions & 0 deletions tools/miner/gpuminer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Origo GPU Miner

Origo first GPU Miner with EquiHash, it runs on Ubuntu 18.04 LTS with OpenCL support.

**Note: this GPU miner is for testing purpose, DO NOT USE it in production**

_Source code will be publised once this project gets mature, and more operating systems will be supported_
Loading

0 comments on commit 5ccb423

Please sign in to comment.