diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66bf5dc..9fecebc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.23.x" + go-version: "1.25.x" id: go - name: Check out code into the Go module directory diff --git a/crypto/fixtures.go b/crypto/fixtures.go index b722968..cb822c9 100644 --- a/crypto/fixtures.go +++ b/crypto/fixtures.go @@ -1,21 +1,14 @@ -// This file is part of Ark Go Crypto. -// -// (c) Ark Ecosystem -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - package crypto import ( "encoding/json" "fmt" - "io/ioutil" "log" + "os" ) func GetFile(path string) string { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { log.Fatalf("Cannot read file %s: %s", path, err) @@ -64,6 +57,15 @@ func GetBLSKeysFixture() []BLSKeyFixture { return fixtures } +func GetTransactionFixture(name string) TestingTransactionFixture { + data := GetFile(fmt.Sprintf("./fixtures/transactions/%s.json", name)) + + var fixture TestingTransactionFixture + _ = json.Unmarshal([]byte(data), &fixture) + + return fixture +} + type TestingIdentityFixture struct { Data struct { PrivateKey string `json:"privateKey,omitempty"` @@ -93,3 +95,22 @@ type BLSKeyFixture struct { BLSPrivateKey string `json:"bls_private_key"` Passphrase string `json:"passphrase"` } + +type TestingTransactionFixture struct { + Data struct { + Nonce string `json:"nonce"` + GasPrice string `json:"gasPrice"` + GasLimit string `json:"gasLimit"` + To string `json:"to"` + Value string `json:"value"` + Data string `json:"data"` + Network int `json:"network"` + V int `json:"v"` + R string `json:"r"` + S string `json:"s"` + SenderPublicKey string `json:"senderPublicKey"` + From string `json:"from"` + Hash string `json:"hash"` + } `json:"data"` + Serialized string `json:"serialized"` +} diff --git a/crypto/fixtures/transactions/multi_payment.json b/crypto/fixtures/transactions/multi_payment.json new file mode 100644 index 0000000..cfce43b --- /dev/null +++ b/crypto/fixtures/transactions/multi_payment.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x00EFd0D4639191C49908A7BddbB9A11A994A8527", + "value": "300000", + "data": "084ce708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006f0182a0cc707b055322ccf6d4cb6a5aff1aeb22000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000030d40", + "network": 11812, + "v": 1, + "r": "9720cd5959af4fc513ec8f9c55a3f3b53a1f24a3a577e8132cadd81c116c6c82", + "s": "3411570db14d5e1a6673b2e80fe6cc22bf67752808ac4752c8bcfd9732e33dc8", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "f603e0b5fe0743021d2879ffe53ace7b40c9d823edbf058bd25a045753c82aa9" + }, + "serialized": "f901700185012a05f20083030d409400efd0d4639191c49908a7bddbb9a11a994a8527830493e0b90104084ce708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006f0182a0cc707b055322ccf6d4cb6a5aff1aeb22000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000030d40825c6ca09720cd5959af4fc513ec8f9c55a3f3b53a1f24a3a577e8132cadd81c116c6c82a03411570db14d5e1a6673b2e80fe6cc22bf67752808ac4752c8bcfd9732e33dc8" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/multi_payment/multi-payment-multi-sign.json b/crypto/fixtures/transactions/multi_payment/multi-payment-multi-sign.json deleted file mode 100644 index d082f0d..0000000 --- a/crypto/fixtures/transactions/multi_payment/multi-payment-multi-sign.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 6, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "3", - "asset": { - "payments": [ - { - "amount": "1", - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A" - }, - { - "amount": "2", - "recipientId": "0x27FA7CaFFaAE77dDb9AB232FDBDa56D5e5Af2393" - } - ] - }, - "signature": "cf4e94776e768110e62961747f39b68993d4ff5ec2171cad2fab6d77babb2ce31181f005876031d43e6d7732770c6aca73b33057c7aad6279cf2da03829a7b62", - "signatures": [ - "006581c24bbe49e57127604b18d2efdd8d1d2bfe23f9b1e7f15b3f46a647b976e79884b61331546c5844ded781974e181a03a4066f858020fb347ad9628773b465", - "011fb86a8ddbddbed012ff46fc0f3c9a30f3c1544d7a32b9355c318ad453837615e8399f676856c97cf6dcb8d18507ff9c0ffe195d23624e296182477644ed3689", - "023aa80e3663d737716818978ffbae59a8a9f32257a341e1391ca1e0fd744f3382b41e507dca92fa91f98e2024b67938420aaf0c268266dfe4d1f92e81cb3a0421" - ], - "id": "5349b6d57228cb2aeb77e198d6adc93f745e3abb9b4624929b7e29f4a920c0a5" - }, - "serializedHex": "ff011e0100000006000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d380969800000000000002000100000000000000b693449adda7efc015d87944eae8b7c37eb1690a020000000000000027fa7caffaae77ddb9ab232fdbda56d5e5af2393cf4e94776e768110e62961747f39b68993d4ff5ec2171cad2fab6d77babb2ce31181f005876031d43e6d7732770c6aca73b33057c7aad6279cf2da03829a7b62006581c24bbe49e57127604b18d2efdd8d1d2bfe23f9b1e7f15b3f46a647b976e79884b61331546c5844ded781974e181a03a4066f858020fb347ad9628773b465011fb86a8ddbddbed012ff46fc0f3c9a30f3c1544d7a32b9355c318ad453837615e8399f676856c97cf6dcb8d18507ff9c0ffe195d23624e296182477644ed3689023aa80e3663d737716818978ffbae59a8a9f32257a341e1391ca1e0fd744f3382b41e507dca92fa91f98e2024b67938420aaf0c268266dfe4d1f92e81cb3a0421" -} diff --git a/crypto/fixtures/transactions/multi_payment/multi-payment-sign.json b/crypto/fixtures/transactions/multi_payment/multi-payment-sign.json deleted file mode 100644 index b28d7f7..0000000 --- a/crypto/fixtures/transactions/multi_payment/multi-payment-sign.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 6, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "3", - "asset": { - "payments": [ - { - "amount": "1", - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A" - }, - { - "amount": "2", - "recipientId": "0x27FA7CaFFaAE77dDb9AB232FDBDa56D5e5Af2393" - } - ] - }, - "signature": "e782cc5a7622ea23463aa3d6795850b7163abf6b02c29795f9230f4b0537404cbccf82de6a44ecf6e98391bff601f033524c8704f4081ada4f72e98aea5ae173", - "id": "c820af7342cde48a2d578e6324329fc557ffb4e40fa3208b348cf07fd2020e43" - }, - "serializedHex": "ff011e0100000006000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d380969800000000000002000100000000000000b693449adda7efc015d87944eae8b7c37eb1690a020000000000000027fa7caffaae77ddb9ab232fdbda56d5e5af2393e782cc5a7622ea23463aa3d6795850b7163abf6b02c29795f9230f4b0537404cbccf82de6a44ecf6e98391bff601f033524c8704f4081ada4f72e98aea5ae173" -} diff --git a/crypto/fixtures/transactions/multi_payment/multi-payment-with-vendor-field-sign.json b/crypto/fixtures/transactions/multi_payment/multi-payment-with-vendor-field-sign.json deleted file mode 100644 index 7c8a631..0000000 --- a/crypto/fixtures/transactions/multi_payment/multi-payment-with-vendor-field-sign.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 6, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "3", - "vendorField": "this is a top secret vendor field", - "asset": { - "payments": [ - { - "amount": "1", - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A" - }, - { - "amount": "2", - "recipientId": "0x27FA7CaFFaAE77dDb9AB232FDBDa56D5e5Af2393" - } - ] - }, - "signature": "ff68aa386548aba97004d99d616d5bdd1f13074dd85fdb0ab636d18585d4436030f66f42fa257c2b18873a076906af31a2b3b838081d9ec79f685f32d4640955", - "id": "4c759d085999e25996e2af264c79aac76c44e48d3f5f2432c56d8a2e4fd99349" - }, - "serializedHex": "ff011e0100000006000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d380969800000000002174686973206973206120746f70207365637265742076656e646f72206669656c6402000100000000000000b693449adda7efc015d87944eae8b7c37eb1690a020000000000000027fa7caffaae77ddb9ab232fdbda56d5e5af2393ff68aa386548aba97004d99d616d5bdd1f13074dd85fdb0ab636d18585d4436030f66f42fa257c2b18873a076906af31a2b3b838081d9ec79f685f32d4640955" -} diff --git a/crypto/fixtures/transactions/multi_signature_registration/multi-signature-registration-sign.json b/crypto/fixtures/transactions/multi_signature_registration/multi-signature-registration-sign.json deleted file mode 100644 index 7917664..0000000 --- a/crypto/fixtures/transactions/multi_signature_registration/multi-signature-registration-sign.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 4, - "nonce": "2", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "500000000", - "amount": "0", - "asset": { - "multiSignature": { - "min": 2, - "publicKeys": [ - "029fab3cb2f5e248ae7cbb4de646741da4d73c493b2a03ab5c71507fb2c0dcca92", - "03629f9dbf7f1e91cefa845126189816ceae357bdd1f41bd14787318a7d5b55d48", - "027941d2059f89a26d89e87d3385e261a0ede1234aaeaa487012b69d6b67962dc5" - ] - } - }, - "signature": "2b33558cdc62933ff56feb646d1f47a98104bf34b894895d5e816f86e556f87fce8485e55aa32dfa1cd86456a66a58ef7a68dff4af51e2f7fcf75b983540872e", - "signatures": [ - "000caa6864c71362b369c71107f463f29c43c361e54260cbc54d791b7385dbe76f29d12b9befbe4f98792d7046481afcf0c156408310192a93d8413e5380438f27", - "0153a22c5ce2b1894f0a141adc19de567077d2d268f4c7e1476e9558ecb4411d486cd0d7aa3e9c7716739a055a8a1a64a162d0362645d63d13791a9876ef8b5a88", - "021d56997f0c9e21201c59e1b7b6be8d5a609908a4f65bf266144baf5e61e3f14bc2651f62187f4ffa17c8b010fcb0fba94a04df56bc25e5cb20935ec5fb7ad632" - ], - "id": "1941926b880ab606633b3a2361df784f6085ded8b5d3cf52e94998e1468b3197" - }, - "serializedHex": "ff011e0100000004000200000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d30065cd1d00000000000203029fab3cb2f5e248ae7cbb4de646741da4d73c493b2a03ab5c71507fb2c0dcca9203629f9dbf7f1e91cefa845126189816ceae357bdd1f41bd14787318a7d5b55d48027941d2059f89a26d89e87d3385e261a0ede1234aaeaa487012b69d6b67962dc52b33558cdc62933ff56feb646d1f47a98104bf34b894895d5e816f86e556f87fce8485e55aa32dfa1cd86456a66a58ef7a68dff4af51e2f7fcf75b983540872e000caa6864c71362b369c71107f463f29c43c361e54260cbc54d791b7385dbe76f29d12b9befbe4f98792d7046481afcf0c156408310192a93d8413e5380438f270153a22c5ce2b1894f0a141adc19de567077d2d268f4c7e1476e9558ecb4411d486cd0d7aa3e9c7716739a055a8a1a64a162d0362645d63d13791a9876ef8b5a88021d56997f0c9e21201c59e1b7b6be8d5a609908a4f65bf266144baf5e61e3f14bc2651f62187f4ffa17c8b010fcb0fba94a04df56bc25e5cb20935ec5fb7ad632" -} diff --git a/crypto/fixtures/transactions/transfer.json b/crypto/fixtures/transactions/transfer.json new file mode 100644 index 0000000..6fe549e --- /dev/null +++ b/crypto/fixtures/transactions/transfer.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "21000", + "to": "0x6F0182a0cc707b055322CcF6d4CB6a5Aff1aEb22", + "value": "100000000", + "data": "", + "network": 11812, + "v": 0, + "r": "a1f79cb40a4bb409d6cebd874002ceda3ec0ccb614c1d8155f5c2f7f798135f9", + "s": "2d2ef517aaf6feed747385e260c206f46b2ce9d6b2a585427a111685a097bd79", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "a39435ec5de418e77479856d06a653efc171afe43e091472af22ee359eeb83be" + }, + "serialized": "f86a0185012a05f200825208946f0182a0cc707b055322ccf6d4cb6a5aff1aeb228405f5e10080825c6ba0a1f79cb40a4bb409d6cebd874002ceda3ec0ccb614c1d8155f5c2f7f798135f9a02d2ef517aaf6feed747385e260c206f46b2ce9d6b2a585427a111685a097bd79" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/transfer/transfer-multi-sign.json b/crypto/fixtures/transactions/transfer/transfer-multi-sign.json deleted file mode 100644 index bc98998..0000000 --- a/crypto/fixtures/transactions/transfer/transfer-multi-sign.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 0, - "nonce": "1", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "1", - "expiration": 0, - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A", - "signature": "f25db2b781b79f671b7848284de63f3cb898f9938c0b6203a11cace4aaa4b962eabe9c4a67c207a3f8baea3b4f4cef90a0b67a2bfd84cd61dcc771597f52656d", - "signatures": [ - "005afa0050c85a2ac9b34accb0f47c6a9cc9eee831ac713e62e846898d1b75d6a33034680bce95f638c6dfabf8056f8afa9ef73a3c35741234faf01d0a346e3e7d", - "0104bd019e5a6ea9ee5cc41d9f39efe2a2df2cc653369fdfcb56d5219fa282a8368067586748feb2483883c9eca50a5ae73abd7139d4d1885914ed9d5e5c63f8fb", - "02d6af0f5a85a7967d677b2f1f86e00b8ca37facb714467e12810a692d5bcbdfcac4e4c2d4b79a70c7366405339bf84a854308d20cb48652816a9cf37fb3e86e00" - ], - "id": "dcb9d29590313cf6e1b53f120e621e34c39e45fce9114272158036cb99be9c89" - }, - "serializedHex": "ff011e0100000000000100000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3809698000000000000010000000000000000000000b693449adda7efc015d87944eae8b7c37eb1690af25db2b781b79f671b7848284de63f3cb898f9938c0b6203a11cace4aaa4b962eabe9c4a67c207a3f8baea3b4f4cef90a0b67a2bfd84cd61dcc771597f52656d005afa0050c85a2ac9b34accb0f47c6a9cc9eee831ac713e62e846898d1b75d6a33034680bce95f638c6dfabf8056f8afa9ef73a3c35741234faf01d0a346e3e7d0104bd019e5a6ea9ee5cc41d9f39efe2a2df2cc653369fdfcb56d5219fa282a8368067586748feb2483883c9eca50a5ae73abd7139d4d1885914ed9d5e5c63f8fb02d6af0f5a85a7967d677b2f1f86e00b8ca37facb714467e12810a692d5bcbdfcac4e4c2d4b79a70c7366405339bf84a854308d20cb48652816a9cf37fb3e86e00" -} diff --git a/crypto/fixtures/transactions/transfer/transfer-sign.json b/crypto/fixtures/transactions/transfer/transfer-sign.json deleted file mode 100644 index 2a59087..0000000 --- a/crypto/fixtures/transactions/transfer/transfer-sign.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 0, - "nonce": "1", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "1", - "expiration": 0, - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A", - "signature": "97dd98ed1066aab76011114cbf5ac00d741812cac326cda7966e1af08874d7212f350d769221d2a78ea185d77ac4e2c5c718e4a84b1a1ddcbf504d642eb94b6a", - "id": "e20265dba26594c4202e224e8d1069dfae840a8db7cc6acfafefa2b3b02787e5" - }, - "serializedHex": "ff011e0100000000000100000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3809698000000000000010000000000000000000000b693449adda7efc015d87944eae8b7c37eb1690a97dd98ed1066aab76011114cbf5ac00d741812cac326cda7966e1af08874d7212f350d769221d2a78ea185d77ac4e2c5c718e4a84b1a1ddcbf504d642eb94b6a" -} diff --git a/crypto/fixtures/transactions/transfer/transfer-with-vendor-field-sign.json b/crypto/fixtures/transactions/transfer/transfer-with-vendor-field-sign.json deleted file mode 100644 index e520639..0000000 --- a/crypto/fixtures/transactions/transfer/transfer-with-vendor-field-sign.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 0, - "nonce": "1", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "10000000", - "amount": "1", - "vendorField": "this is a top secret vendor field", - "expiration": 0, - "recipientId": "0xb693449AdDa7EFc015D87944EAE8b7C37EB1690A", - "signature": "d7062dd749406741ab848cc0bb6bcc82c04d8b46b699803154a30bda8d13bd6dc6c06fcbbb6a6edab3b83772008e50524b4563a33c0f08009b4cc72f38986981", - "id": "59cc59e3609f86418ef04fff270fb0f59ea2ff5a383857a3c157056f0925d59d" - }, - "serializedHex": "ff011e0100000000000100000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d380969800000000002174686973206973206120746f70207365637265742076656e646f72206669656c64010000000000000000000000b693449adda7efc015d87944eae8b7c37eb1690ad7062dd749406741ab848cc0bb6bcc82c04d8b46b699803154a30bda8d13bd6dc6c06fcbbb6a6edab3b83772008e50524b4563a33c0f08009b4cc72f38986981" -} diff --git a/crypto/fixtures/transactions/unvote.json b/crypto/fixtures/transactions/unvote.json new file mode 100644 index 0000000..8708e36 --- /dev/null +++ b/crypto/fixtures/transactions/unvote.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1", + "value": "0", + "data": "3174b689", + "network": 11812, + "v": 0, + "r": "7e05d686131973a9fbda9028f9df5702d9a229823b183caac03ec3a874ccec52", + "s": "1980fbc959612d8c7b97f6f16742259635f42a2039839a81aaaeb7ae6930a5f5", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "38d018d22e2cef185dc3c2f5d25ec63535160d8dfeaf78da8db719cb7ffc730d" + }, + "serialized": "f86b0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e180843174b689825c6ba07e05d686131973a9fbda9028f9df5702d9a229823b183caac03ec3a874ccec52a01980fbc959612d8c7b97f6f16742259635f42a2039839a81aaaeb7ae6930a5f5" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/username_registration.json b/crypto/fixtures/transactions/username_registration.json new file mode 100644 index 0000000..afe110d --- /dev/null +++ b/crypto/fixtures/transactions/username_registration.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6", + "value": "0", + "data": "36a94134000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000076669787475726500000000000000000000000000000000000000000000000000", + "network": 11812, + "v": 1, + "r": "80c77145c6b5450f4805e7c7b649b49653d151ca74275991ae49731084e35049", + "s": "1a25084fb0e997f93d9cc84472281f01c3e1fdeb15c29abf24f3469aeaac87c1", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "0fd23793ced45b59f54d6250b0d74860fb5960ffc971457c349032cc33cf560a" + }, + "serialized": "f8cc0185012a05f20083030d40942c1de3b4dbb4adebebb5dcecae825be2a9fc6eb680b86436a94134000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000076669787475726500000000000000000000000000000000000000000000000000825c6ca080c77145c6b5450f4805e7c7b649b49653d151ca74275991ae49731084e35049a01a25084fb0e997f93d9cc84472281f01c3e1fdeb15c29abf24f3469aeaac87c1" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/username_registration/username-registration-multi-sign.json b/crypto/fixtures/transactions/username_registration/username-registration-multi-sign.json deleted file mode 100644 index 227356d..0000000 --- a/crypto/fixtures/transactions/username_registration/username-registration-multi-sign.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 8, - "nonce": "6", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "asset": { - "username": "simple_tx_tester" - }, - "signature": "9a74c959d0cd4ad4352292417de3ed8ed0cac9aad390bb5d93a5ef5d2bdbf54dad9bbf690f2079ad397141acd182b6e5c4285bd64b068083431daffd5dbc5b09", - "signatures": [ - "003b5b94d80da3d41f514d77a624f26f7a2336c34ce1ec62f06c61635db31b27135a58b9ee705cbaa45addd6e75098833c80935541ccc050199443a3d4c62c7fdd", - "01335feff7cc3d6e3524dd9892e029d2dea77c76afdeb9445bc0d14c587fd922c6c38e3542b978aeb370dc349b4a1221015f33051407f10ca051a1caa2109fc510", - "02fe8b1d0be5a77455b38f9df31a379e1a80bcab4003a225cbf79d426fcd248e03ff5f499a404d879270086e292aa45ac1af979aa9af4a64e4881ec559fc87e779" - ], - "id": "ffaead0f6003e125bb2a66169e87efe29c05dedaec71898abfcbc7a1f846f2b3" - }, - "serializedHex": "ff011e0100000008000600000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f9029500000000001073696d706c655f74785f7465737465729a74c959d0cd4ad4352292417de3ed8ed0cac9aad390bb5d93a5ef5d2bdbf54dad9bbf690f2079ad397141acd182b6e5c4285bd64b068083431daffd5dbc5b09003b5b94d80da3d41f514d77a624f26f7a2336c34ce1ec62f06c61635db31b27135a58b9ee705cbaa45addd6e75098833c80935541ccc050199443a3d4c62c7fdd01335feff7cc3d6e3524dd9892e029d2dea77c76afdeb9445bc0d14c587fd922c6c38e3542b978aeb370dc349b4a1221015f33051407f10ca051a1caa2109fc51002fe8b1d0be5a77455b38f9df31a379e1a80bcab4003a225cbf79d426fcd248e03ff5f499a404d879270086e292aa45ac1af979aa9af4a64e4881ec559fc87e779" -} diff --git a/crypto/fixtures/transactions/username_registration/username-registration-sign.json b/crypto/fixtures/transactions/username_registration/username-registration-sign.json deleted file mode 100644 index 5e6c1c7..0000000 --- a/crypto/fixtures/transactions/username_registration/username-registration-sign.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 8, - "nonce": "4", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "asset": { - "username": "simple_tx_tester" - }, - "signature": "70014805da364407f71ca7e09dae5a685af562b985279e370d1a936ebbe7c2545dca35b0f0f30b72eaee0ca042beb6ef2cab5666dd42831a7d0dacac3d962563", - "id": "a50b909f5b483ef1a9bebff66582de169782d3a8adc3e8fca7b183c39738c721" - }, - "serializedHex": "ff011e0100000008000400000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f9029500000000001073696d706c655f74785f74657374657270014805da364407f71ca7e09dae5a685af562b985279e370d1a936ebbe7c2545dca35b0f0f30b72eaee0ca042beb6ef2cab5666dd42831a7d0dacac3d962563" -} diff --git a/crypto/fixtures/transactions/username_resignation.json b/crypto/fixtures/transactions/username_resignation.json new file mode 100644 index 0000000..c0a1d77 --- /dev/null +++ b/crypto/fixtures/transactions/username_resignation.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6", + "value": "0", + "data": "ebed6dab", + "network": 11812, + "v": 0, + "r": "9092b27fd1ae599b3248cc0fb3d652b63f77537d0d8d75695394cbb4f2b42d12", + "s": "7d887c8e4b9a989bfb35abe87f6f5850669596b1d4bbc1b42a7a8a04ea982477", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "204c05f0590157fd71377130ddc962928a53c5b178302061969d294a43ff6909" + }, + "serialized": "f86b0185012a05f20083030d40942c1de3b4dbb4adebebb5dcecae825be2a9fc6eb68084ebed6dab825c6ba09092b27fd1ae599b3248cc0fb3d652b63f77537d0d8d75695394cbb4f2b42d12a07d887c8e4b9a989bfb35abe87f6f5850669596b1d4bbc1b42a7a8a04ea982477" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/username_resignation/username-resignation-multi-sign.json b/crypto/fixtures/transactions/username_resignation/username-resignation-multi-sign.json deleted file mode 100644 index 94acc2b..0000000 --- a/crypto/fixtures/transactions/username_resignation/username-resignation-multi-sign.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 9, - "nonce": "6", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "signature": "730f5d46f0ee978f5437899cea0912a87d9854f384a94f3b5b88fbdd527573bb6c6ed13b3da0a695e41efe2b14bafd587db4563b8f29e10f78736959250e8414", - "signatures": [ - "00fe3edd3082e95f42177e6f786f22e3df982e1b85446f9291b6effcdbfe311ec7b9d4df7e68a36ddb6afe04564586c9a3c4245d47077bda91c1fda53d294d7317", - "014e0ca11609da9444233dd13a3561c4ac6f779a177389b498749d70076126b1081d6bab0106938b2431c04c8b4cecb78f8d348ba81e7a03eee5f9fc9b0f1a3131", - "023a7826b28719baf87f4a3a5a10b51d2ce26172a01d92d41691edf7630fd5bd51d9ace6fdfa1361c7a0834d6a6017c3fba4f642fcb2a49e251fbcf6464b5256cc" - ], - "id": "d0210c375d32eec25ca9513099b98e559c3acb136d08011874149217e17ff8f1" - }, - "serializedHex": "ff011e0100000009000600000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f902950000000000730f5d46f0ee978f5437899cea0912a87d9854f384a94f3b5b88fbdd527573bb6c6ed13b3da0a695e41efe2b14bafd587db4563b8f29e10f78736959250e841400fe3edd3082e95f42177e6f786f22e3df982e1b85446f9291b6effcdbfe311ec7b9d4df7e68a36ddb6afe04564586c9a3c4245d47077bda91c1fda53d294d7317014e0ca11609da9444233dd13a3561c4ac6f779a177389b498749d70076126b1081d6bab0106938b2431c04c8b4cecb78f8d348ba81e7a03eee5f9fc9b0f1a3131023a7826b28719baf87f4a3a5a10b51d2ce26172a01d92d41691edf7630fd5bd51d9ace6fdfa1361c7a0834d6a6017c3fba4f642fcb2a49e251fbcf6464b5256cc" -} diff --git a/crypto/fixtures/transactions/username_resignation/username-resignation-sign.json b/crypto/fixtures/transactions/username_resignation/username-resignation-sign.json deleted file mode 100644 index 410e21e..0000000 --- a/crypto/fixtures/transactions/username_resignation/username-resignation-sign.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 9, - "nonce": "4", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "signature": "72b0322b72019f688fc21f367d68b38828c6e3966e52b3fd46f0813cc7c2cdfd58097c4eef8b52896aba1300098e20a38659529b45db9dfca7aa23d560457769", - "id": "1f90e26793dd55b6b2464002dc537882df94199249ba0bd07fcb4512851ed22b" - }, - "serializedHex": "ff011e0100000009000400000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f90295000000000072b0322b72019f688fc21f367d68b38828c6e3966e52b3fd46f0813cc7c2cdfd58097c4eef8b52896aba1300098e20a38659529b45db9dfca7aa23d560457769" -} diff --git a/crypto/fixtures/transactions/validator_registration.json b/crypto/fixtures/transactions/validator_registration.json new file mode 100644 index 0000000..81ff420 --- /dev/null +++ b/crypto/fixtures/transactions/validator_registration.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1", + "value": "0", + "data": "226f2645000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030a18dba7811b212bbb2f080d7c69935998ffbe7b38586e2d3e9e12079ea789996d1c69feb158c002aed327f69865be496000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a124539f9d469919eb57224cc003d9d5b086a27c6de244abf60b74b35fb749fceab7f4c24b983475cddab7d0876de49c000b5c362f5e3ce18d964f5c2d20d4eadcf7cb77a73d8ee4cd87bad10f7ba0824cea6715d1c045b4f93865a2758b7bfe", + "network": 11812, + "v": 1, + "r": "2ac3550cae0c7749e131b482ea3c5a5d4ca66f4b84e54861ab86cd68340f50a1", + "s": "17101f0c0b91c713db6f79c1aa95c83a2cf7a6c81085692af8526b7b755d5692", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "cc4331ec856b588436e8ba3de8b04175b4537fbe1cc4dd6a6e8a1f92788b206b" + }, + "serialized": "f9018d0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e180b90124226f2645000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030a18dba7811b212bbb2f080d7c69935998ffbe7b38586e2d3e9e12079ea789996d1c69feb158c002aed327f69865be496000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a124539f9d469919eb57224cc003d9d5b086a27c6de244abf60b74b35fb749fceab7f4c24b983475cddab7d0876de49c000b5c362f5e3ce18d964f5c2d20d4eadcf7cb77a73d8ee4cd87bad10f7ba0824cea6715d1c045b4f93865a2758b7bfe825c6ca02ac3550cae0c7749e131b482ea3c5a5d4ca66f4b84e54861ab86cd68340f50a1a017101f0c0b91c713db6f79c1aa95c83a2cf7a6c81085692af8526b7b755d5692" +} diff --git a/crypto/fixtures/transactions/validator_registration/validator-registration-multi-sign.json b/crypto/fixtures/transactions/validator_registration/validator-registration-multi-sign.json deleted file mode 100644 index 2d6b2cf..0000000 --- a/crypto/fixtures/transactions/validator_registration/validator-registration-multi-sign.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 2, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "asset": { - "validatorPublicKey": "a08058db53e2665c84a40f5152e76dd2b652125a6079130d4c315e728bcf4dd1dfb44ac26e82302331d61977d3141118" - }, - "signature": "0604c8ecb42e1cc125da7e88fbb6e8b3c3cb703890701b91f8277bf84493ac4994417e8c090309f8147316091d879a1a3c1ce15a6476e029c6f0597a5cfd3533", - "signatures": [ - "00ad621bb19f24c785eded7e3953b575e25fca5b26890eda8ac87cb029d8a28d2c2ef084d98d617fddf7677b27488705e3c5c6d6568a2c44753212e3589e93b89c", - "018de3507e97d8e8e88f77c2cac0c4a7b8767b8527b2a53d81a119e2dbf6672fc8595de1c9ddbb1c88fadf7266923b2289dfbd3b266059c77609bdec52e8efeb61", - "021cbf94035e39cf80b4ccb7ee7d9cfac747ab6e1f73ef4a68b5600ee48c1e94861076718d11ab3908ecc6252c0ea515f6586f966e50842846cce5eada78d84453" - ], - "id": "91c5b9e9dd0915a0e2a44edcae3cd0182ffcdcc3921721fc4a88e5b91a3a1d90" - }, - "serializedHex": "ff011e0100000002000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f902950000000000a08058db53e2665c84a40f5152e76dd2b652125a6079130d4c315e728bcf4dd1dfb44ac26e82302331d61977d31411180604c8ecb42e1cc125da7e88fbb6e8b3c3cb703890701b91f8277bf84493ac4994417e8c090309f8147316091d879a1a3c1ce15a6476e029c6f0597a5cfd353300ad621bb19f24c785eded7e3953b575e25fca5b26890eda8ac87cb029d8a28d2c2ef084d98d617fddf7677b27488705e3c5c6d6568a2c44753212e3589e93b89c018de3507e97d8e8e88f77c2cac0c4a7b8767b8527b2a53d81a119e2dbf6672fc8595de1c9ddbb1c88fadf7266923b2289dfbd3b266059c77609bdec52e8efeb61021cbf94035e39cf80b4ccb7ee7d9cfac747ab6e1f73ef4a68b5600ee48c1e94861076718d11ab3908ecc6252c0ea515f6586f966e50842846cce5eada78d84453" -} diff --git a/crypto/fixtures/transactions/validator_registration/validator-registration-sign.json b/crypto/fixtures/transactions/validator_registration/validator-registration-sign.json deleted file mode 100644 index ad2fa7b..0000000 --- a/crypto/fixtures/transactions/validator_registration/validator-registration-sign.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 2, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "asset": { - "validatorPublicKey": "a08058db53e2665c84a40f5152e76dd2b652125a6079130d4c315e728bcf4dd1dfb44ac26e82302331d61977d3141118" - }, - "signature": "449a02672bf54a67ecdbeab20d3fbc16a1358397ebbe28398338f97d9823752f0b3e6c715ce6ad47d8f4df95a7a1ef97b76d159513ba680edecf9e3dd4d76719", - "id": "18659c72ed03091989bf960450ab156d04794ea037357c2f4839d362a1ad576a" - }, - "serializedHex": "ff011e0100000002000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f902950000000000a08058db53e2665c84a40f5152e76dd2b652125a6079130d4c315e728bcf4dd1dfb44ac26e82302331d61977d3141118449a02672bf54a67ecdbeab20d3fbc16a1358397ebbe28398338f97d9823752f0b3e6c715ce6ad47d8f4df95a7a1ef97b76d159513ba680edecf9e3dd4d76719" -} diff --git a/crypto/fixtures/transactions/validator_resignation.json b/crypto/fixtures/transactions/validator_resignation.json new file mode 100644 index 0000000..2776e42 --- /dev/null +++ b/crypto/fixtures/transactions/validator_resignation.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1", + "value": "0", + "data": "b85f5da2", + "network": 11812, + "v": 1, + "r": "c4cdcf1e6ea401db32e3688aeb2e89e790ce2ea82b57a0125585ba085d6cec5c", + "s": "0a8cde2f42b20a5b6aeb3a4d8443fc5c31f2c3af5eb698551a057bd5709847e3", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "6bfc80b761bba22759f282a0639637f402e86ca07ca952833e0590592a661401" + }, + "serialized": "f86b0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e18084b85f5da2825c6ca0c4cdcf1e6ea401db32e3688aeb2e89e790ce2ea82b57a0125585ba085d6cec5ca00a8cde2f42b20a5b6aeb3a4d8443fc5c31f2c3af5eb698551a057bd5709847e3" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/validator_resignation/validator-resignation-multi-sign.json b/crypto/fixtures/transactions/validator_resignation/validator-resignation-multi-sign.json deleted file mode 100644 index 57fc16d..0000000 --- a/crypto/fixtures/transactions/validator_resignation/validator-resignation-multi-sign.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 7, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "signature": "a32aeb2cd0695a71f35953e2bac27b36ba51c6fb3f36b98a5e05072500a96206b3afc95efa47d2bbce291b12307c4bd5e79171930e13844a0bc2036516e26644", - "signatures": [ - "00e78bd07e68978b0bcc911c3b4cce17957a347b3ceda0fe78fca3624c6e9d752c46ba75d31004661d097bc6c2471f86fb6727ac9e385c931d2850fc1ad3eb98c0", - "01706c56c0a5568df17342bb0fffec66cbf948425153f31ee3f16760c372ae4e020f2489695c3f3a80524bbba6fa97aef074259e8dc9305966dfc1a40a632872d0", - "021e218f51b7803c327c092f89af015573371506dd8f27a96dacaf29286d8ecc5d955443cfb1a5d93f359ebef67fdb842fc3e9a8d9691e57a5f627cb11425526e0" - ], - "id": "97ff3cf77125fea2ce33f23ef4ce85d56e207bc47e1595c004a319976fdca64c" - }, - "serializedHex": "ff011e0100000007000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f902950000000000a32aeb2cd0695a71f35953e2bac27b36ba51c6fb3f36b98a5e05072500a96206b3afc95efa47d2bbce291b12307c4bd5e79171930e13844a0bc2036516e2664400e78bd07e68978b0bcc911c3b4cce17957a347b3ceda0fe78fca3624c6e9d752c46ba75d31004661d097bc6c2471f86fb6727ac9e385c931d2850fc1ad3eb98c001706c56c0a5568df17342bb0fffec66cbf948425153f31ee3f16760c372ae4e020f2489695c3f3a80524bbba6fa97aef074259e8dc9305966dfc1a40a632872d0021e218f51b7803c327c092f89af015573371506dd8f27a96dacaf29286d8ecc5d955443cfb1a5d93f359ebef67fdb842fc3e9a8d9691e57a5f627cb11425526e0" -} diff --git a/crypto/fixtures/transactions/validator_resignation/validator-resignation-sign.json b/crypto/fixtures/transactions/validator_resignation/validator-resignation-sign.json deleted file mode 100644 index 6bb87f3..0000000 --- a/crypto/fixtures/transactions/validator_resignation/validator-resignation-sign.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 7, - "nonce": "0", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "2500000000", - "amount": "0", - "signature": "f9d93dc161b5351a9e6f89e97bd3a4d1b73349c2339145021dee2654f5a8116aa78c6c3742b5fc39d0c9265735b866954d8c6c8383130d08659b1aff3967d4eb", - "id": "431b779764f51e227eca907706bd339de36c3b23bd46c603283f3a932d12b936" - }, - "serializedHex": "ff011e0100000007000000000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300f902950000000000f9d93dc161b5351a9e6f89e97bd3a4d1b73349c2339145021dee2654f5a8116aa78c6c3742b5fc39d0c9265735b866954d8c6c8383130d08659b1aff3967d4eb" -} diff --git a/crypto/fixtures/transactions/validator_update.json b/crypto/fixtures/transactions/validator_update.json new file mode 100644 index 0000000..0e1c2a3 --- /dev/null +++ b/crypto/fixtures/transactions/validator_update.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1", + "value": "0", + "data": "8f062626000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030a18dba7811b212bbb2f080d7c69935998ffbe7b38586e2d3e9e12079ea789996d1c69feb158c002aed327f69865be496000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a124539f9d469919eb57224cc003d9d5b086a27c6de244abf60b74b35fb749fceab7f4c24b983475cddab7d0876de49c000b5c362f5e3ce18d964f5c2d20d4eadcf7cb77a73d8ee4cd87bad10f7ba0824cea6715d1c045b4f93865a2758b7bfe", + "network": 11812, + "v": 0, + "r": "5500089b0b0afbf2a638d7fab985d8def9e44c0087859f6e5e0561e37dccc487", + "s": "219b047c62e0d94b3e834085dc0cd6b5f12c6f27ab058e949dec82f24f29b4fd", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "142c471a038d69b7ae7d18c83efa767a16915dc750a380966f50959beec9f9ea" + }, + "serialized": "f9018d0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e180b901248f062626000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030a18dba7811b212bbb2f080d7c69935998ffbe7b38586e2d3e9e12079ea789996d1c69feb158c002aed327f69865be496000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a124539f9d469919eb57224cc003d9d5b086a27c6de244abf60b74b35fb749fceab7f4c24b983475cddab7d0876de49c000b5c362f5e3ce18d964f5c2d20d4eadcf7cb77a73d8ee4cd87bad10f7ba0824cea6715d1c045b4f93865a2758b7bfe825c6ba05500089b0b0afbf2a638d7fab985d8def9e44c0087859f6e5e0561e37dccc487a0219b047c62e0d94b3e834085dc0cd6b5f12c6f27ab058e949dec82f24f29b4fd" +} diff --git a/crypto/fixtures/transactions/vote.json b/crypto/fixtures/transactions/vote.json new file mode 100644 index 0000000..f412de2 --- /dev/null +++ b/crypto/fixtures/transactions/vote.json @@ -0,0 +1,18 @@ +{ + "data": { + "nonce": "1", + "gasPrice": "5000000000", + "gasLimit": "200000", + "to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1", + "value": "0", + "data": "6dd7d8ea000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763", + "network": 11812, + "v": 1, + "r": "48cdb8cd112e05823e227319b66f2ef5e89c16ff5c568edab1cfa5f3fd8401c0", + "s": "264a4bcd27a62696e15e8588765b2739c3ed34f4b83aacd87998b2ac4c4335ec", + "senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d", + "from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd", + "hash": "7885cf77a0b272488efa03ed14994f2560490d14bd5df9b5fbdb7a6f389c8713" + }, + "serialized": "f88b0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e180a46dd7d8ea000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763825c6ca048cdb8cd112e05823e227319b66f2ef5e89c16ff5c568edab1cfa5f3fd8401c0a0264a4bcd27a62696e15e8588765b2739c3ed34f4b83aacd87998b2ac4c4335ec" +} \ No newline at end of file diff --git a/crypto/fixtures/transactions/vote/vote-multi-sign.json b/crypto/fixtures/transactions/vote/vote-multi-sign.json deleted file mode 100644 index 64305a8..0000000 --- a/crypto/fixtures/transactions/vote/vote-multi-sign.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 3, - "nonce": "1", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "100000000", - "amount": "0", - "asset": { - "votes": [ - "03f25455408f9a7e6c6a056b121e68fbda98f3511d22e9ef27b0ebaf1ef9e4eabc" - ] - }, - "signature": "72a097e05983575a69ab7c2c15d80beea988fc02e08124a969b281fa09d1e47ff0b36706f9a9bb6b2e18db929f21b08571c4be36fe2882fecfb990e465bfebde", - "signatures": [ - "0035173f507953f5a7f9da525384b9a1021b553c1089f060e6e77118ab5aa68549ea89d4b63391941e95c0142dd195fd8c032c0a9aca9e1a72943dde8ecd663070", - "010dba0e40f903c7ec76e1f1e7ef3c145e69a878b13e833d132b9f1fa267ba3b2ab049941ede13faee3da9611ac27cb52a6888bbd093a253e7d7bea4c633d4a706", - "02556654e210ed6426d20c0fe246d3270bcdea97d5ab59f5c90888731b079ff83ab53cac3bc80680f093f2e5a78216a0ed894c6985bd89b3802b2d8ff3f6b4c584" - ], - "id": "e344602ba9fe82d035af6c8b759682bab0317ca523212724542217803c093adb" - }, - "serializedHex": "ff011e0100000003000100000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300e1f50500000000000103f25455408f9a7e6c6a056b121e68fbda98f3511d22e9ef27b0ebaf1ef9e4eabc0072a097e05983575a69ab7c2c15d80beea988fc02e08124a969b281fa09d1e47ff0b36706f9a9bb6b2e18db929f21b08571c4be36fe2882fecfb990e465bfebde0035173f507953f5a7f9da525384b9a1021b553c1089f060e6e77118ab5aa68549ea89d4b63391941e95c0142dd195fd8c032c0a9aca9e1a72943dde8ecd663070010dba0e40f903c7ec76e1f1e7ef3c145e69a878b13e833d132b9f1fa267ba3b2ab049941ede13faee3da9611ac27cb52a6888bbd093a253e7d7bea4c633d4a70602556654e210ed6426d20c0fe246d3270bcdea97d5ab59f5c90888731b079ff83ab53cac3bc80680f093f2e5a78216a0ed894c6985bd89b3802b2d8ff3f6b4c584" -} diff --git a/crypto/fixtures/transactions/vote/vote-sign.json b/crypto/fixtures/transactions/vote/vote-sign.json deleted file mode 100644 index b1d260e..0000000 --- a/crypto/fixtures/transactions/vote/vote-sign.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "transaction": { - "version": 1, - "network": 30, - "typeGroup": 1, - "type": 3, - "nonce": "1", - "senderPublicKey": "023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d3", - "fee": "100000000", - "amount": "0", - "asset": { - "votes": [ - "03f25455408f9a7e6c6a056b121e68fbda98f3511d22e9ef27b0ebaf1ef9e4eabc" - ] - }, - "signature": "e0a99c2ebd108c6ba1828f4d11e5ce8cdf2e67152575cabea2e86ab59153a1f1493b768af6dfe0a33eec22edf2dd87c25e1531bf285bb4131e4fcdbfce4c8781", - "id": "81bffacc80ae1c3b3f127cbaf5d2867d3209c38610d2cc5a341702fc252cd330" - }, - "serializedHex": "ff011e0100000003000100000000000000023efc1da7f315f3c533a4080e491f32cd4219731cef008976c3876539e1f192d300e1f50500000000000103f25455408f9a7e6c6a056b121e68fbda98f3511d22e9ef27b0ebaf1ef9e4eabc00e0a99c2ebd108c6ba1828f4d11e5ce8cdf2e67152575cabea2e86ab59153a1f1493b768af6dfe0a33eec22edf2dd87c25e1531bf285bb4131e4fcdbfce4c8781" -} diff --git a/crypto/serdeser_test.go b/crypto/serdeser_test.go new file mode 100644 index 0000000..6dc79b5 --- /dev/null +++ b/crypto/serdeser_test.go @@ -0,0 +1,200 @@ +package crypto + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +const evmCallFixturePassphrase = "found lobster oblige describe ready addict body brave live vacuum display salute lizard combine gift resemble race senior quality reunion proud tell adjust angle" + +func mustBigInt(t *testing.T, s string) *big.Int { + t.Helper() + n, ok := new(big.Int).SetString(s, 10) + require.New(t).True(ok, "not a valid base-10 integer: %q", s) + return n +} + +func transactionFromFixture(t *testing.T, fixture TestingTransactionFixture) *Transaction { + t.Helper() + return &Transaction{ + Nonce: mustBigInt(t, fixture.Data.Nonce), + GasPrice: mustBigInt(t, fixture.Data.GasPrice), + GasLimit: mustBigInt(t, fixture.Data.GasLimit), + To: fixture.Data.To, + Value: mustBigInt(t, fixture.Data.Value), + Data: HexDecode(fixture.Data.Data), + } +} + +func TestFixturesMatchPhpTsSerialization(t *testing.T) { + names := []string{ + "transfer", + "vote", + "unvote", + "validator_registration", + "validator_update", + "validator_resignation", + "username_registration", + "username_resignation", + "multi_payment", + } + + for _, name := range names { + t.Run(name, func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture(name) + tx := transactionFromFixture(t, fixture) + + require.NoError(tx.Sign(evmCallFixturePassphrase)) + + assert.Equal(fixture.Data.V, tx.V) + assert.Equal(fixture.Data.R, HexEncode(tx.R)) + assert.Equal(fixture.Data.S, HexEncode(tx.S)) + assert.Equal(fixture.Data.SenderPublicKey, tx.SenderPublicKey) + assert.Equal(fixture.Data.From, tx.From) + assert.Equal(fixture.Data.Hash, tx.Hash) + assert.Equal(fixture.Serialized, HexEncode(tx.Serialized)) + + verified, err := tx.Verify() + require.NoError(err) + assert.True(verified) + + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + deserializedVerified, err := deserialized.Verify() + require.NoError(err) + assert.True(deserializedVerified) + + assert.Equal(tx.Hash, deserialized.Hash) + assert.Equal(tx.From, deserialized.From) + assert.Equal(tx.SenderPublicKey, deserialized.SenderPublicKey) + assert.Equal(tx.To, deserialized.To) + assert.Equal(0, tx.Value.Cmp(deserialized.Value)) + assert.Equal(tx.Data, deserialized.Data) + }) + } +} + +func TestFixtureSemanticFieldsDecodeCorrectly(t *testing.T) { + t.Run("vote", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("vote") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + validatorBytes := HexDecode("c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763") + + assert.True(IsVote(deserialized.Data)) + assert.Equal(AddressFromBytes(validatorBytes), deserialized.Vote) + }) + + t.Run("unvote", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("unvote") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsUnvote(deserialized.Data)) + }) + + t.Run("validator_registration", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("validator_registration") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsValidatorRegistration(deserialized.Data)) + assert.False(IsUpdateValidator(deserialized.Data)) + assert.Len(deserialized.ValidatorPublicKey, 96) // 48-byte BLS G1 pubkey, hex-encoded + assert.Len(deserialized.ValidatorProof, 192) // 96-byte BLS G2 PoP signature, hex-encoded + }) + + t.Run("validator_update", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("validator_update") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsUpdateValidator(deserialized.Data)) + assert.False(IsValidatorRegistration(deserialized.Data)) + assert.Len(deserialized.ValidatorPublicKey, 96) + assert.Len(deserialized.ValidatorProof, 192) + }) + + t.Run("validator_resignation", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("validator_resignation") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsValidatorResignation(deserialized.Data)) + }) + + t.Run("username_registration", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("username_registration") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsUsernameRegistration(deserialized.Data)) + assert.Equal("fixture", deserialized.Username) + }) + + t.Run("username_resignation", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("username_resignation") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsUsernameResignation(deserialized.Data)) + }) + + t.Run("multi_payment", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("multi_payment") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + addr1 := HexDecode("6f0182a0cc707b055322ccf6d4cb6a5aff1aeb22") + addr2 := HexDecode("c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763") + + assert.True(IsMultiPayment(deserialized.Data)) + assert.Equal([]string{AddressFromBytes(addr1), AddressFromBytes(addr2)}, deserialized.PaymentAddresses) + require.Len(deserialized.PaymentAmounts, 2) + assert.Equal(0, big.NewInt(100000).Cmp(deserialized.PaymentAmounts[0])) + assert.Equal(0, big.NewInt(200000).Cmp(deserialized.PaymentAmounts[1])) + }) + + t.Run("transfer", func(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + fixture := GetTransactionFixture("transfer") + deserialized, err := DeserializeTransaction(fixture.Serialized) + require.NoError(err) + + assert.True(IsTransfer(deserialized.Data)) + }) +}