Skip to content

Commit

Permalink
Merge pull request #5 from PowPool/xmr-0.18
Browse files Browse the repository at this point in the history
monero node v0.18 support.
  • Loading branch information
mutalisk999 authored Oct 24, 2023
2 parents 1287d7a + e2f957c commit 4633784
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 1,346 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ High performance CryptoNote mining stratum with Web-interface written in Golang.

Dependencies:

* go-1.15
* go-1.17
* Everything required to build Monero
* Monero >= **v0.17.0.0** and Monero <= **v0.17.3.2** ~~(sometimes `master` branch required)~~
* Monero >= **v0.18.3.1** (sometimes `master` branch required)

### Linux

Use Ubuntu 16.04 LTS.

sudo apt-get install libssl-dev
sudo apt-get install git cmake build-essential pkg-config libboost-all-dev libreadline-dev doxygen libsodium-dev libzmq5-dev
sudo apt-get install liblmdb-dev libevent-dev libjson-c-dev uuid-dev
sudo apt-get install liblmdb-dev libevent-dev libjson-c-dev uuid-dev libunbound-dev

Use Ubuntu 18.04 LTS.

sudo apt-get install libssl1.0-dev
sudo apt-get install git cmake build-essential pkg-config libboost-all-dev libreadline-dev doxygen libsodium-dev libzmq5-dev
sudo apt-get install liblmdb-dev libevent-dev libjson-c-dev uuid-dev
sudo apt-get install liblmdb-dev libevent-dev libjson-c-dev uuid-dev libunbound-dev


Compile Monero source (with shared libraries option):

git clone --recursive https://github.com/monero-project/monero.git
cd monero
git checkout tags/v0.17.0.0 -b v0.17.0.0
git checkout tags/v0.18.3.1 -b v0.18.3.1
cmake -DBUILD_SHARED_LIBS=1 -DMANUAL_SUBMODULES=1 .
make

Expand Down Expand Up @@ -72,7 +72,7 @@ Compile Monero source:

git clone --recursive https://github.com/monero-project/monero.git
cd monero
git checkout tags/v0.17.0.0 -b v0.17.0.0
git checkout tags/v0.18.3.1 -b v0.18.3.1
cmake .
make

Expand All @@ -88,6 +88,7 @@ Clone stratum:
Build stratum:

MONERO_DIR=[path_of_monero]
go mod tidy -compat="1.17"
cmake .
make
make -f Makefile_build_info
Expand Down
39 changes: 36 additions & 3 deletions blocktemplate/blocktemplateblob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,42 @@ import (
"testing"
)

// Version <= 15
//func TestBlockTemplateBlob_Pack_UnPack(t *testing.T) {
// blkTplBlobBytes, _ := hex.DecodeString("0e0eaed588840682dbba38bcf57bd78890057228be34a3b9115196f13a657228e53d05ee9a139f00000000028d938f0101ffd1928f01018bfef5f2e01e021944aa4583c1391a8613da7541f46fa98f3af5497f9b7b4326f6fa65542539b42501bfe3409fa63317d985b54cb5bea119d9a616e075c4da4434122b7bcb7f7b21f2020200000021c456003efc5fe6e092317280b61db6e6dad76d4b6065ca6a41dd1e854ce1fbe2872b088cdbedec0f75e58ba6a5316c17297d3fb16a4ff2a7987068b423a32c233ddedf317dea55b0357193eb5265539ffeb6e1fb84692f26e604a9b14d3cc313f34b943f535f7a9d1e783a3c2fc49f22f02e41b0c8bb15a3b85ce0904c33178b5d784d81fe9f442c80b337132fe174612fce7e856bd846175a9c6d93dde48cc272768dd7a24e584e5c99fc3a2b637d70d8ae05582a9810d54e1e3984bb15ec3c667180e9e39aed36ade5ee8114629e2c7d042a6616c03680e34ac443ee85ccd8aba9375dc31d3042f7e7ed8be9cf32144acbccc3f6161c69d31171e349bbc24bb39ccd382d161afd4819d4fdb414069eeafd4528414d0d2e3a3f54de43bb9e7578877fc6557cc407d4d951b91137bf58d270cfd94daed4e8d2311d38b91136d8caa492ebe28b2dd68aa29c635d1e2ae6ef618a4b5704b22e5f771128357d57495509600c647ad377c3fc1e6ceed44c16f13c4bcd17f962036380d7322c50d2643f5ce039e72a381189e9fec00f5bd913c939dd0e56503e712aff681b6790132ee3cc66c74535640952cc9247af9e9590dc396869d8fe547a0fbad619d714d02268dbe9e65e68136e3d55eb309b373a50b0b91866383efc0ce386fe22c153690fd6c4fff34cabc3bb4bf50c1d3a9cb8ca3a4a65040ff36423d752d1c750cdf139912de24fe8e87597b886c085a005d8af9fd12eb0060e6e520a5c36e2a72e40f06fbf4b271a72c689b9d39c1d5f2603974524620d21f4157eefbe4c99454a7a33207a717be5f6ca19ec5eb31e70c6a3ff80fc3a6968fe0e3275c2ce7642ebd2cc2062090b8e2bf120089a90e2f4666acfe9d5ff8f9c72f3e29f0be0e34bc933b5ea329b0d471b15423f21a6430a4dedf976de32fcef74b2dc297b33bbca0e323736addead03f7bfd9f8834bb44bfd51e1a9e4a67462be81019e9ee97abdb0bdff749368c79f8874b52cf15b483916757062561b12778948d513fd2aa7a90d89846d8424cda47e90897e3e2c5e75503c288847cc1f57802bee6ef3a8d8366176d6787cf765f848bef490ad732545d10256bc43ec1e8b83b53ac12695373a1ca07aa90ba540bf0587aa632543d640ba5496c848c4ec203602389197a91a038cc02ca26c322ce014dda5190b56497040e2465e9c5c0e9e02be58c78c7076b7854c81761a1bae6b97b6923ce4ca44b4ae2ff5cb2708d4202d7bd74a4883af60db92e5c46fc10830d9e599111e39873abde9362b44ead85e19db70a0ca91097daac1b89b68c056c7f965df49913c9bbaee0542554afcf339b49079b2c99b8ba6efa9a56f4672ed02f7bdb7384d4953bf219f5b4018cd2f4fb67fa7e01d910d432c44bf39f4bf30b035e5078d588a2e1ab1447d13c1f41b1c4493d1ae476721f3dd621038df916b270f77fbe7b1d828c266469b049faa731c79cabe82b155daad5701ca")
// bytesBuf := bytes.NewBuffer(blkTplBlobBytes)
// bufReader := io.Reader(bytesBuf)
// var blkTplBlob BlockTemplateBlob
// err := blkTplBlob.UnPack(bufReader)
// if err != nil {
// t.Fatal(err)
// }
// voutCnt := len(blkTplBlob.Block.MinerTx.Vout)
// fmt.Println("vout count:", voutCnt)
// if voutCnt > 0 {
// fmt.Println("block reward:", blkTplBlob.Block.MinerTx.Vout[0].Amount)
// }
// fmt.Println("tx hash count:", len(blkTplBlob.Block.TxHashes))
//
// bytesBuf = bytes.NewBuffer([]byte{})
// bufWriter := io.Writer(bytesBuf)
// err = blkTplBlob.Pack(bufWriter)
// if err != nil {
// t.Fatal(err)
// }
// fmt.Println("block template blob hex:", hex.EncodeToString(bytesBuf.Bytes()))
//}

// Version > 15
func TestBlockTemplateBlob_Pack_UnPack(t *testing.T) {
blkTplBlobBytes, _ := hex.DecodeString("0e0eaed588840682dbba38bcf57bd78890057228be34a3b9115196f13a657228e53d05ee9a139f00000000028d938f0101ffd1928f01018bfef5f2e01e021944aa4583c1391a8613da7541f46fa98f3af5497f9b7b4326f6fa65542539b42501bfe3409fa63317d985b54cb5bea119d9a616e075c4da4434122b7bcb7f7b21f2020200000021c456003efc5fe6e092317280b61db6e6dad76d4b6065ca6a41dd1e854ce1fbe2872b088cdbedec0f75e58ba6a5316c17297d3fb16a4ff2a7987068b423a32c233ddedf317dea55b0357193eb5265539ffeb6e1fb84692f26e604a9b14d3cc313f34b943f535f7a9d1e783a3c2fc49f22f02e41b0c8bb15a3b85ce0904c33178b5d784d81fe9f442c80b337132fe174612fce7e856bd846175a9c6d93dde48cc272768dd7a24e584e5c99fc3a2b637d70d8ae05582a9810d54e1e3984bb15ec3c667180e9e39aed36ade5ee8114629e2c7d042a6616c03680e34ac443ee85ccd8aba9375dc31d3042f7e7ed8be9cf32144acbccc3f6161c69d31171e349bbc24bb39ccd382d161afd4819d4fdb414069eeafd4528414d0d2e3a3f54de43bb9e7578877fc6557cc407d4d951b91137bf58d270cfd94daed4e8d2311d38b91136d8caa492ebe28b2dd68aa29c635d1e2ae6ef618a4b5704b22e5f771128357d57495509600c647ad377c3fc1e6ceed44c16f13c4bcd17f962036380d7322c50d2643f5ce039e72a381189e9fec00f5bd913c939dd0e56503e712aff681b6790132ee3cc66c74535640952cc9247af9e9590dc396869d8fe547a0fbad619d714d02268dbe9e65e68136e3d55eb309b373a50b0b91866383efc0ce386fe22c153690fd6c4fff34cabc3bb4bf50c1d3a9cb8ca3a4a65040ff36423d752d1c750cdf139912de24fe8e87597b886c085a005d8af9fd12eb0060e6e520a5c36e2a72e40f06fbf4b271a72c689b9d39c1d5f2603974524620d21f4157eefbe4c99454a7a33207a717be5f6ca19ec5eb31e70c6a3ff80fc3a6968fe0e3275c2ce7642ebd2cc2062090b8e2bf120089a90e2f4666acfe9d5ff8f9c72f3e29f0be0e34bc933b5ea329b0d471b15423f21a6430a4dedf976de32fcef74b2dc297b33bbca0e323736addead03f7bfd9f8834bb44bfd51e1a9e4a67462be81019e9ee97abdb0bdff749368c79f8874b52cf15b483916757062561b12778948d513fd2aa7a90d89846d8424cda47e90897e3e2c5e75503c288847cc1f57802bee6ef3a8d8366176d6787cf765f848bef490ad732545d10256bc43ec1e8b83b53ac12695373a1ca07aa90ba540bf0587aa632543d640ba5496c848c4ec203602389197a91a038cc02ca26c322ce014dda5190b56497040e2465e9c5c0e9e02be58c78c7076b7854c81761a1bae6b97b6923ce4ca44b4ae2ff5cb2708d4202d7bd74a4883af60db92e5c46fc10830d9e599111e39873abde9362b44ead85e19db70a0ca91097daac1b89b68c056c7f965df49913c9bbaee0542554afcf339b49079b2c99b8ba6efa9a56f4672ed02f7bdb7384d4953bf219f5b4018cd2f4fb67fa7e01d910d432c44bf39f4bf30b035e5078d588a2e1ab1447d13c1f41b1c4493d1ae476721f3dd621038df916b270f77fbe7b1d828c266469b049faa731c79cabe82b155daad5701ca")
blkTplBlobBytes, _ := hex.DecodeString("10109df7dca9061dd1d6911ec6dd13b78763a6c342850802ae49e19766898d796859691d2ab79b0000000002a8a2b70101ffeca1b70101c0a6da908112036f969be1f69e36b42cd8ba9726f8cf08b3da668b8b5000e9d09c3dbbe101e3ce875f0193e957dca32e3672d3251b1d262fe98a774cd1c9f1ada4f7cd7dab67d091ebe7023c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b726122b5667173cb46e217f0433d7862b7fe2a96911d72032030f88f9ea5c57623435f9d778930a50dd4017c8472fda387c8c007edc43867a52c0d0b3879cd5c73a167e5314cf53d6204b42c40dc7436381f4020e5a138b6241f27c1f7914e34dfee4d2a7584a5f00ce8e5806053f763e038b796708fc9e1435ef45a82365444ee9627c99d43a4987552132b277339c943813627a53ef31a3340cc82b5278ac0cd180ac1443f43b2da33906c34a85b3e9b9b7d1c2ce695c2c9aafa610d440dc430872edec08cb6aaf1550937a38569b7c60fae1aa1bbce192fe185df1f229957061cab9c9c893a1ac9820a233f19c5835f19ba837aa24db417ef709fd8ad74f0caee32c481617bb3ad7b3126dfc9a689eb5c85b2a83b86afc9d8b4ee5205f03a466e8c1f6098a50953616c26adc777f678964205049f0fc03f21826a501b7d41d4bcf491b3ceab1d7c0b9abbc12ad7b6a6fc57fc0351341c1cd82e45f2018ce93c09cbc19ec5b56fa42483cf0dcf5861ba7dd9985d4faeca0134c4de711701adda9502cce0b0c0671feca7576c8ddc278d9e0ccd6fea4a32e17894f427a05970fc01a18323c8178c6cf5c64c7d804bee2ef30f439147532e1592e62212a16bf68820b6ddec01c4dad132fb24de2c9271bf33e8fbf7a7a541f5c201ca740eac59c1e5cee8757afa08ee366c4dbabde54d80cc57870dd054f493863de52f13ff1275a6bde3db3e885f75ecde4c6693e9ebaa6e954c80e30a3794da5f09ab8e90be3958aa00215c6329fc1b46752f14732443b951ced60cc6183223c7aa8cd19aa31b03b1fb05b6e355e624cd5cbccc4d0510380cfbe47bf6797097eb260c509a4c0a152b32ab2993900422bc7c80f5cb3bcb6fa3742c44b9469816f5de5ed344a6a5803ec00770b3a9f582389e577bd3ee544a18be2f387dfdd674023ae7cc2d8faec876d9b6b4809ae1d0d91ee01269122f195da6ae5dd55da3089c10def9fcae21b2f5da32507e8f94875ebdf2baa6106b468bc56da6c704e52131985589a57b382d7ec4705d2310bd280bf0ee068e2d8a28a2aa6c3cb67abe5e616f64e5ac34de273175d097c1616130f8b937dfba233b1b1c26538d965b9452d9927d6dc65cda1bb15ed87cf5e3708d1344897f0b1ebda31c91675a957b8ff0634a6afac42f4e4746fbfb64bc38b18183c73bab581e22b044e1d689b1efd54a179a5958a226412181edcd298fe0483e42edc2158e0aaa5c2849a466a685e83f5ae155163623e2edd0ff6d397d1267ec6fb9f58fc92e2c55ab91bf644676b228ced843ecc9a447484b797aaa1ac0435144486f05120e1c8e523411bde5b9cd9dbace4cfb88c26f93a46dcb4aab9c7b5a047fe51d507fcecc7fd188c0e41f696ff25430be329c68a7124ace9557e7fa6578fe0a87e5907d412824faaa9e0f46c449850b298b503a11adc1176b77158af19860008c8af7340a1967c215292aa384e6c65f9aceba1b8d808ea8412a962d6558558f9fc0e40163bc1d8fddc519165c49129a557a434e518dee6ff43ff38ac0425e2896e24dda62aba157070188556ef3fb50d7a007df6721fa27eb88171b82a16a49a989faab2c12bd02bded32d3c6f6ce04fb2931ec2f9ac4324feb858392fb71fac5cb94cb86af1a1141eb1aacabe41735469dbf090c201601dc8cd2030383f6d02957ff53820e8793ecd0d26938ded1ccc013fe3b6ef060424e8aa0ddc50c3cf1b9e40e4a923cce64d52979270036f1e9a9f69cc43f8a329b512509f5a5198bb62497c32a6f13217a60d168ba5f4e85f0781f65da8ad0abf279f77707cd38d48ca759ee3c51b8c15fea31e4e67e9be128fd25309f6e97a995ad9bc0b06aa6c07b3491811395f37386641f3720718a68505eef8868e094ae51304f06eb217af24bdd53aae1978fdfb527a5dc95aaa021654a98e2")
bytesBuf := bytes.NewBuffer(blkTplBlobBytes)
bufReader := io.Reader(bytesBuf)
var blkTplBlob BlockTemplateBlob
_ = blkTplBlob.UnPack(bufReader)
err := blkTplBlob.UnPack(bufReader)
if err != nil {
t.Fatal(err)
}
voutCnt := len(blkTplBlob.Block.MinerTx.Vout)
fmt.Println("vout count:", voutCnt)
if voutCnt > 0 {
Expand All @@ -23,6 +53,9 @@ func TestBlockTemplateBlob_Pack_UnPack(t *testing.T) {

bytesBuf = bytes.NewBuffer([]byte{})
bufWriter := io.Writer(bytesBuf)
_ = blkTplBlob.Pack(bufWriter)
err = blkTplBlob.Pack(bufWriter)
if err != nil {
t.Fatal(err)
}
fmt.Println("block template blob hex:", hex.EncodeToString(bytesBuf.Bytes()))
}
15 changes: 13 additions & 2 deletions blocktemplate/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func (t *TxInGen) UnPack(reader io.Reader) error {
}

type TxOutGen struct {
Amount uint64
PubKey CryptoPubKey
Amount uint64
PubKey CryptoPubKey
ViewTag byte
}

func (t TxOutGen) Pack(writer io.Writer) error {
Expand All @@ -37,6 +38,10 @@ func (t TxOutGen) Pack(writer io.Writer) error {
if err != nil {
return err
}
_, err = writer.Write([]byte{t.ViewTag})
if err != nil {
return err
}
return nil
}

Expand All @@ -50,6 +55,12 @@ func (t *TxOutGen) UnPack(reader io.Reader) error {
if err != nil {
return err
}
s := make([]byte, 1)
_, err = reader.Read(s[0:1])
if err != nil {
return err
}
t.ViewTag = s[0]
return nil
}

Expand Down
11 changes: 9 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ go 1.17

require (
github.com/ethereum/go-ethereum v1.12.1
github.com/garyburd/redigo v1.6.2 // indirect
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d
github.com/gorilla/mux v1.8.0
github.com/mutalisk999/bitcoin-lib v0.0.0-20201203080325-81caed73682f
golang.org/x/crypto v0.9.0
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a // indirect
gopkg.in/redis.v3 v3.6.4
)

require (
github.com/garyburd/redigo v1.6.2 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.28.1 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.8.0 // indirect
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a // indirect
)
Loading

0 comments on commit 4633784

Please sign in to comment.