Skip to content

Fix the coneciton pool issue and node configs #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Jul 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions run-nodes-locally/delegate-1/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"httpEndpoint": {
"host": "0.0.0.0",
"port": 1175
},
"grpcEndpoint": {
"host": "127.0.0.1",
"port": 1173
},
"grpcTimeout": 5,
"seedEndpoints": [
{
"host": "127.0.0.1",
"port": 1973
}
],
"delegateEndpoints": [
{
"host": "127.0.0.1",
"port": 1173
},
{
"host": "127.0.0.1",
"port": 1273
},
{
"host": "127.0.0.1",
"port": 1373
},
{
"host": "127.0.0.1",
"port": 1473
}
],
"useQuantumEntropy": false,
"genesisTransaction": "{\"hash\":\"a48ff2bd1fb99d9170e2bae2f4ed94ed79dbc8c1002986f8054a369655e29276\",\"type\":0,\"from\":\"e6098cc0d5c20c6c31c4d69f0201a02975264e94\",\"to\":\"3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c\",\"value\":10000000,\"data\":\"\",\"time\":0,\"signature\":\"03c1fdb91cd10aa441e0025dd21def5ebe045762c1eeea0f6a3f7e63b27deb9c40e08b656a744f6c69c55f7cb41751eebd49c1eedfbd10b861834f0352c510b200\",\"hertz\":0,\"fromName\":\"\",\"toName\":\"\"}"
}
37 changes: 37 additions & 0 deletions run-nodes-locally/delegate-2/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"httpEndpoint": {
"host": "0.0.0.0",
"port": 1275
},
"grpcEndpoint": {
"host": "127.0.0.1",
"port": 1273
},
"grpcTimeout": 5,
"seedEndpoints": [
{
"host": "127.0.0.1",
"port": 1973
}
],
"delegateEndpoints": [
{
"host": "127.0.0.1",
"port": 1173
},
{
"host": "127.0.0.1",
"port": 1273
},
{
"host": "127.0.0.1",
"port": 1373
},
{
"host": "127.0.0.1",
"port": 1473
}
],
"useQuantumEntropy": false,
"genesisTransaction": "{\"hash\":\"a48ff2bd1fb99d9170e2bae2f4ed94ed79dbc8c1002986f8054a369655e29276\",\"type\":0,\"from\":\"e6098cc0d5c20c6c31c4d69f0201a02975264e94\",\"to\":\"3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c\",\"value\":10000000,\"data\":\"\",\"time\":0,\"signature\":\"03c1fdb91cd10aa441e0025dd21def5ebe045762c1eeea0f6a3f7e63b27deb9c40e08b656a744f6c69c55f7cb41751eebd49c1eedfbd10b861834f0352c510b200\",\"hertz\":0,\"fromName\":\"\",\"toName\":\"\"}"
}
37 changes: 37 additions & 0 deletions run-nodes-locally/delegate-3/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"httpEndpoint": {
"host": "0.0.0.0",
"port": 1375
},
"grpcEndpoint": {
"host": "127.0.0.1",
"port": 1373
},
"grpcTimeout": 5,
"seedEndpoints": [
{
"host": "127.0.0.1",
"port": 1973
}
],
"delegateEndpoints": [
{
"host": "127.0.0.1",
"port": 1173
},
{
"host": "127.0.0.1",
"port": 1273
},
{
"host": "127.0.0.1",
"port": 1373
},
{
"host": "127.0.0.1",
"port": 1473
}
],
"useQuantumEntropy": false,
"genesisTransaction": "{\"hash\":\"a48ff2bd1fb99d9170e2bae2f4ed94ed79dbc8c1002986f8054a369655e29276\",\"type\":0,\"from\":\"e6098cc0d5c20c6c31c4d69f0201a02975264e94\",\"to\":\"3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c\",\"value\":10000000,\"data\":\"\",\"time\":0,\"signature\":\"03c1fdb91cd10aa441e0025dd21def5ebe045762c1eeea0f6a3f7e63b27deb9c40e08b656a744f6c69c55f7cb41751eebd49c1eedfbd10b861834f0352c510b200\",\"hertz\":0,\"fromName\":\"\",\"toName\":\"\"}"
}
37 changes: 37 additions & 0 deletions run-nodes-locally/delegate-4/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"httpEndpoint": {
"host": "0.0.0.0",
"port": 1475
},
"grpcEndpoint": {
"host": "127.0.0.1",
"port": 1473
},
"grpcTimeout": 5,
"seedEndpoints": [
{
"host": "127.0.0.1",
"port": 1973
}
],
"delegateEndpoints": [
{
"host": "127.0.0.1",
"port": 1173
},
{
"host": "127.0.0.1",
"port": 1273
},
{
"host": "127.0.0.1",
"port": 1373
},
{
"host": "127.0.0.1",
"port": 1473
}
],
"useQuantumEntropy": false,
"genesisTransaction": "{\"hash\":\"a48ff2bd1fb99d9170e2bae2f4ed94ed79dbc8c1002986f8054a369655e29276\",\"type\":0,\"from\":\"e6098cc0d5c20c6c31c4d69f0201a02975264e94\",\"to\":\"3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c\",\"value\":10000000,\"data\":\"\",\"time\":0,\"signature\":\"03c1fdb91cd10aa441e0025dd21def5ebe045762c1eeea0f6a3f7e63b27deb9c40e08b656a744f6c69c55f7cb41751eebd49c1eedfbd10b861834f0352c510b200\",\"hertz\":0,\"fromName\":\"\",\"toName\":\"\"}"
}
32 changes: 32 additions & 0 deletions run-nodes-locally/seed/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"httpEndpoint": {
"host": "0.0.0.0",
"port": 1975
},
"grpcEndpoint": {
"host": "127.0.0.1",
"port": 1973
},
"grpcTimeout": 5,
"seedEndpoints": [],
"delegateEndpoints": [
{
"host": "127.0.0.1",
"port": 1173
},
{
"host": "127.0.0.1",
"port": 1273
},
{
"host": "127.0.0.1",
"port": 1373
},
{
"host": "127.0.0.1",
"port": 1473
}
],
"useQuantumEntropy": false,
"genesisTransaction": "{\"hash\":\"a48ff2bd1fb99d9170e2bae2f4ed94ed79dbc8c1002986f8054a369655e29276\",\"type\":0,\"from\":\"e6098cc0d5c20c6c31c4d69f0201a02975264e94\",\"to\":\"3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c\",\"value\":10000000,\"data\":\"\",\"time\":0,\"signature\":\"03c1fdb91cd10aa441e0025dd21def5ebe045762c1eeea0f6a3f7e63b27deb9c40e08b656a744f6c69c55f7cb41751eebd49c1eedfbd10b861834f0352c510b200\",\"hertz\":0,\"fromName\":\"\",\"toName\":\"\"}"
}
66 changes: 66 additions & 0 deletions transactions/contracts/deploy-many.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package main

import (
"bytes"
"fmt"
"net/http"
"time"

"github.com/dispatchlabs/disgo/commons/types"
"github.com/dispatchlabs/disgo/commons/utils"
)

func main() {

var delay = 500 * time.Microsecond
var txCount = 1000
var endpoint = "http://127.0.0.1:1975/v1/transactions"

// var waitGroup sync.WaitGroup
// waitGroup.Add(txCount)

var startTime = time.Now()

for i := 1; i <= txCount; i++ {
// go func() {
time.Sleep(delay)

tx, _ := generateOneTx()
post1Tx(tx, endpoint)

// waitGroup.Done()
// }()
}

// waitGroup.Wait()

fmt.Println(fmt.Sprintf("TXes: %d, TOTAL Time: [%v] Nanoseconds", txCount, time.Since(startTime).Nanoseconds()))
}

func generateOneTx() (*types.Transaction, error) {
var privateKey = "0f86ea981203b26b5b8244c8f661e30e5104555068a4bd168d3e3015db9bb25a"
var from = "3ed25f42484d517cdfc72cafb7ebc9e8baa52c2c"
var code = "608060405234801561001057600080fd5b506040805190810160405280600d81526020017f61616161616161616161616161000000000000000000000000000000000000008152506000908051906020019061005c9291906100f7565b50600060016000018190555060006001800160006101000a81548160ff02191690831515021790555060018060010160016101000a81548160ff021916908360ff1602179055506040805190810160405280600b81526020017f6262626262626262626262000000000000000000000000000000000000000000815250600160020190805190602001906100f19291906100f7565b5061019c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061013857805160ff1916838001178555610166565b82800160010185558215610166579182015b8281111561016557825182559160200191906001019061014a565b5b5090506101739190610177565b5090565b61019991905b8082111561019557600081600090555060010161017d565b5090565b90565b610664806101ab6000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806333e538e91461007d57806334e45f531461010d5780633a458b1f1461017657806378d8866e1461022557806379af6473146102b5578063cb69e300146102cc575b600080fd5b34801561008957600080fd5b50610092610335565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100d25780820151818401526020810190506100b7565b50505050905090810190601f1680156100ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561011957600080fd5b50610174600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506103d7565b005b34801561018257600080fd5b5061018b6103f4565b60405180858152602001841515151581526020018360ff1660ff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156101e75780820151818401526020810190506101cc565b50505050905090810190601f1680156102145780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561023157600080fd5b5061023a6104c4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027a57808201518184015260208101905061025f565b50505050905090810190601f1680156102a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102c157600080fd5b506102ca610562565b005b3480156102d857600080fd5b50610333600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610579565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103cd5780601f106103a2576101008083540402835291602001916103cd565b820191906000526020600020905b8154815290600101906020018083116103b057829003601f168201915b5050505050905090565b80600160020190805190602001906103f0929190610593565b5050565b60018060000154908060010160009054906101000a900460ff16908060010160019054906101000a900460ff1690806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ba5780601f1061048f576101008083540402835291602001916104ba565b820191906000526020600020905b81548152906001019060200180831161049d57829003601f168201915b5050505050905084565b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b505050505081565b600160000160008154809291906001019190505550565b806000908051906020019061058f929190610593565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105d457805160ff1916838001178555610602565b82800160010185558215610602579182015b828111156106015782518255916020019190600101906105e6565b5b50905061060f9190610613565b5090565b61063591905b80821115610631576000816000905550600101610619565b5090565b905600a165627a7a72305820f782ba3879cbbd0ec37bd4bbfbe885796488e7504e9b2f1f6817a4d3b8fdae460029"
var theTime = utils.ToMilliSeconds(time.Now())

return types.NewDeployContractTransaction(
privateKey,
from,
code,
theTime,
)
}

func post1Tx(tx *types.Transaction, endpoint string) {
data := new(bytes.Buffer)
data.WriteString(tx.String())

resp, _ := http.Post(
endpoint,
"application/json; charset=utf-8",
data,
)

// If NOT then this happens https://stackoverflow.com/questions/37454236/net-http-server-too-many-open-files-error
resp.Body.Close()
}