Skip to content

Commit

Permalink
encapsulate genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-lashin committed Jul 18, 2018
1 parent 82845bd commit 1aa414d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 75 deletions.
15 changes: 15 additions & 0 deletions cmd/minter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,30 @@ import (
"github.com/MinterTeam/minter-go-node/cmd/utils"
"github.com/MinterTeam/minter-go-node/config"
"github.com/MinterTeam/minter-go-node/core/minter"
"github.com/MinterTeam/minter-go-node/genesis"
"github.com/MinterTeam/minter-go-node/log"
"github.com/tendermint/tendermint/libs/common"
tmNode "github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/proxy"
"io/ioutil"
"os"
)

func main() {

configDir := utils.GetMinterHome() + "/config/"
genesisFile := configDir + "genesis.json"

if !common.FileExists(genesisFile) {
os.MkdirAll(configDir, 0777)
err := ioutil.WriteFile(genesisFile, []byte(genesis.TestnetGenesis), 0644)

if err != nil {
panic(err)
}
}

app := minter.NewMinterBlockchain()
node := startTendermint(app)

Expand Down
42 changes: 0 additions & 42 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ Download Minter
Get `latest binary build <https://github.com/MinterTeam/minter-go-node/releases>`__ suitable for your architecture and
unpack it to desired folder.

Prepare folders and configs
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash
:lineno-start: 3
mkdir -p ~/.minter/data
git clone https://github.com/MinterTeam/minter-go-node.git && cd minter-go-node
cp -R networks/testnet/ ~/.minter/config
chmod -R 0777 ~/.minter
Run Minter
^^^^^^^^^^

Expand All @@ -49,19 +36,6 @@ Clone Minter source code to your machine
git clone https://github.com/MinterTeam/minter-go-node.git
cd minter-go-node
Prepare folders and configs
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash
:lineno-start: 3
mkdir -p ~/.minter/data
cp -R networks/testnet/ ~/.minter/config
chmod -R 0777 ~/.minter
Start Minter
^^^^^^^^^^^^

Expand Down Expand Up @@ -116,22 +90,6 @@ to put the binary in ``./build``.

The latest ``minter version`` is now installed.

Create data directory
^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash
:lineno-start: 9
mkdir -p ~/.minter/data
Copy genesis file
^^^^^^^^^^^^^^^^^

.. code-block:: bash
:lineno-start: 11
cp -R networks/testnet/ ~/.minter/config
Run Minter
^^^^^^^^^^

Expand Down
33 changes: 33 additions & 0 deletions genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@ package genesis

import "github.com/MinterTeam/minter-go-node/core/types"

var TestnetGenesis = `{
"genesis_time": "2018-06-09T00:00:00Z",
"chain_id": "minter-test-network-11",
"validators": [
{
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "qu4d3zD/VMkHFdkotWZS/FEb7Tci5Ylz6O+Ub12uOXk="
},
"power": "100",
"name": ""
}
],
"app_state": {
"first_validator_address": "Mxa93163fdf10724dc4785ff5cbfb9ac0b5949409f",
"initial_balances": [
{
"address": "Mxa93163fdf10724dc4785ff5cbfb9ac0b5949409f",
"balance": {
"MNT": "10000000000000000000000000"
}
},
{
"address": "Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99",
"balance": {
"MNT": "10000000000000000000000000"
}
}
]
},
"app_hash": "0000000000000000000000000000000000000000000000000000000000000000"
}`

type AppState struct {
FirstValidatorAddress types.Address `json:"first_validator_address"`
InitialBalances []Account `json:"initial_balances"`
Expand Down
4 changes: 3 additions & 1 deletion helpers/helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package helpers

import "math/big"
import (
"math/big"
)

func BipToPip(bip *big.Int) *big.Int {
p := big.NewInt(10)
Expand Down
32 changes: 0 additions & 32 deletions networks/testnet/genesis.json

This file was deleted.

0 comments on commit 1aa414d

Please sign in to comment.