diff --git a/.docker/wallets/wallet1.json b/.docker/wallets/wallet1.json index 31b76902d..299884352 100644 --- a/.docker/wallets/wallet1.json +++ b/.docker/wallets/wallet1.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/.docker/wallets/wallet1_solo.json b/.docker/wallets/wallet1_solo.json index dcd32238a..0494afa1f 100644 --- a/.docker/wallets/wallet1_solo.json +++ b/.docker/wallets/wallet1_solo.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", @@ -44,8 +44,8 @@ "isDefault": false }, { - "address": "AUhsL7QeeomkuzxZexPTa11xNXrbsBrGVc", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "110c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2110b413073b3bb", diff --git a/.docker/wallets/wallet2.json b/.docker/wallets/wallet2.json index a82f6a56a..de64de712 100644 --- a/.docker/wallets/wallet2.json +++ b/.docker/wallets/wallet2.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF", - "key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q", + "address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", + "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/.docker/wallets/wallet3.json b/.docker/wallets/wallet3.json index 84bd5d2b9..0a9065893 100644 --- a/.docker/wallets/wallet3.json +++ b/.docker/wallets/wallet3.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "AbrcCqhFRvewc3Xg2FZMY4nFaNM78kiNGv", - "key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy", + "address": "Nfzhk6dtjLZE93iGkqYv5pwrTW5QRQk5bV", + "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { "script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/.docker/wallets/wallet4.json b/.docker/wallets/wallet4.json index 698458d54..585b7c062 100644 --- a/.docker/wallets/wallet4.json +++ b/.docker/wallets/wallet4.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "APw5jfiLG2VpvTzMhCKvfmWdGfWfTmNC7x", - "key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM", + "address": "NU5BGveyZSQ7TUAxRnKVDXgE9oExpzV5vY", + "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { "script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/cli/server/server.go b/cli/server/server.go index a4e0f0b96..2e6aca218 100644 --- a/cli/server/server.go +++ b/cli/server/server.go @@ -10,7 +10,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core" "github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/storage" - "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/network" "github.com/nspcc-dev/neo-go/pkg/network/metrics" @@ -424,9 +423,6 @@ func initBlockChain(cfg config.Config, log *zap.Logger) (*core.Blockchain, error if err != nil { return nil, cli.NewExitError(fmt.Errorf("could not initialize blockchain: %s", err), 1) } - if cfg.ProtocolConfiguration.AddressVersion != 0 { - address.Prefix = cfg.ProtocolConfiguration.AddressVersion - } return chain, nil } diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 0e349c64a..2e91d9f6b 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -100,6 +100,18 @@ func NewCommands() []cli.Command { }, }, }, + { + Name: "convert", + Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format", + Action: convertWallet, + Flags: []cli.Flag{ + walletPathFlag, + cli.StringFlag{ + Name: "out, o", + Usage: "where to write converted wallet", + }, + }, + }, { Name: "create", Usage: "add an account to the existing wallet", @@ -233,6 +245,50 @@ func claimGas(ctx *cli.Context) error { return nil } +func convertWallet(ctx *cli.Context) error { + wall, err := openWallet(ctx.String("path")) + if err != nil { + return cli.NewExitError(err, 1) + } + defer wall.Close() + + newWallet, err := wallet.NewWallet(ctx.String("out")) + if err != nil { + return cli.NewExitError(err, -1) + } + defer newWallet.Close() + + for _, acc := range wall.Accounts { + address.Prefix = address.NEO2Prefix + + pass, err := readPassword(fmt.Sprintf("Enter passphrase for account %s (label '%s') > ", acc.Address, acc.Label)) + if err != nil { + return cli.NewExitError(err, -1) + } else if err := acc.Decrypt(pass); err != nil { + return cli.NewExitError("invalid passphrase", -1) + } + + address.Prefix = address.NEO3Prefix + newAcc, err := wallet.NewAccountFromWIF(acc.PrivateKey().WIF()) + if err != nil { + return cli.NewExitError(fmt.Errorf("can't convert account: %v", err), -1) + } + newAcc.Address = address.Uint160ToString(acc.Contract.ScriptHash()) + newAcc.Contract = acc.Contract + newAcc.Default = acc.Default + newAcc.Label = acc.Label + newAcc.Locked = acc.Locked + if err := newAcc.Encrypt(pass); err != nil { + return cli.NewExitError(fmt.Errorf("can't encrypt converted account: %v", err), -1) + } + newWallet.AddAccount(newAcc) + } + if err := newWallet.Save(); err != nil { + return cli.NewExitError(err, -1) + } + return nil +} + func addAccount(ctx *cli.Context) error { wall, err := openWallet(ctx.String("path")) if err != nil { diff --git a/config/protocol.mainnet.yml b/config/protocol.mainnet.yml index 861041637..ad32fd516 100644 --- a/config/protocol.mainnet.yml +++ b/config/protocol.mainnet.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 5195086 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.001 MemPoolSize: 50000 diff --git a/config/protocol.privnet.docker.four.yml b/config/protocol.privnet.docker.four.yml index e2fc0fefe..855f91b4b 100644 --- a/config/protocol.privnet.docker.four.yml +++ b/config/protocol.privnet.docker.four.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.privnet.docker.one.yml b/config/protocol.privnet.docker.one.yml index f60ca55ba..f6e6af47e 100644 --- a/config/protocol.privnet.docker.one.yml +++ b/config/protocol.privnet.docker.one.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.privnet.docker.single.yml b/config/protocol.privnet.docker.single.yml index f43ffaeed..c354d944c 100644 --- a/config/protocol.privnet.docker.single.yml +++ b/config/protocol.privnet.docker.single.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 1 LowPriorityThreshold: 0.001 MemPoolSize: 50000 diff --git a/config/protocol.privnet.docker.three.yml b/config/protocol.privnet.docker.three.yml index 620ef90e9..a6411b115 100644 --- a/config/protocol.privnet.docker.three.yml +++ b/config/protocol.privnet.docker.three.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.privnet.docker.two.yml b/config/protocol.privnet.docker.two.yml index 01f109416..ab7d6394b 100644 --- a/config/protocol.privnet.docker.two.yml +++ b/config/protocol.privnet.docker.two.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.privnet.yml b/config/protocol.privnet.yml index e8a1d7185..9071f250f 100644 --- a/config/protocol.privnet.yml +++ b/config/protocol.privnet.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.testnet.yml b/config/protocol.testnet.yml index 785f3a429..d306b9386 100644 --- a/config/protocol.testnet.yml +++ b/config/protocol.testnet.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 1951352142 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/config/protocol.unit_testnet.yml b/config/protocol.unit_testnet.yml index e786558a7..855690854 100644 --- a/config/protocol.unit_testnet.yml +++ b/config/protocol.unit_testnet.yml @@ -1,6 +1,5 @@ ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 SecondsPerBlock: 15 LowPriorityThreshold: 0.000 MemPoolSize: 50000 diff --git a/docs/cli.md b/docs/cli.md index f199cbc3a..d1415da15 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -48,7 +48,6 @@ Example of such configuration: ```yaml ProtocolConfiguration: Magic: 56753 - AddressVersion: 23 StandbyValidators: - 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 - 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e diff --git a/examples/runtime/runtime.go b/examples/runtime/runtime.go index 9bee81a66..bb9e4718c 100644 --- a/examples/runtime/runtime.go +++ b/examples/runtime/runtime.go @@ -6,7 +6,7 @@ import ( ) // Check if the invoker of the contract is the specified owner -var owner = util.FromAddress("Aej1fe4mUgou48Zzup5j8sPrE3973cJ5oz") +var owner = util.FromAddress("Nis7Cu1Qn6iBb8kbeQ5HgdZT7AsQPqywTC") // Main is something to be ran from outside. func Main(operation string, args []interface{}) bool { diff --git a/examples/token-sale/token_sale.go b/examples/token-sale/token_sale.go index a6276f121..84732bad9 100644 --- a/examples/token-sale/token_sale.go +++ b/examples/token-sale/token_sale.go @@ -11,7 +11,7 @@ const ( multiplier = decimals * 10 ) -var owner = util.FromAddress("AJX1jGfj3qPBbpAKjY527nPbnrnvSx9nCg") +var owner = util.FromAddress("NNf7GXcNMFHU8pLvU84afYZCfzXDopy71M") // TokenConfig holds information about the token we want to use for the sale. type TokenConfig struct { diff --git a/examples/token/token.go b/examples/token/token.go index d4b78c2d2..15b285294 100644 --- a/examples/token/token.go +++ b/examples/token/token.go @@ -12,7 +12,7 @@ const ( multiplier = 100000000 ) -var owner = util.FromAddress("AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y") +var owner = util.FromAddress("NPAsqZkx9WhNd4P72uhZxBhLinSuNkxfB8") // CreateToken initializes the Token Interface for the Smart Contract to operate with func CreateToken() nep5.Token { diff --git a/pkg/compiler/interop_test.go b/pkg/compiler/interop_test.go index 7487b1493..9bc60d0b7 100644 --- a/pkg/compiler/interop_test.go +++ b/pkg/compiler/interop_test.go @@ -23,11 +23,11 @@ import ( ) func TestFromAddress(t *testing.T) { - as1 := "Aej1fe4mUgou48Zzup5j8sPrE3973cJ5oz" + as1 := "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN" addr1, err := address.StringToUint160(as1) require.NoError(t, err) - as2 := "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y" + as2 := "NPAsqZkx9WhNd4P72uhZxBhLinSuNkxfB8" addr2, err := address.StringToUint160(as2) require.NoError(t, err) diff --git a/pkg/config/protocol_config.go b/pkg/config/protocol_config.go index 94c5e452d..06509dc0e 100644 --- a/pkg/config/protocol_config.go +++ b/pkg/config/protocol_config.go @@ -18,7 +18,6 @@ const ( // ProtocolConfiguration represents the protocol config. type ( ProtocolConfiguration struct { - AddressVersion byte `yaml:"AddressVersion"` // FeePerExtraByte sets the expected per-byte fee for // transactions exceeding the MaxFreeTransactionSize. FeePerExtraByte float64 `yaml:"FeePerExtraByte"` diff --git a/pkg/consensus/testdata/wallet1.json b/pkg/consensus/testdata/wallet1.json index 31b76902d..299884352 100644 --- a/pkg/consensus/testdata/wallet1.json +++ b/pkg/consensus/testdata/wallet1.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/pkg/consensus/testdata/wallet2.json b/pkg/consensus/testdata/wallet2.json index a82f6a56a..de64de712 100644 --- a/pkg/consensus/testdata/wallet2.json +++ b/pkg/consensus/testdata/wallet2.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF", - "key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q", + "address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", + "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/pkg/consensus/testdata/wallet3.json b/pkg/consensus/testdata/wallet3.json index 84bd5d2b9..0a9065893 100644 --- a/pkg/consensus/testdata/wallet3.json +++ b/pkg/consensus/testdata/wallet3.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "AbrcCqhFRvewc3Xg2FZMY4nFaNM78kiNGv", - "key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy", + "address": "Nfzhk6dtjLZE93iGkqYv5pwrTW5QRQk5bV", + "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { "script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/pkg/consensus/testdata/wallet4.json b/pkg/consensus/testdata/wallet4.json index 698458d54..585b7c062 100644 --- a/pkg/consensus/testdata/wallet4.json +++ b/pkg/consensus/testdata/wallet4.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "APw5jfiLG2VpvTzMhCKvfmWdGfWfTmNC7x", - "key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM", + "address": "NU5BGveyZSQ7TUAxRnKVDXgE9oExpzV5vY", + "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { "script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/pkg/core/util_test.go b/pkg/core/util_test.go index da254c162..c28752e55 100644 --- a/pkg/core/util_test.go +++ b/pkg/core/util_test.go @@ -26,7 +26,7 @@ func TestGenesisBlockMainNet(t *testing.T) { func TestGetConsensusAddressMainNet(t *testing.T) { var ( - consensusAddr = "ASEhJHr51ZMQUqmUbPC5uiuJwwvedwC48F" + consensusAddr = "NWNnqYniJyFh1qx5KyBeTV4uq5ewvNrAuD" consensusScript = "72c3d9b3bbf776698694cd2c73fa597a10c31294" ) diff --git a/pkg/crypto/keys/publickey_test.go b/pkg/crypto/keys/publickey_test.go index dd658c06c..3ec900784 100644 --- a/pkg/crypto/keys/publickey_test.go +++ b/pkg/crypto/keys/publickey_test.go @@ -89,7 +89,7 @@ func TestPubkeyToAddress(t *testing.T) { pubKey, err := NewPublicKeyFromString("031ee4e73a17d8f76dc02532e2620bcb12425b33c0c9f9694cc2caa8226b68cad4") require.NoError(t, err) actual := pubKey.Address() - expected := "AJhhwPRwjUmQhEmwPBrq4CVTMRq7u4S4in" + expected := "NNqoUeNb2tfhEExY7mrPbxf4EZZRKX5nHF" require.Equal(t, expected, actual) } diff --git a/pkg/encoding/address/address.go b/pkg/encoding/address/address.go index fc2ed4425..3711beb78 100644 --- a/pkg/encoding/address/address.go +++ b/pkg/encoding/address/address.go @@ -7,9 +7,16 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" ) +const ( + // NEO2Prefix is the first byte of address for NEO2. + NEO2Prefix byte = 0x17 + // NEO3Prefix is the first byte of address for NEO3. + NEO3Prefix byte = 0x35 +) + // Prefix is the byte used to prepend to addresses when encoding them, it can -// be changed and defaults to 23 (0x17), the standard NEO prefix. -var Prefix = byte(0x17) +// be changed and defaults to 53 (0x35), the standard NEO prefix. +var Prefix = NEO3Prefix // Uint160ToString returns the "NEO address" from the given Uint160. func Uint160ToString(u util.Uint160) string { diff --git a/pkg/encoding/address/address_test.go b/pkg/encoding/address/address_test.go index 20483ed59..309703fd2 100644 --- a/pkg/encoding/address/address_test.go +++ b/pkg/encoding/address/address_test.go @@ -3,15 +3,16 @@ package address import ( "testing" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestUint160DecodeEncodeAddress(t *testing.T) { addrs := []string{ - "AMLr1CpPQtbEdiJdriX1HpRNMZUwbU2Huj", - "AKtwd3DRXj3nL5kHMUoNsdnsCEVjnuuTFF", - "AMxkaxFVG8Q1BhnB4fjTA5ZmUTEnnTMJMa", + "NRHkiY2hLy5ypD32CKZtL6pNwhbFMqDEhR", + "NPCD6gAxNuuJqssZY1eCJabuaz4BjBUHab", + "NUJUhgvvQyp6AmDBg3QRQ1cmRkMRhaXqZP", } for _, addr := range addrs { val, err := StringToUint160(addr) @@ -21,7 +22,7 @@ func TestUint160DecodeEncodeAddress(t *testing.T) { } func TestUint160DecodeKnownAddress(t *testing.T) { - address := "AJeAEsmeD6t279Dx4n2HWdUvUmmXQ4iJvP" + address := "NNnFn8iHWWnJe9QYoN1r4PeXMuVpfLVRS7" val, err := StringToUint160(address) require.NoError(t, err) @@ -44,3 +45,13 @@ func TestUint160DecodeBadPrefix(t *testing.T) { _, err := StringToUint160(address) require.Error(t, err) } + +func TestPrefixFirstLetter(t *testing.T) { + u := util.Uint160{} + require.EqualValues(t, 'N', Uint160ToString(u)[0]) + + for i := range u { + u[i] = 0xFF + } + require.EqualValues(t, 'N', Uint160ToString(u)[0]) +} diff --git a/pkg/internal/keytestcases/testcases.go b/pkg/internal/keytestcases/testcases.go index e21ea951b..cdc92b159 100644 --- a/pkg/internal/keytestcases/testcases.go +++ b/pkg/internal/keytestcases/testcases.go @@ -14,28 +14,28 @@ type Ktype struct { // Arr contains a set of known keys in Ktype format. var Arr = []Ktype{ { - Address: "AHF4z1wiN9EabrS4eZK9JngmmRYxkfNbLA", + Address: "NMPAXGtMfZ8s8rcfP9JhrYrNeZHG4xSVmd", PrivateKey: "7d128a6d096f0c14c3a25a2b0c41cf79661bfcb4a8cc95aaaea28bde4d732344", PublicKey: "02028a99826edc0c97d18e22b6932373d908d323aa7f92656a77ec26e8861699ef", Wif: "L1QqQJnpBwbsPGAuutuzPTac8piqvbR1HRjrY5qHup48TBCBFe4g", Passphrase: "city of zion", - EncryptedWif: "6PYV843ZXHHRKhHbTTKqBxGXbYm8ZvpcZdmcMasZe2n8scuPBBkmdDZk1J", + EncryptedWif: "6PYWdzMKGbfxHbfb2JqZJ5Yr1y6jjjuSPLjvgS4byvDkgz2NdiBgeJwBFc", }, { - Address: "AM41GdiGK6eFJ7PZhd6yxsvFVWnsh9xUfg", + Address: "NRC6oteucWYXq7aASD6YWe5rNeXAw1ehye", PrivateKey: "9ab7e154840daca3a2efadaf0df93cd3a5b51768c632f5433f86909d9b994a69", PublicKey: "031d8e1630ce640966967bc6d95223d21f44304133003140c3b52004dc981349c9", Wif: "L2QTooFoDFyRFTxmtiVHt5CfsXfVnexdbENGDkkrrgTTryiLsPMG", Passphrase: "我的密码", - EncryptedWif: "6PYWUjTHVYg1iYVAR5B3E6BqbrcsYPVnHzpdHcjSE1emEYN9vqCGHtBBcx", + EncryptedWif: "6PYLxXgqE8MaQJr3NR96rfFBxzdNLytb3CfxeDXyijSEG2M1vF9d4CoRAg", }, { - Address: "AP75QGPdWJceuMCVBiz1GN9Tj3XeU2uerB", + Address: "NTFAwXLGoiWwSMP5vJyZp8K4cBFwrzUs8m", PrivateKey: "3edee7036b8fd9cef91de47386b191dd76db2888a553e7736bb02808932a915b", PublicKey: "02232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa", Wif: "KyKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG", Passphrase: "MyL33tP@33w0rd", - EncryptedWif: "6PYKssa8ZJE6LKvZ7TYomhwSs8jSvDuiPFcBwDVyeyYbgaXxRwtvKjYTe7", + EncryptedWif: "6PYRoabFnWARA3ZWwfJ4efQ4uuuB9WdVrA1LFbMkZLtXZ2DJg3bzjiK59s", }, { Address: "xdf4UGKevVrMR1j3UkPsuoYKSC4ocoAkKx", @@ -43,7 +43,7 @@ var Arr = []Ktype{ PublicKey: "zz232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa", Wif: "zzKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG", Passphrase: "zzL33tP@33w0rd", - EncryptedWif: "6PYKssa8ZJE6LKvZ7TYomhwSs8jSvDuiPFcBwDVyeyYbgaXxRwtvKjYTe7", + EncryptedWif: "6PYRoabFnWARA3ZWwfJ4efQ4uuuB9WdVrA1LFbMkZLtXZ2DJg3bzjiK59s", Invalid: true, }, } diff --git a/pkg/rpc/client/rpc_test.go b/pkg/rpc/client/rpc_test.go index 703acfb6d..e7102c8bf 100644 --- a/pkg/rpc/client/rpc_test.go +++ b/pkg/rpc/client/rpc_test.go @@ -39,13 +39,13 @@ const hexB1 = "00000000e862e7907fc987cd58ddb3abb754aeb8812c9377c45e737a036fe88a6 const hexTxMoveNeo = "0002000000abec5362f11e75b6e02e407bb98d63675d14384100000000000000003e5f0d0000000000b00400000001abec5362f11e75b6e02e407bb98d63675d14384101590218ddf5050c14316e851039019d39dfc2c37d6c3fee19fd5809870c14abec5362f11e75b6e02e407bb98d63675d14384113c00c087472616e736665720c14897720d8cd76f4f00abfa37c0edd889c208fde9b41627d5b523801fd08010c402d96d8fde4ba266f89bc71ef117361967e0d11ed84cd60942a27bc99994dc58adf36a0e74ce976aac657a87a3c19c38e8ca450c67420046b81d98c60fd8feb040c40b3c15d5d23e0403a36cf559caee2979ca6ef00fe255df0e5c3daac4da051016b41eba42668934cd3308359451bafdd5419d059179fd40859684a3b91388bf9d80c407ac048cf8540b091955a374a0f36dae560c92c0134886507a589edf58b9dfbb4e3dbd5450be34e269d2e5454eb14eb7d6280d6101b4529410f829d37634849be0c403bba4113a687ff8507c1753f8519557531cf9df51ecc20deeb2c2b003ec5a1f7588cdd50b99e40b4f8039bb56c5df7ec9e7d6ea4b02fe23792510da21c7557f394130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb" -const b1Verbose = `{"id":5,"jsonrpc":"2.0","result":{"size":1681,"nextblockhash":"0xf2afe371a27c9dbac4f4a8ad8eba750898b7c04aa298e64fe9e488e947976045","confirmations":6,"hash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","version":0,"previousblockhash":"0x8f3b2c628ae86f037a735ec477932c81b8ae54b7abb3dd58cd87c97f90e762e8","merkleroot":"0x95831633b36588acf0e69f37f73d1a84cb0c5329790e837072206ba8842e1f30","time":1591366176001,"index":1,"nextconsensus":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","witnesses":[{"invocation":"DECrY0zpFZDneyRs7osgToonAmjuHvMkNM7Oc/Qlp9vJDxvtHb6RTtyqJlMWetFwrhDhapssa34K8fcR+4SPuxt/DEAjLeatB+44Rrr6ljAtN2AjSVAaVW31deffB0PkWwdtagxsbdTK04mPnohI3QVKvTA7Ip/RKYQELyQfDmaPOaD7DECLSvQwV98Ymp1HEBC1FQurRCBAQDFHxeUCvaOM3j/4vOgD8BJF4H4r+5XVc0nFXcwn43ELgvJzXQ9A60NCkI4zDEDNpm90PU7Y2Fb1N2lT+RaVgcZoqTcCRa7xYgLr75uz9/gSNL5i7Ch9cBrX2L9QQmSAGa+f5bqgqOBdJ5v9sdTJ","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"consensus_data":{"primary":0,"nonce":"0000000000000457"},"tx":[{"txid":"0x8af9ccb8e7e0f0a73e77b78dc52750e77c50f78b09ecc2f0669c0b459cc7dd89","size":575,"version":0,"nonce":2,"sender":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","sys_fee":"0","net_fee":"0.0087635","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"Ahjd9QUMFDFuhRA5AZ0538LDfWw/7hn9WAmHDBSr7FNi8R51tuAuQHu5jWNnXRQ4QRPADAh0cmFuc2ZlcgwUiXcg2M129PAKv6N8Dt2InCCP3ptBYn1bUjg=","scripts":[{"invocation":"DEAtltj95Lomb4m8ce8Rc2GWfg0R7YTNYJQqJ7yZmU3Fit82oOdM6XaqxleoejwZw46MpFDGdCAEa4HZjGD9j+sEDECzwV1dI+BAOjbPVZyu4pecpu8A/iVd8OXD2qxNoFEBa0HrpCZok0zTMINZRRuv3VQZ0FkXn9QIWWhKO5E4i/nYDEB6wEjPhUCwkZVaN0oPNtrlYMksATSIZQelie31i537tOPb1UUL404mnS5UVOsU631igNYQG0UpQQ+CnTdjSEm+DEA7ukETpof/hQfBdT+FGVV1Mc+d9R7MIN7rLCsAPsWh91iM3VC5nkC0+AObtWxd9+yefW6ksC/iN5JRDaIcdVfz","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]},{"txid":"0xe7cff9e4820e53232dae619a3e6f57a9430dc240b5ed7b5c0ea2cfee3e90c985","size":579,"version":0,"nonce":3,"sender":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","sys_fee":"0","net_fee":"0.0088035","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"AwDodkgXAAAADBQxboUQOQGdOd/Cw31sP+4Z/VgJhwwUq+xTYvEedbbgLkB7uY1jZ10UOEETwAwIdHJhbnNmZXIMFDt9NxHG8Mz5sdypA9G/odiW8SOMQWJ9W1I4","scripts":[{"invocation":"DEBj+xKqnz+4P2Mk6px+wR+p6ZW1EUD0gECdaM9NYl5ZiwYy1mEGAphL+i9eXqm8xioObYGN0nGzhTDA0binG04MDEAT4JHqxvMEZo1kfFwDL9ECBZfqUgRUXiHDhlWmND1YSSEY8SMe3pGvhIr34dmH0aiBaWb1/Bp4IcbG9ic0JnveDEDardBKekFB2WxY3i03PmcsoHHiuCE471LfAWrFInEDhdsqxzdD0v5zBh+l1ssP9zp+x/BmfkyL/2qg1XgxKNNuDEDauFzYfT+SvpUyKSvcb0ILDsvy+HfHDGqZIe4PyQDfxTmYzwIKUfqa89Bgj2orkEjOo8C1hkhYArvSeLJh7uik","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]}]}}` +const b1Verbose = `{"id":5,"jsonrpc":"2.0","result":{"size":1681,"nextblockhash":"0xf2afe371a27c9dbac4f4a8ad8eba750898b7c04aa298e64fe9e488e947976045","confirmations":6,"hash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","version":0,"previousblockhash":"0x8f3b2c628ae86f037a735ec477932c81b8ae54b7abb3dd58cd87c97f90e762e8","merkleroot":"0x95831633b36588acf0e69f37f73d1a84cb0c5329790e837072206ba8842e1f30","time":1591366176001,"index":1,"nextconsensus":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","witnesses":[{"invocation":"DECrY0zpFZDneyRs7osgToonAmjuHvMkNM7Oc/Qlp9vJDxvtHb6RTtyqJlMWetFwrhDhapssa34K8fcR+4SPuxt/DEAjLeatB+44Rrr6ljAtN2AjSVAaVW31deffB0PkWwdtagxsbdTK04mPnohI3QVKvTA7Ip/RKYQELyQfDmaPOaD7DECLSvQwV98Ymp1HEBC1FQurRCBAQDFHxeUCvaOM3j/4vOgD8BJF4H4r+5XVc0nFXcwn43ELgvJzXQ9A60NCkI4zDEDNpm90PU7Y2Fb1N2lT+RaVgcZoqTcCRa7xYgLr75uz9/gSNL5i7Ch9cBrX2L9QQmSAGa+f5bqgqOBdJ5v9sdTJ","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"consensus_data":{"primary":0,"nonce":"0000000000000457"},"tx":[{"txid":"0x8af9ccb8e7e0f0a73e77b78dc52750e77c50f78b09ecc2f0669c0b459cc7dd89","size":575,"version":0,"nonce":2,"sender":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","sys_fee":"0","net_fee":"0.0087635","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"Ahjd9QUMFDFuhRA5AZ0538LDfWw/7hn9WAmHDBSr7FNi8R51tuAuQHu5jWNnXRQ4QRPADAh0cmFuc2ZlcgwUiXcg2M129PAKv6N8Dt2InCCP3ptBYn1bUjg=","scripts":[{"invocation":"DEAtltj95Lomb4m8ce8Rc2GWfg0R7YTNYJQqJ7yZmU3Fit82oOdM6XaqxleoejwZw46MpFDGdCAEa4HZjGD9j+sEDECzwV1dI+BAOjbPVZyu4pecpu8A/iVd8OXD2qxNoFEBa0HrpCZok0zTMINZRRuv3VQZ0FkXn9QIWWhKO5E4i/nYDEB6wEjPhUCwkZVaN0oPNtrlYMksATSIZQelie31i537tOPb1UUL404mnS5UVOsU631igNYQG0UpQQ+CnTdjSEm+DEA7ukETpof/hQfBdT+FGVV1Mc+d9R7MIN7rLCsAPsWh91iM3VC5nkC0+AObtWxd9+yefW6ksC/iN5JRDaIcdVfz","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]},{"txid":"0xe7cff9e4820e53232dae619a3e6f57a9430dc240b5ed7b5c0ea2cfee3e90c985","size":579,"version":0,"nonce":3,"sender":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","sys_fee":"0","net_fee":"0.0088035","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"AwDodkgXAAAADBQxboUQOQGdOd/Cw31sP+4Z/VgJhwwUq+xTYvEedbbgLkB7uY1jZ10UOEETwAwIdHJhbnNmZXIMFDt9NxHG8Mz5sdypA9G/odiW8SOMQWJ9W1I4","scripts":[{"invocation":"DEBj+xKqnz+4P2Mk6px+wR+p6ZW1EUD0gECdaM9NYl5ZiwYy1mEGAphL+i9eXqm8xioObYGN0nGzhTDA0binG04MDEAT4JHqxvMEZo1kfFwDL9ECBZfqUgRUXiHDhlWmND1YSSEY8SMe3pGvhIr34dmH0aiBaWb1/Bp4IcbG9ic0JnveDEDardBKekFB2WxY3i03PmcsoHHiuCE471LfAWrFInEDhdsqxzdD0v5zBh+l1ssP9zp+x/BmfkyL/2qg1XgxKNNuDEDauFzYfT+SvpUyKSvcb0ILDsvy+HfHDGqZIe4PyQDfxTmYzwIKUfqa89Bgj2orkEjOo8C1hkhYArvSeLJh7uik","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]}]}}` const hexHeader1 = "00000000e862e7907fc987cd58ddb3abb754aeb8812c9377c45e737a036fe88a622c3b8f301f2e84a86b207270830e7929530ccb841a3df7379fe6f0ac8865b33316839501cdd0847201000001000000abec5362f11e75b6e02e407bb98d63675d14384101fd08010c40ab634ce91590e77b246cee8b204e8a270268ee1ef32434cece73f425a7dbc90f1bed1dbe914edcaa2653167ad170ae10e16a9b2c6b7e0af1f711fb848fbb1b7f0c40232de6ad07ee3846bafa96302d37602349501a556df575e7df0743e45b076d6a0c6c6dd4cad3898f9e8848dd054abd303b229fd12984042f241f0e668f39a0fb0c408b4af43057df189a9d471010b5150bab442040403147c5e502bda38cde3ff8bce803f01245e07e2bfb95d57349c55dcc27e3710b82f2735d0f40eb4342908e330c40cda66f743d4ed8d856f5376953f9169581c668a9370245aef16202ebef9bb3f7f81234be62ec287d701ad7d8bf5042648019af9fe5baa0a8e05d279bfdb1d4c994130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb00" -const header1Verbose = `{"id":5,"jsonrpc":"2.0","result":{"hash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","size":518,"version":0,"previousblockhash":"0x8f3b2c628ae86f037a735ec477932c81b8ae54b7abb3dd58cd87c97f90e762e8","merkleroot":"0x95831633b36588acf0e69f37f73d1a84cb0c5329790e837072206ba8842e1f30","time":1591366176001,"index":1,"nextconsensus":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","witnesses":[{"invocation":"DECrY0zpFZDneyRs7osgToonAmjuHvMkNM7Oc/Qlp9vJDxvtHb6RTtyqJlMWetFwrhDhapssa34K8fcR+4SPuxt/DEAjLeatB+44Rrr6ljAtN2AjSVAaVW31deffB0PkWwdtagxsbdTK04mPnohI3QVKvTA7Ip/RKYQELyQfDmaPOaD7DECLSvQwV98Ymp1HEBC1FQurRCBAQDFHxeUCvaOM3j/4vOgD8BJF4H4r+5XVc0nFXcwn43ELgvJzXQ9A60NCkI4zDEDNpm90PU7Y2Fb1N2lT+RaVgcZoqTcCRa7xYgLr75uz9/gSNL5i7Ch9cBrX2L9QQmSAGa+f5bqgqOBdJ5v9sdTJ","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"confirmations":6,"nextblockhash":"0xf2afe371a27c9dbac4f4a8ad8eba750898b7c04aa298e64fe9e488e947976045"}}` +const header1Verbose = `{"id":5,"jsonrpc":"2.0","result":{"hash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","size":518,"version":0,"previousblockhash":"0x8f3b2c628ae86f037a735ec477932c81b8ae54b7abb3dd58cd87c97f90e762e8","merkleroot":"0x95831633b36588acf0e69f37f73d1a84cb0c5329790e837072206ba8842e1f30","time":1591366176001,"index":1,"nextconsensus":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","witnesses":[{"invocation":"DECrY0zpFZDneyRs7osgToonAmjuHvMkNM7Oc/Qlp9vJDxvtHb6RTtyqJlMWetFwrhDhapssa34K8fcR+4SPuxt/DEAjLeatB+44Rrr6ljAtN2AjSVAaVW31deffB0PkWwdtagxsbdTK04mPnohI3QVKvTA7Ip/RKYQELyQfDmaPOaD7DECLSvQwV98Ymp1HEBC1FQurRCBAQDFHxeUCvaOM3j/4vOgD8BJF4H4r+5XVc0nFXcwn43ELgvJzXQ9A60NCkI4zDEDNpm90PU7Y2Fb1N2lT+RaVgcZoqTcCRa7xYgLr75uz9/gSNL5i7Ch9cBrX2L9QQmSAGa+f5bqgqOBdJ5v9sdTJ","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"confirmations":6,"nextblockhash":"0xf2afe371a27c9dbac4f4a8ad8eba750898b7c04aa298e64fe9e488e947976045"}}` -const txMoveNeoVerbose = `{"id":5,"jsonrpc":"2.0","result":{"blockhash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","confirmations":6,"blocktime":1591366176001,"txid":"0x8af9ccb8e7e0f0a73e77b78dc52750e77c50f78b09ecc2f0669c0b459cc7dd89","size":575,"version":0,"nonce":2,"sender":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","sys_fee":"0","net_fee":"0.0087635","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"Ahjd9QUMFDFuhRA5AZ0538LDfWw/7hn9WAmHDBSr7FNi8R51tuAuQHu5jWNnXRQ4QRPADAh0cmFuc2ZlcgwUiXcg2M129PAKv6N8Dt2InCCP3ptBYn1bUjg=","scripts":[{"invocation":"DEAtltj95Lomb4m8ce8Rc2GWfg0R7YTNYJQqJ7yZmU3Fit82oOdM6XaqxleoejwZw46MpFDGdCAEa4HZjGD9j+sEDECzwV1dI+BAOjbPVZyu4pecpu8A/iVd8OXD2qxNoFEBa0HrpCZok0zTMINZRRuv3VQZ0FkXn9QIWWhKO5E4i/nYDEB6wEjPhUCwkZVaN0oPNtrlYMksATSIZQelie31i537tOPb1UUL404mnS5UVOsU631igNYQG0UpQQ+CnTdjSEm+DEA7ukETpof/hQfBdT+FGVV1Mc+d9R7MIN7rLCsAPsWh91iM3VC5nkC0+AObtWxd9+yefW6ksC/iN5JRDaIcdVfz","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]}}` +const txMoveNeoVerbose = `{"id":5,"jsonrpc":"2.0","result":{"blockhash":"0xbd178d8d4a28ec082c034f817ce2423221281a31e7e00014dbf732c4053033d2","confirmations":6,"blocktime":1591366176001,"txid":"0x8af9ccb8e7e0f0a73e77b78dc52750e77c50f78b09ecc2f0669c0b459cc7dd89","size":575,"version":0,"nonce":2,"sender":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","sys_fee":"0","net_fee":"0.0087635","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x4138145d67638db97b402ee0b6751ef16253ecab","scopes":"CalledByEntry"}],"script":"Ahjd9QUMFDFuhRA5AZ0538LDfWw/7hn9WAmHDBSr7FNi8R51tuAuQHu5jWNnXRQ4QRPADAh0cmFuc2ZlcgwUiXcg2M129PAKv6N8Dt2InCCP3ptBYn1bUjg=","scripts":[{"invocation":"DEAtltj95Lomb4m8ce8Rc2GWfg0R7YTNYJQqJ7yZmU3Fit82oOdM6XaqxleoejwZw46MpFDGdCAEa4HZjGD9j+sEDECzwV1dI+BAOjbPVZyu4pecpu8A/iVd8OXD2qxNoFEBa0HrpCZok0zTMINZRRuv3VQZ0FkXn9QIWWhKO5E4i/nYDEB6wEjPhUCwkZVaN0oPNtrlYMksATSIZQelie31i537tOPb1UUL404mnS5UVOsU631igNYQG0UpQQ+CnTdjSEm+DEA7ukETpof/hQfBdT+FGVV1Mc+d9R7MIN7rLCsAPsWh91iM3VC5nkC0+AObtWxd9+yefW6ksC/iN5JRDaIcdVfz","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}]}}` // getResultBlock1 returns data for block number 1 which is used by several tests. func getResultBlock1() *result.Block { diff --git a/pkg/rpc/client/wsclient_test.go b/pkg/rpc/client/wsclient_test.go index a825dff59..95094d7af 100644 --- a/pkg/rpc/client/wsclient_test.go +++ b/pkg/rpc/client/wsclient_test.go @@ -117,8 +117,8 @@ func TestWSClientEvents(t *testing.T) { var events = []string{ `{"jsonrpc":"2.0","method":"transaction_executed","params":[{"txid":"0xe1cd5e57e721d2a2e05fb1f08721b12057b25ab1dd7fd0f33ee1639932fdfad7","executions":[{"trigger":"Application","contract":"0x0000000000000000000000000000000000000000","vmstate":"HALT","gas_consumed":"2.291","stack":[],"notifications":[{"contract":"0x1b4357bff5a01bdf2a6581247cf9ed1e24629176","state":{"type":"Array","value":[{"type":"ByteArray","value":"Y29udHJhY3QgY2FsbA=="},{"type":"ByteArray","value":"dHJhbnNmZXI="},{"type":"Array","value":[{"type":"ByteArray","value":"dpFiJB7t+XwkgWUq3xug9b9XQxs="},{"type":"ByteArray","value":"MW6FEDkBnTnfwsN9bD/uGf1YCYc="},{"type":"Integer","value":"1000"}]}]}},{"contract":"0x1b4357bff5a01bdf2a6581247cf9ed1e24629176","state":{"type":"Array","value":[{"type":"ByteArray","value":"dHJhbnNmZXI="},{"type":"ByteArray","value":"dpFiJB7t+XwkgWUq3xug9b9XQxs="},{"type":"ByteArray","value":"MW6FEDkBnTnfwsN9bD/uGf1YCYc="},{"type":"Integer","value":"1000"}]}}]}]}]}`, `{"jsonrpc":"2.0","method":"notification_from_execution","params":[{"contract":"0x1b4357bff5a01bdf2a6581247cf9ed1e24629176","state":{"type":"Array","value":[{"type":"ByteArray","value":"Y29udHJhY3QgY2FsbA=="},{"type":"ByteArray","value":"dHJhbnNmZXI="},{"type":"Array","value":[{"type":"ByteArray","value":"dpFiJB7t+XwkgWUq3xug9b9XQxs="},{"type":"ByteArray","value":"MW6FEDkBnTnfwsN9bD/uGf1YCYc="},{"type":"Integer","value":"1000"}]}]}}]}`, - `{"jsonrpc":"2.0","method":"transaction_added","params":[{"txid":"0x1c615d4043c98fc0e285c2f40cc3601cf4ebe1cf9d2b404dfc67c9cd085444ec","size":265,"version":0,"nonce":9,"sender":"ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG","sys_fee":"0","net_fee":"0.0036521","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x870958fd19ee3f6c7dc3c2df399d013910856e31","scopes":"CalledByEntry"}],"script":"AHsMFCBygnSvr8NvQ6Bx0yjPo+Yp2cuwDBQxboUQOQGdOd/Cw31sP+4Z/VgJhxPADAh0cmFuc2ZlcgwUdpFiJB7t+XwkgWUq3xug9b9XQxtBYn1bUjg=","scripts":[{"invocation":"DEA00C87l6Ig/+eWQOSCuIfsDkTcyV5xn14rQ7KZh/DJgiua8EmdkAlMatO6GR5DSj313TeNO3MxjPR8ny1tgBzI","verification":"DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ="}]}]}`, - `{"jsonrpc":"2.0","method":"block_added","params":[{"hash":"0x765ea65b4de6addfee29b1c90ac922d1901c8d7ab7f2366da9a8ad3dd71ca703","version":0,"previousblockhash":"0xbdeed527a43ab72d5d8cecf1dc6ee142112ff8a8eaaaebc7206d3df3bf3c1169","merkleroot":"0xa1b321f59b127cddd23b0cd47fc9ec7920647d30d7ab23318a106597b9c9abad","time":1591366176006,"index":6,"nextconsensus":"AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL","witnesses":[{"invocation":"DEDaH0tUaopg6WWWNRI013CTkYZrs1kKKQEzvAxFg38drGNR7jJQan4Lv2/LzD7AEiLM/oS8HUBxIh9MQy6/VptiDEDuWQYygBKopKQR5/ojqouiH+24GxFYHloofK2WH6NtKiCyBpVJpaFIYNnprjZA6iD5GR1gq3wq7d9D7dbavlWMDED1OR5559YvfMqpAFEdUw+J3hg/pRvEr3RL2oH3Y+FN3X+5U+abCQFmDUdS8kDVJpNE0LZLULEk0aMWrXJIbaFeDEABL3c/rvKu5K9Z4IO0Q+vmz0BNEvSdMpZsX0jywgPihEKWFaotNMgnNW1Vw74WEvZ6W3Jfb/Sbm5Wx9gMGpytx","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"consensus_data":{"primary":0,"nonce":"0000000000000457"},"tx":[{"txid":"0x1c615d4043c98fc0e285c2f40cc3601cf4ebe1cf9d2b404dfc67c9cd085444ec","size":265,"version":0,"nonce":9,"sender":"ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG","sys_fee":"0","net_fee":"0.0036521","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x870958fd19ee3f6c7dc3c2df399d013910856e31","scopes":"CalledByEntry"}],"script":"AHsMFCBygnSvr8NvQ6Bx0yjPo+Yp2cuwDBQxboUQOQGdOd/Cw31sP+4Z/VgJhxPADAh0cmFuc2ZlcgwUdpFiJB7t+XwkgWUq3xug9b9XQxtBYn1bUjg=","scripts":[{"invocation":"DEA00C87l6Ig/+eWQOSCuIfsDkTcyV5xn14rQ7KZh/DJgiua8EmdkAlMatO6GR5DSj313TeNO3MxjPR8ny1tgBzI","verification":"DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ="}]}]}]}`, + `{"jsonrpc":"2.0","method":"transaction_added","params":[{"txid":"0x1c615d4043c98fc0e285c2f40cc3601cf4ebe1cf9d2b404dfc67c9cd085444ec","size":265,"version":0,"nonce":9,"sender":"NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN","sys_fee":"0","net_fee":"0.0036521","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x870958fd19ee3f6c7dc3c2df399d013910856e31","scopes":"CalledByEntry"}],"script":"AHsMFCBygnSvr8NvQ6Bx0yjPo+Yp2cuwDBQxboUQOQGdOd/Cw31sP+4Z/VgJhxPADAh0cmFuc2ZlcgwUdpFiJB7t+XwkgWUq3xug9b9XQxtBYn1bUjg=","scripts":[{"invocation":"DEA00C87l6Ig/+eWQOSCuIfsDkTcyV5xn14rQ7KZh/DJgiua8EmdkAlMatO6GR5DSj313TeNO3MxjPR8ny1tgBzI","verification":"DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ="}]}]}`, + `{"jsonrpc":"2.0","method":"block_added","params":[{"hash":"0x765ea65b4de6addfee29b1c90ac922d1901c8d7ab7f2366da9a8ad3dd71ca703","version":0,"previousblockhash":"0xbdeed527a43ab72d5d8cecf1dc6ee142112ff8a8eaaaebc7206d3df3bf3c1169","merkleroot":"0xa1b321f59b127cddd23b0cd47fc9ec7920647d30d7ab23318a106597b9c9abad","time":1591366176006,"index":6,"nextconsensus":"Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2","witnesses":[{"invocation":"DEDaH0tUaopg6WWWNRI013CTkYZrs1kKKQEzvAxFg38drGNR7jJQan4Lv2/LzD7AEiLM/oS8HUBxIh9MQy6/VptiDEDuWQYygBKopKQR5/ojqouiH+24GxFYHloofK2WH6NtKiCyBpVJpaFIYNnprjZA6iD5GR1gq3wq7d9D7dbavlWMDED1OR5559YvfMqpAFEdUw+J3hg/pRvEr3RL2oH3Y+FN3X+5U+abCQFmDUdS8kDVJpNE0LZLULEk0aMWrXJIbaFeDEABL3c/rvKu5K9Z4IO0Q+vmz0BNEvSdMpZsX0jywgPihEKWFaotNMgnNW1Vw74WEvZ6W3Jfb/Sbm5Wx9gMGpytx","verification":"EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw=="}],"consensus_data":{"primary":0,"nonce":"0000000000000457"},"tx":[{"txid":"0x1c615d4043c98fc0e285c2f40cc3601cf4ebe1cf9d2b404dfc67c9cd085444ec","size":265,"version":0,"nonce":9,"sender":"NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN","sys_fee":"0","net_fee":"0.0036521","valid_until_block":1200,"attributes":[],"cosigners":[{"account":"0x870958fd19ee3f6c7dc3c2df399d013910856e31","scopes":"CalledByEntry"}],"script":"AHsMFCBygnSvr8NvQ6Bx0yjPo+Yp2cuwDBQxboUQOQGdOd/Cw31sP+4Z/VgJhxPADAh0cmFuc2ZlcgwUdpFiJB7t+XwkgWUq3xug9b9XQxtBYn1bUjg=","scripts":[{"invocation":"DEA00C87l6Ig/+eWQOSCuIfsDkTcyV5xn14rQ7KZh/DJgiua8EmdkAlMatO6GR5DSj313TeNO3MxjPR8ny1tgBzI","verification":"DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ="}]}]}]}`, `{"jsonrpc":"2.0","method":"event_missed","params":[]}`, } srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { diff --git a/pkg/rpc/request/param_test.go b/pkg/rpc/request/param_test.go index cda859665..92980516a 100644 --- a/pkg/rpc/request/param_test.go +++ b/pkg/rpc/request/param_test.go @@ -185,7 +185,7 @@ func TestParamGetUint160FromHex(t *testing.T) { } func TestParamGetUint160FromAddress(t *testing.T) { - in := "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y" + in := "NPAsqZkx9WhNd4P72uhZxBhLinSuNkxfB8" u160, _ := address.StringToUint160(in) p := Param{StringT, in} u, err := p.GetUint160FromAddress() diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index e206b6b03..b548c477c 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -734,12 +734,12 @@ var rpcTestCases = map[string][]rpcTestCase{ "validateaddress": { { name: "positive", - params: `["AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i"]`, + params: `["Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2"]`, result: func(*executor) interface{} { return &result.ValidateAddress{} }, check: func(t *testing.T, e *executor, va interface{}) { res, ok := va.(*result.ValidateAddress) require.True(t, ok) - assert.Equal(t, "AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i", res.Address) + assert.Equal(t, "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", res.Address) assert.True(t, res.IsValid) }, }, diff --git a/pkg/smartcontract/param_type_test.go b/pkg/smartcontract/param_type_test.go index fd562ee15..1aa5a4a7a 100644 --- a/pkg/smartcontract/param_type_test.go +++ b/pkg/smartcontract/param_type_test.go @@ -96,7 +96,7 @@ func TestInferParamType(t *testing.T) { in: "truee", out: StringType, }, { - in: "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y", + in: "NPAsqZkx9WhNd4P72uhZxBhLinSuNkxfB8", out: Hash160Type, }, { in: "ZK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y", @@ -200,7 +200,7 @@ func TestAdjustValToType(t *testing.T) { err: true, }, { typ: Hash160Type, - val: "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y", + val: "NPAsqZkx9WhNd4P72uhZxBhLinSuNkxfB8", out: util.Uint160{ 0x23, 0xba, 0x27, 0x3, 0xc5, 0x32, 0x63, 0xe8, 0xd6, 0xe5, 0x22, 0xdc, 0x32, 0x20, 0x33, 0x39, 0xdc, 0xd8, 0xee, 0xe9, diff --git a/pkg/wallet/account_test.go b/pkg/wallet/account_test.go index fb61c3dc4..4672a64bd 100644 --- a/pkg/wallet/account_test.go +++ b/pkg/wallet/account_test.go @@ -113,13 +113,13 @@ func TestAccount_ConvertMultisig(t *testing.T) { t.Run("1/1 multisig", func(t *testing.T) { pubs := convertPubs(t, hexs[:1]) require.NoError(t, a.ConvertMultisig(1, pubs)) - require.Equal(t, "AUhsL7QeeomkuzxZexPTa11xNXrbsBrGVc", a.Address) + require.Equal(t, "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR", a.Address) }) t.Run("3/4 multisig", func(t *testing.T) { pubs := convertPubs(t, hexs) require.NoError(t, a.ConvertMultisig(3, pubs)) - require.Equal(t, "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", a.Address) + require.Equal(t, "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", a.Address) }) } diff --git a/pkg/wallet/testdata/wallet1.json b/pkg/wallet/testdata/wallet1.json index 31b76902d..299884352 100644 --- a/pkg/wallet/testdata/wallet1.json +++ b/pkg/wallet/testdata/wallet1.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", diff --git a/pkg/wallet/testdata/wallet2.json b/pkg/wallet/testdata/wallet2.json index f3c5aa294..5c83a2e09 100644 --- a/pkg/wallet/testdata/wallet2.json +++ b/pkg/wallet/testdata/wallet2.json @@ -1,9 +1,9 @@ { - "version": "1.0", + "version": "3.0", "accounts": [ { - "address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", @@ -19,8 +19,8 @@ "isDefault": false }, { - "address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", - "key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj", + "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", + "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", @@ -44,8 +44,8 @@ "isDefault": false }, { - "address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF", - "key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q", + "address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", + "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", diff --git a/pkg/wallet/token_test.go b/pkg/wallet/token_test.go index b670d70e9..e34f975f1 100644 --- a/pkg/wallet/token_test.go +++ b/pkg/wallet/token_test.go @@ -18,7 +18,7 @@ func TestToken_MarshalJSON(t *testing.T) { require.Equal(t, "NEP5", tok.Symbol) require.EqualValues(t, 8, tok.Decimals) require.Equal(t, h, tok.Hash) - require.Equal(t, "AYhE3Svuqdfh1RtzvE8hUhNR7HSpaSDFQg", tok.Address()) + require.Equal(t, "NcqKahsZ93ZyYS5bep8G2TY1zRB7tfUPdK", tok.Address()) data, err := json.Marshal(tok) require.NoError(t, err) diff --git a/pkg/wallet/wallet.go b/pkg/wallet/wallet.go index c77128f68..3b1fc236b 100644 --- a/pkg/wallet/wallet.go +++ b/pkg/wallet/wallet.go @@ -13,7 +13,7 @@ import ( const ( // The current version of neo-go wallet implementations. - walletVersion = "1.0" + walletVersion = "3.0" ) // Wallet represents a NEO (NEP-2, NEP-6) compliant wallet. diff --git a/pkg/wallet/wallet_test.go b/pkg/wallet/wallet_test.go index eada0c507..e811eea04 100644 --- a/pkg/wallet/wallet_test.go +++ b/pkg/wallet/wallet_test.go @@ -181,14 +181,14 @@ func TestWalletGetChangeAddress(t *testing.T) { require.NoError(t, err) sh := w1.GetChangeAddress() // No default address, the first one is used. - expected, err := address.StringToUint160("ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG") + expected, err := address.StringToUint160("NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN") require.NoError(t, err) require.Equal(t, expected, sh) w2, err := NewWalletFromFile("testdata/wallet2.json") require.NoError(t, err) sh = w2.GetChangeAddress() // Default address. - expected, err = address.StringToUint160("AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF") + expected, err = address.StringToUint160("NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ") require.NoError(t, err) require.Equal(t, expected, sh) }