diff --git a/.gitignore b/.gitignore index d6d6ecec6..ccf5007b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ .DS_Store config.json testnet.json +payouts.json + +.idea /build/_workspace/ /build/bin/ diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..9a610b24e --- /dev/null +++ b/go.mod @@ -0,0 +1,37 @@ +module github.com/sammy007/open-ethereum-pool + +go 1.19 + +require ( + github.com/FranckStone/ethash v0.0.2 + github.com/ethereumfair/go-ethereum v1.0.5 + github.com/gorilla/mux v1.8.0 + github.com/yvasiyarov/gorelic v0.0.7 + gopkg.in/redis.v3 v3.6.4 +) + +require ( + github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/garyburd/redigo v1.6.4 // indirect + github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/google/uuid v1.2.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.22.1 // indirect + github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect + github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940 // indirect + github.com/yvasiyarov/newrelic_platform_go v0.0.0-20160601141957-9c099fbc30e9 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect + gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..854d63323 --- /dev/null +++ b/go.sum @@ -0,0 +1,170 @@ +github.com/FranckStone/ethash v0.0.2 h1:ZCdZ3oqaaXRKVbbSuxXc/eM38Jm1bfSPmHDpaAVp5Vs= +github.com/FranckStone/ethash v0.0.2/go.mod h1:H84bypvoJ/ny/HLD1qptS4TCBwgSTbLQyz7HAyQqjMk= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/ethereumfair/go-ethereum v1.0.5 h1:bLxwm2LrOXLkHBMAZrAfVWcjweB28M1vOcS0nKsx++Y= +github.com/ethereumfair/go-ethereum v1.0.5/go.mod h1:629uE7LENnVlNqlvNJNqU0eAMWyWDJzXsmm9dFVy324= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/garyburd/redigo v1.6.4 h1:LFu2R3+ZOPgSMWMOL+saa/zXRjw0ID2G8FepO53BGlg= +github.com/garyburd/redigo v1.6.4/go.mod h1:rTb6epsqigu3kYKBnaF028A7Tf/Aw5s0cqA47doKKqw= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.22.1 h1:pY8O4lBfsHKZHM/6nrxkhVPUznOlIu3quZcKP/M20KI= +github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= +github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940 h1:p7OofyZ509h8DmPLh8Hn+EIIZm/xYhdZHJ9GnXHdr6U= +github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.7 h1:4DTF1WOM2ZZS/xMOkTFBOcb6XiHu/PKn3rVo6dbewQE= +github.com/yvasiyarov/gorelic v0.0.7/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20160601141957-9c099fbc30e9 h1:AsFN8kXcCVkUFHyuzp1FtYbzp1nCO/H6+1uPSGEyPzM= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20160601141957-9c099fbc30e9/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a h1:stTHdEoWg1pQ8riaP5ROrjS6zy6wewH/Q2iwnLCQUXY= +gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/redis.v3 v3.6.4 h1:u7XgPH1rWwsdZnR+azldXC6x9qDU2luydOIeU/l52fE= +gopkg.in/redis.v3 v3.6.4/go.mod h1:6XeGv/CrsUFDU9aVbUdNykN7k1zVmoeg83KC9RbQfiU= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/main.go b/main.go index faff57e60..a8c141de4 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,4 @@ +//go:build go1.9 // +build go1.9 package main diff --git a/payouts/payer.go b/payouts/payer.go index 97009ebf1..c908e993e 100644 --- a/payouts/payer.go +++ b/payouts/payer.go @@ -1,16 +1,23 @@ package payouts import ( + "context" + "crypto/ecdsa" "fmt" + "github.com/ethereumfair/go-ethereum/accounts/keystore" + "github.com/ethereumfair/go-ethereum/common" + "github.com/ethereumfair/go-ethereum/common/hexutil" + "github.com/ethereumfair/go-ethereum/console/prompt" + "github.com/ethereumfair/go-ethereum/core/types" + "github.com/ethereumfair/go-ethereum/crypto" + "github.com/ethereumfair/go-ethereum/ethclient" + "io/ioutil" "log" "math/big" "os" "strconv" "time" - "github.com/ethereum/go-ethereum/common/hexutil" - - "github.com/sammy007/open-ethereum-pool/rpc" "github.com/sammy007/open-ethereum-pool/storage" "github.com/sammy007/open-ethereum-pool/util" ) @@ -27,6 +34,8 @@ type PayoutsConfig struct { Gas string `json:"gas"` GasPrice string `json:"gasPrice"` AutoGas bool `json:"autoGas"` + KeyPath string `json:"keyPath"` + // In Shannon Threshold int64 `json:"threshold"` BgSave bool `json:"bgsave"` @@ -43,29 +52,45 @@ func (self PayoutsConfig) GasPriceHex() string { } type PayoutsProcessor struct { - config *PayoutsConfig - backend *storage.RedisClient - rpc *rpc.RPCClient - halt bool - lastFail error + config *PayoutsConfig + backend *storage.RedisClient + privateKey *ecdsa.PrivateKey + rpc *ethclient.Client + halt bool + lastFail error } func NewPayoutsProcessor(cfg *PayoutsConfig, backend *storage.RedisClient) *PayoutsProcessor { u := &PayoutsProcessor{config: cfg, backend: backend} - u.rpc = rpc.NewRPCClient("PayoutsProcessor", cfg.Daemon, cfg.Timeout) + u.rpc, _ = ethclient.Dial(cfg.Daemon) return u } func (u *PayoutsProcessor) Start() { log.Println("Starting payouts") - if u.mustResolvePayout() { - log.Println("Running with env RESOLVE_PAYOUT=1, now trying to resolve locked payouts") - u.resolvePayouts() - log.Println("Now you have to restart payouts module with RESOLVE_PAYOUT=0 for normal run") + //if u.mustResolvePayout() { + // log.Println("Running with env RESOLVE_PAYOUT=1, now trying to resolve locked payouts") + // u.resolvePayouts() + // log.Println("Now you have to restart payouts module with RESOLVE_PAYOUT=0 for normal run") + // return + //} + + password, _ := prompt.Stdin.PromptPassword("Please enter the password :") + keyjson, err := ioutil.ReadFile(u.config.KeyPath) + if err != nil { + log.Println("failed to read the keyfile at", "keyfile", u.config.KeyPath, "err", err) + return + } + + key, err := keystore.DecryptKey(keyjson, password) + if err != nil { + log.Println("error decrypting ", "err", err) return } + u.privateKey = key.PrivateKey + intv := util.MustParseDuration(u.config.Interval) timer := time.NewTimer(intv) log.Printf("Set payouts interval to %v", intv) @@ -132,13 +157,9 @@ func (u *PayoutsProcessor) process() { if !u.checkPeers() { break } - // Require unlocked account - if !u.isUnlockedAccount() { - break - } // Check if we have enough funds - poolBalance, err := u.rpc.GetBalance(u.config.Address) + poolBalance, err := u.rpc.BalanceAt(context.TODO(), common.HexToAddress(u.config.Address), nil) if err != nil { u.halt = true u.lastFail = err @@ -171,8 +192,52 @@ func (u *PayoutsProcessor) process() { break } - value := hexutil.EncodeBig(amountInWei) - txHash, err := u.rpc.SendTransaction(u.config.Address, login, u.config.GasHex(), u.config.GasPriceHex(), value, u.config.AutoGas) + publicKey := u.privateKey.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) + if !ok { + log.Printf("publicKey") + u.halt = true + u.lastFail = err + break + } + + fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA) + nonce, err := u.rpc.NonceAt(context.TODO(), fromAddress, nil) + if err != nil { + log.Printf("NonceAt") + u.halt = true + u.lastFail = err + break + } + + gasLimit := uint64(21000) // in units + gasPrice, err := u.rpc.SuggestGasPrice(context.Background()) + if err != nil { + log.Printf("SuggestGasPrice") + u.halt = true + u.lastFail = err + break + } + + var data []byte + tx := types.NewTransaction(nonce, common.HexToAddress(login), amountInWei, gasLimit, gasPrice, data) + signedTx, err := types.SignTx(tx, types.NewEIP155Signer(big.NewInt(1337)), u.privateKey) + if err != nil { + log.Printf("SignTx") + u.halt = true + u.lastFail = err + break + } + + err = u.rpc.SendTransaction(context.Background(), signedTx) + if err != nil { + log.Println("SendTransaction", err) + u.halt = true + u.lastFail = err + break + } + + //txHash, err := u.rpc.SendTransaction(privateKey, u.config.Address, login, u.config.GasHex(), u.config.GasPriceHex(), value, u.config.AutoGas) if err != nil { log.Printf("Failed to send payment to %s, %v Shannon: %v. Check outgoing tx for %s in block explorer and docs/PAYOUTS.md", login, amount, err, login) @@ -182,9 +247,9 @@ func (u *PayoutsProcessor) process() { } // Log transaction hash - err = u.backend.WritePayment(login, txHash, amount) + err = u.backend.WritePayment(login, signedTx.Hash().String(), amount) if err != nil { - log.Printf("Failed to log payment data for %s, %v Shannon, tx: %s: %v", login, amount, txHash, err) + log.Printf("Failed to log payment data for %s, %v Shannon, tx: %s: %v", login, amount, signedTx.Hash().String(), err) u.halt = true u.lastFail = err break @@ -192,23 +257,23 @@ func (u *PayoutsProcessor) process() { minersPaid++ totalAmount.Add(totalAmount, big.NewInt(amount)) - log.Printf("Paid %v Shannon to %v, TxHash: %v", amount, login, txHash) + log.Printf("Paid %v Shannon to %v, TxHash: %v", amount, login, signedTx.Hash().String()) // Wait for TX confirmation before further payouts for { - log.Printf("Waiting for tx confirmation: %v", txHash) + log.Printf("Waiting for tx confirmation: %v", signedTx.Hash().String()) time.Sleep(txCheckInterval) - receipt, err := u.rpc.GetTxReceipt(txHash) + receipt, err := u.rpc.TransactionReceipt(context.TODO(), common.HexToHash(signedTx.Hash().String())) if err != nil { - log.Printf("Failed to get tx receipt for %v: %v", txHash, err) + log.Printf("Failed to get tx receipt for %v: %v", signedTx.Hash().String(), err) continue } // Tx has been mined - if receipt != nil && receipt.Confirmed() { - if receipt.Successful() { - log.Printf("Payout tx successful for %s: %s", login, txHash) + if receipt != nil && receipt.Status == 1 { + if receipt.Status == 1 { + log.Printf("Payout tx successful for %s: %s", login, signedTx.Hash().String()) } else { - log.Printf("Payout tx failed for %s: %s. Address contract throws on incoming tx.", login, txHash) + log.Printf("Payout tx failed for %s: %s. Address contract throws on incoming tx.", login, signedTx.Hash().String()) } break } @@ -227,22 +292,22 @@ func (u *PayoutsProcessor) process() { } } -func (self PayoutsProcessor) isUnlockedAccount() bool { - _, err := self.rpc.Sign(self.config.Address, "0x0") - if err != nil { - log.Println("Unable to process payouts:", err) - return false - } - return true -} +//func (self PayoutsProcessor) isUnlockedAccount() bool { +// _, err := self.rpc.Sign(self.config.Address, "0x0") +// if err != nil { +// log.Println("Unable to process payouts:", err) +// return false +// } +// return true +//} func (self PayoutsProcessor) checkPeers() bool { - n, err := self.rpc.GetPeerCount() + n, err := self.rpc.PeerCount(context.TODO()) if err != nil { log.Println("Unable to start payouts, failed to retrieve number of peers from node:", err) return false } - if n < self.config.RequirePeers { + if int64(n) < self.config.RequirePeers { log.Println("Unable to start payouts, number of peers on a node is less than required", self.config.RequirePeers) return false } diff --git a/payouts/unlocker.go b/payouts/unlocker.go index c073ef0b3..48604f2d4 100644 --- a/payouts/unlocker.go +++ b/payouts/unlocker.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereumfair/go-ethereum/common/math" "github.com/sammy007/open-ethereum-pool/rpc" "github.com/sammy007/open-ethereum-pool/storage" @@ -31,8 +31,7 @@ type UnlockerConfig struct { const minDepth = 16 const byzantiumHardForkHeight = 4370000 -var homesteadReward = math.MustParseBig256("5000000000000000000") -var byzantiumReward = math.MustParseBig256("3000000000000000000") +var reward = math.MustParseBig256("2000000000000000000") // Donate 10% from pool fees to developers const donationFee = 10.0 @@ -209,7 +208,7 @@ func (u *BlockUnlocker) handleBlock(block *rpc.GetBlockReply, candidate *storage return err } candidate.Height = correctHeight - reward := getConstReward(candidate.Height) + reward := getConstReward() // Add TX fees extraTxReward, err := u.getExtraRewardForTx(block) @@ -501,20 +500,17 @@ func weiToShannonInt64(wei *big.Rat) int64 { return value } -func getConstReward(height int64) *big.Int { - if height >= byzantiumHardForkHeight { - return new(big.Int).Set(byzantiumReward) - } - return new(big.Int).Set(homesteadReward) +func getConstReward() *big.Int { + return new(big.Int).Set(reward) } func getRewardForUncle(height int64) *big.Int { - reward := getConstReward(height) + reward := getConstReward() return new(big.Int).Div(reward, new(big.Int).SetInt64(32)) } func getUncleReward(uHeight, height int64) *big.Int { - reward := getConstReward(height) + reward := getConstReward() k := height - uHeight reward.Mul(big.NewInt(8-k), reward) reward.Div(reward, big.NewInt(8)) diff --git a/proxy/blocks.go b/proxy/blocks.go index cf06ce8a6..2849ce098 100644 --- a/proxy/blocks.go +++ b/proxy/blocks.go @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereumfair/go-ethereum/common" "github.com/sammy007/open-ethereum-pool/rpc" "github.com/sammy007/open-ethereum-pool/util" diff --git a/proxy/miner.go b/proxy/miner.go index 8d312f9d8..79d805cb7 100644 --- a/proxy/miner.go +++ b/proxy/miner.go @@ -6,8 +6,8 @@ import ( "strconv" "strings" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/common" + "github.com/FranckStone/ethash" + "github.com/ethereumfair/go-ethereum/common" ) var hasher = ethash.New() diff --git a/rpc/rpc.go b/rpc/rpc.go index 96137bb77..226e58ace 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -12,8 +12,7 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common" - + "github.com/ethereumfair/go-ethereum/common" "github.com/sammy007/open-ethereum-pool/util" ) @@ -177,7 +176,7 @@ func (r *RPCClient) GetBalance(address string) (*big.Int, error) { func (r *RPCClient) Sign(from string, s string) (string, error) { hash := sha256.Sum256([]byte(s)) - rpcResp, err := r.doPost(r.Url, "eth_sign", []string{from, common.ToHex(hash[:])}) + rpcResp, err := r.doPost(r.Url, "eth_sign", []string{from, common.Bytes2Hex(hash[:])}) var reply string if err != nil { return reply, err diff --git a/util/util.go b/util/util.go index b4219c52e..78e053cb0 100644 --- a/util/util.go +++ b/util/util.go @@ -6,8 +6,8 @@ import ( "strconv" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereumfair/go-ethereum/common" + "github.com/ethereumfair/go-ethereum/common/math" ) var Ether = math.BigPow(10, 18) @@ -35,7 +35,7 @@ func MakeTimestamp() int64 { func GetTargetHex(diff int64) string { difficulty := big.NewInt(diff) diff1 := new(big.Int).Div(pow256, difficulty) - return string(common.ToHex(diff1.Bytes())) + return string(common.Bytes2Hex(diff1.Bytes())) } func TargetHexToDiff(targetHex string) *big.Int { diff --git a/www/config/environment.js b/www/config/environment.js index c3fcf8a9a..e81d1147f 100644 --- a/www/config/environment.js +++ b/www/config/environment.js @@ -15,14 +15,14 @@ module.exports = function(environment) { APP: { // API host and port - ApiUrl: '//example.net/', + ApiUrl: '//127.0.0.1/', // HTTP mining endpoint - HttpHost: 'http://example.net', + HttpHost: 'http://127.0.0.1', HttpPort: 8888, // Stratum mining endpoint - StratumHost: 'example.net', + StratumHost: '127.0.0.1', StratumPort: 8008, // Fee and payout details diff --git a/www/package.json b/www/package.json index 9aebf089f..526978630 100644 --- a/www/package.json +++ b/www/package.json @@ -9,7 +9,7 @@ }, "scripts": { "build": "ember build", - "start": "ember server", + "start": "ember server --port 8082 --environment development", "test": "ember test" }, "repository": "",