diff --git a/.gitignore b/.gitignore index d5a2d2be..bdbe061e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ stupid # Output of the go coverage tool, specifically when used with LiteIDE *.out + +# Files from IDE +*.idea/ diff --git a/README.md b/README.md index d098ed8c..54ad0ef4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Why Stupid -Sometimes we need to test performance of a deployed Fabric network with ease. There are many excellent projects out there, i.e. Hyperledger Caliper. However, we sometimes just need a tiny, handy tool, like `Stupid`. +Sometimes we need to test performance of a deployed Fabric network with ease. There are many excellent projects out there, i.e. Hyperledger Caliper. However, we sometimes just need a tiny, handy tool, like `stupid`. About the name: [Keep It Simple, Stupid](https://en.wikipedia.org/wiki/KISS_principle) @@ -26,13 +26,19 @@ This tool is so stupid that *it will not be the bottleneck of performance test* ## How to use it -### Make sure you have Go 1.12 installed +### Prerequisites -### clone this repo and run `go build` at root dir -This is a go module project so you don't need to clone it into `GOPATH`. It will download required dependencies automatically, which may take a while depending on network connection. Once it finishes building, you should have a executable named `stupid`. +Go1.11 or higher. Go1.13 is recommended. -### modify `config.json` according to your network -This is a sample: +### Install + +You need to build from source for now (Docker image on the way). + +Clone this repo and run `go build` at root dir. This is a go module project so you don't need to clone it into `GOPATH`. It will download required dependencies automatically, which may take a while depending on network connection. Once it finishes building, you should have a executable named `stupid`. + +### Configure + +Modify `config.json` according to your network. This is a sample: ```json { "peer_addr": "peer0.org1.example.com:7051", @@ -57,15 +63,21 @@ This tool sends traffic as a Fabric user, and requires following configs `mspid`: MSP ID that the user is associated to -`private_key`: path to the private key. If you are using BYFN as your base, this can be `crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk` +`private_key`: path to the private key. If you are using BYFN as your base, this can be: +``` +crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk +``` -`sign_cert`: path to the user certificate. If you are using BYFN as your base, this can be `crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem` +`sign_cert`: path to the user certificate. If you are using BYFN as your base, this can be: +``` +crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +``` `tls_ca_certs`: this contains TLS CA certificates of peer and orderer. If tls is disabled, leave this blank. Otherwise, it can be `crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem` from peer and `crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem` from orderer `channel`: channel name -`chaincode`: chaincode to invoke +`chaincode`: chaincode to invoke. There is an example chaincode in `chaincodes/sample.go`, which simply puts `key:value`. This is closely related to `args` parameter. `args`: arguments to send with invocation, depending on your chaincode implementation. The chaincode used by this sample can be found in `chaincodes/sample.go` @@ -73,7 +85,9 @@ This tool sends traffic as a Fabric user, and requires following configs `client_per_conn`: number of clients per connection used to send proposals to peer. If you think client has not put enough pressure on Fabric, increase this. -### Run `stupid config.json 40000` to generate 40000 transactions to Fabric. +### Run + +Execute `./stupid config.json 40000` to generate 40000 transactions to Fabric. *Set this to integer times of batchsize, so that last block is not cut due to timeout*. For example, if you have batch size of 500, set this to 500, 1000, 40000, 100000, etc. diff --git a/go.mod b/go.mod index 3aacf7d0..e799ad08 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module stupid +module github.com/guoger/stupid go 1.12 diff --git a/main.go b/main.go index c94d0c6b..df2ef1c9 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "stupid/infra" + "github.com/guoger/stupid/infra" ) func main() {