Skip to content

Commit

Permalink
Merge pull request #56 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.0.6
  • Loading branch information
danil-lashin committed Jul 16, 2018
2 parents 5c87d36 + 804903f commit 0da0b01
Show file tree
Hide file tree
Showing 57 changed files with 2,303 additions and 2,121 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.0.6
*Jule 16th, 2018*

BREAKING CHANGES

- [core] Change commissions
- [testnet] New testnet id
- [core] Fix transaction decoding issue
- [core] Remove transaction ConvertCoin, add SellCoin and BuyCoin. For details see the docs.
- [core] Coin name is now limited to max 64 bytes
- [api] Update estimate exchange endpoint

IMPROVEMENT

- [api] Update transaction api
- [api] Add transaction result to block api
- [mempool] Mempool cache is disabled
- [tendermint] Updated to v0.22.4
- [versioning] Adapt Semantic Versioning https://semver.org/
- [client] Add --disable-api flag to client

## 0.0.5
*Jule 4rd, 2018*

Expand Down
25 changes: 6 additions & 19 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
# go-tests = true
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/ALTree/floatutils"

[[constraint]]
branch = "master"
name = "github.com/btcsuite/btcd"
Expand Down Expand Up @@ -59,7 +54,7 @@

[[constraint]]
name = "github.com/tendermint/tendermint"
version = "0.22.0"
version = "0.22.4"

[[constraint]]
branch = "v2"
Expand Down
97 changes: 19 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,91 +10,32 @@ Minter is a blockchain network that lets people, projects, and companies issue a

_NOTE: This is alpha software. Please contact us if you intend to run it in production._

## Documentation

For documentation, [Read The Docs](https://minter-go-node.readthedocs.io/en/dev/).

## Run using Docker

You'll need [docker](https://docker.com/) and [docker compose](https://docs.docker.com/compose/) installed.

Clone Minter to your machine
```bash
$ git clone https://github.com/MinterTeam/minter-go-node.git
$ cd minter-go-node
```

Prepare configs
```bash
$ mkdir -p ~/.tendermint/data
$ mkdir -p ~/.minter/data

$ cp -R networks/testnet/ ~/.tendermint/config

$ chmod -R 0777 ~/.tendermint
$ chmod -R 0777 ~/.minter
```
## Installation

Start Minter
```bash
$ docker-compose up
```
You can get official installation instructions in our [docs](https://minter-go-node.readthedocs.io/en/dev/install.html).

## Build and run manually

You'll need **go** [installed](https://golang.org/doc/install) and the required
[environment variables set](https://github.com/tendermint/tendermint/wiki/Setting-GOPATH)

1. Install [Tendermint 0.22.0](https://github.com/tendermint/tendermint/blob/master/docs/install.rst)

2. Clone Minter to your machine
```bash
$ mkdir $GOPATH/src/github.com/MinterTeam
$ cd $GOPATH/src/github.com/MinterTeam
$ git clone https://github.com/MinterTeam/minter-go-node.git
$ cd minter-go-node
```

3. Get Tools & Dependencies

```bash
$ make get_tools
$ make get_vendor_deps
```

4. Compile & install
```bash
$ make install
```

5. Create data directories
```bash
$ mkdir -p ~/.tendermint/data
$ mkdir -p ~/.minter/data
```
## Documentation

6. Copy config and genesis file
```bash
$ cp -R networks/testnet/ ~/.tendermint/config
```
For documentation, [Read The Docs](https://minter-go-node.readthedocs.io/en/dev/).

7. Run Tendermint
```bash
$ tendermint node
```
## Versioning

8. Run Minter
### SemVer

```bash
$ minter
```
Minter uses [SemVer](http://semver.org/) to determine when and how the version changes.
According to SemVer, anything in the public API can change at any time before version 1.0.0

## Troubleshooting
To provide some stability to Minter users in these 0.X.X days, the MINOR version is used
to signal breaking changes across a subset of the total public API. This subset includes all
interfaces exposed to other processes, but does not include the in-process Go APIs.

If you see error like this:
### Upgrades

```
ERROR: Failed to create node: Error starting proxy app connections: Error on replay: Wrong Block.Header.AppHash. Expected 6D94BF43BB6C83F396FD8310BC2983F08C658344F9F348BB6675D1E5913230B3, got A2F322A4891092C690F5F0B80C1B9D5017A703035B63385108628EC244ECB191
```
In an effort to avoid accumulating technical debt prior to 1.0.0,
we do not guarantee that breaking changes (ie. bumps in the MINOR version)
will work with existing tendermint blockchains. In these cases you will
have to start a new blockchain, or write something custom to get the old
data into the new chain.

then your build of Minter Node and network build of Minter Node are different.
However, any bump in the PATCH version should be compatible with existing histories
(if not please open an [issue](https://github.com/MinterTeam/minter-go-node/issues)).
3 changes: 2 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func RunApi(b *minter.Blockchain) {
router.HandleFunc("/api/transactions", Transactions).Methods("GET")
router.HandleFunc("/api/status", Status).Methods("GET")
router.HandleFunc("/api/coinInfo/{symbol}", GetCoinInfo).Methods("GET")
router.HandleFunc("/api/estimateCoinExchangeReturn", EstimateCoinExchangeReturn).Methods("GET")
router.HandleFunc("/api/estimateCoinSell", EstimateCoinSell).Methods("GET")
router.HandleFunc("/api/estimateCoinBuy", EstimateCoinBuy).Methods("GET")

c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
Expand Down
49 changes: 31 additions & 18 deletions api/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@ type BlockResponse struct {
}

type BlockTransactionResponse struct {
Hash string `json:"hash"`
From string `json:"from"`
Nonce uint64 `json:"nonce"`
GasPrice *big.Int `json:"gasPrice"`
Type byte `json:"type"`
Data transaction.Data `json:"data"`
Payload []byte `json:"payload"`
ServiceData []byte `json:"serviceData"`
Gas int64 `json:"gas"`
Hash string `json:"hash"`
RawTx string `json:"raw_tx"`
From string `json:"from"`
Nonce uint64 `json:"nonce"`
GasPrice *big.Int `json:"gas_price"`
Type byte `json:"type"`
Data transaction.Data `json:"data"`
Payload []byte `json:"payload"`
ServiceData []byte `json:"service_data"`
Gas int64 `json:"gas"`
TxResult ResponseDeliverTx `json:"tx_result"`
}

func Block(w http.ResponseWriter, r *http.Request) {

vars := mux.Vars(r)
height, _ := strconv.ParseInt(vars["height"], 10, 64)

result, err := client.Block(&height)
block, err := client.Block(&height)
blockResults, err := client.BlockResults(&height)

w.Header().Set("Content-Type", "application/json; charset=UTF-8")

Expand All @@ -55,14 +58,15 @@ func Block(w http.ResponseWriter, r *http.Request) {

w.WriteHeader(http.StatusOK)

txs := make([]BlockTransactionResponse, len(result.Block.Data.Txs))
txs := make([]BlockTransactionResponse, len(block.Block.Data.Txs))

for i, rawTx := range result.Block.Data.Txs {
for i, rawTx := range block.Block.Data.Txs {
tx, _ := transaction.DecodeFromBytes(rawTx)
sender, _ := tx.Sender()

txs[i] = BlockTransactionResponse{
Hash: fmt.Sprintf("Mt%x", types.Tx(rawTx).Hash()),
RawTx: fmt.Sprintf("%x", rawTx),
From: sender.String(),
Nonce: tx.Nonce,
GasPrice: tx.GasPrice,
Expand All @@ -71,16 +75,25 @@ func Block(w http.ResponseWriter, r *http.Request) {
Payload: tx.Payload,
ServiceData: tx.ServiceData,
Gas: tx.Gas(),
TxResult: ResponseDeliverTx{
Code: blockResults.Results.DeliverTx[i].Code,
Data: blockResults.Results.DeliverTx[i].Data,
Log: blockResults.Results.DeliverTx[i].Log,
Info: blockResults.Results.DeliverTx[i].Info,
GasWanted: blockResults.Results.DeliverTx[i].GasWanted,
GasUsed: blockResults.Results.DeliverTx[i].GasUsed,
Tags: blockResults.Results.DeliverTx[i].Tags,
},
}
}

response := BlockResponse{
Hash: result.Block.Hash(),
Height: result.Block.Height,
Time: result.Block.Time,
NumTxs: result.Block.NumTxs,
TotalTxs: result.Block.TotalTxs,
Precommits: result.Block.LastCommit.Precommits,
Hash: block.Block.Hash(),
Height: block.Block.Height,
Time: block.Block.Time,
NumTxs: block.Block.NumTxs,
TotalTxs: block.Block.TotalTxs,
Precommits: block.Block.LastCommit.Precommits,
Transactions: txs,
}

Expand Down
Loading

0 comments on commit 0da0b01

Please sign in to comment.