forked from TrueCloudLab/neoneo-go
config: update testnet netmode to preview5 magic
This commit is contained in:
parent
d138ed731c
commit
840104461b
6 changed files with 140 additions and 95 deletions
|
@ -6,7 +6,7 @@ const (
|
|||
// MainNet contains magic code used in the NEO main official network.
|
||||
MainNet Magic = 0x004f454e // 5195086
|
||||
// TestNet contains magic code used in the NEO testing network.
|
||||
TestNet Magic = 0x744f454e // 1951352142
|
||||
TestNet Magic = 0x3550334E // 894448462
|
||||
// PrivNet contains magic code usually used for NEO private networks.
|
||||
PrivNet Magic = 56753 // docker privnet
|
||||
// UnitTestNet is a stub magic code used for testing purposes.
|
||||
|
|
|
@ -110,15 +110,15 @@ func TestHashBlockEqualsHashHeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBinBlockDecodeEncode(t *testing.T) {
|
||||
// transaction taken from mainnet: 2000000
|
||||
rawtx := "0000000005440c786a66aaebf472aacb1d1db19d5b494c6a9226ea91bf5cf0e63a6605138cde5064efb81bc6539620b9e6d6d7c74f97d415b922c4fb4bb1833ce6a97a9d61f962fb7301000065f000005d12ac6c589d59f92e82d8bf60659cb716ffc1f101fd4a010c4011ff5d2138cf546d112ef712ee8a15277f7b6f1d5d2564b97497ac155782e6089cd3005dc9de81a8b22bb2f1c3a2edbac55e01581cb27980fdedf3a8bc57fa470c40657253c374a48da773fc653591f282a63a60695f29ab6c86300020ed505a019e5563e1be493efa71bdde37b16b4ec3f5f6dc2d2a2550151b020176b4dbe7afe40c403efdc559cb6bff135fd79138267db897c6fded01e3a0f15c0fb1c337359935d65e7ac49239f020951a74a96e11e73d225c9789953ffec40d5f7c9a84707b1d9a0c402804f24ab8034fa41223977ba48883eb94951184e31e5739872daf4f65461de3196ebf333f6d7dc4aff0b7b2143793179415f50a715484aba4e33b97dc636e150c40ed6b2ffeaef97eef746815ad16f5b8aed743892e93f7216bb744eb5c2f4cad91ae291919b61cd9a8d50fe85630d5e010c49a01ed687727c3ae5a7e17d4da213afdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd0c2102f889ecd43c5126ff1932d75fa87dea34fc95325fb724db93c8f79fe32cc3f180170b41138defaf0202c1353ed4e94d0cbc00be80024f7673890000000000261c130000000000e404210001f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e01005d0300743ba40b0000000c14aa07cc3f2193a973904a09a6e60b87f1f96273970c14f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e13c00c087472616e736665720c14bcaf41d684c7d4ad6ee0d99da9707b9d1f0c8e6641627d5b523801420c402360bbf64b9644c25f066dbd406454b07ab9f56e8e25d92d90c96c598f6c29d97eabdcf226f3575481662cfcdd064ee410978e5fae3f09a2f83129ba9cd82641290c2103caf763f91d3691cba5b5df3eb13e668fdace0295b37e2e259fd0fb152d354f900b4195440d78"
|
||||
rawtxBytes, _ := hex.DecodeString(rawtx)
|
||||
// block taken from testnet: 256
|
||||
rawblock := "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"
|
||||
rawblockBytes, _ := base64.StdEncoding.DecodeString(rawblock)
|
||||
|
||||
b := New(netmode.TestNet, false)
|
||||
|
||||
assert.NoError(t, testserdes.DecodeBinary(rawtxBytes, b))
|
||||
assert.NoError(t, testserdes.DecodeBinary(rawblockBytes, b))
|
||||
expected := map[string]bool{ // 1 trans
|
||||
"58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce": false,
|
||||
"affad44bb6acacabc058db0bf1e12ab1239ae5e04007b4d4a2ea0cda868e284a": false,
|
||||
}
|
||||
|
||||
var hashes []string
|
||||
|
@ -145,7 +145,7 @@ func TestBinBlockDecodeEncode(t *testing.T) {
|
|||
|
||||
data, err := testserdes.EncodeBinary(b)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, rawtx, hex.EncodeToString(data))
|
||||
assert.Equal(t, rawblock, base64.StdEncoding.EncodeToString(data))
|
||||
|
||||
// update hidden hash value.
|
||||
_ = b.ConsensusData.Hash()
|
||||
|
@ -154,14 +154,14 @@ func TestBinBlockDecodeEncode(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBlockSizeCalculation(t *testing.T) {
|
||||
// block taken from testnet at height 61451: b2d9f9fe9860ff71a45c5278e2a84c22bdda84dd8e9313f1e440bea955ea540d
|
||||
// block taken from testnet at height 256: 51ee44e12cdc1d3041a50d352063127fa65d86670686f14cc08f01b3cee7de17
|
||||
// The Size in golang is given by counting the number of bytes of an object. (len(Bytes))
|
||||
// its implementation is different from the corresponding C# and python implementations. But the result should
|
||||
// should be the same.In this test we provide more details then necessary because in case of failure we can easily debug the
|
||||
// root cause of the size calculation missmatch.
|
||||
|
||||
rawBlock := "0000000005440c786a66aaebf472aacb1d1db19d5b494c6a9226ea91bf5cf0e63a6605138cde5064efb81bc6539620b9e6d6d7c74f97d415b922c4fb4bb1833ce6a97a9d61f962fb7301000065f000005d12ac6c589d59f92e82d8bf60659cb716ffc1f101fd4a010c4011ff5d2138cf546d112ef712ee8a15277f7b6f1d5d2564b97497ac155782e6089cd3005dc9de81a8b22bb2f1c3a2edbac55e01581cb27980fdedf3a8bc57fa470c40657253c374a48da773fc653591f282a63a60695f29ab6c86300020ed505a019e5563e1be493efa71bdde37b16b4ec3f5f6dc2d2a2550151b020176b4dbe7afe40c403efdc559cb6bff135fd79138267db897c6fded01e3a0f15c0fb1c337359935d65e7ac49239f020951a74a96e11e73d225c9789953ffec40d5f7c9a84707b1d9a0c402804f24ab8034fa41223977ba48883eb94951184e31e5739872daf4f65461de3196ebf333f6d7dc4aff0b7b2143793179415f50a715484aba4e33b97dc636e150c40ed6b2ffeaef97eef746815ad16f5b8aed743892e93f7216bb744eb5c2f4cad91ae291919b61cd9a8d50fe85630d5e010c49a01ed687727c3ae5a7e17d4da213afdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd0c2102f889ecd43c5126ff1932d75fa87dea34fc95325fb724db93c8f79fe32cc3f180170b41138defaf0202c1353ed4e94d0cbc00be80024f7673890000000000261c130000000000e404210001f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e01005d0300743ba40b0000000c14aa07cc3f2193a973904a09a6e60b87f1f96273970c14f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e13c00c087472616e736665720c14bcaf41d684c7d4ad6ee0d99da9707b9d1f0c8e6641627d5b523801420c402360bbf64b9644c25f066dbd406454b07ab9f56e8e25d92d90c96c598f6c29d97eabdcf226f3575481662cfcdd064ee410978e5fae3f09a2f83129ba9cd82641290c2103caf763f91d3691cba5b5df3eb13e668fdace0295b37e2e259fd0fb152d354f900b4195440d78"
|
||||
rawBlockBytes, _ := hex.DecodeString(rawBlock)
|
||||
rawBlock := "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"
|
||||
rawBlockBytes, _ := base64.StdEncoding.DecodeString(rawBlock)
|
||||
|
||||
b := New(netmode.TestNet, false)
|
||||
assert.NoError(t, testserdes.DecodeBinary(rawBlockBytes, b))
|
||||
|
@ -174,7 +174,7 @@ func TestBlockSizeCalculation(t *testing.T) {
|
|||
AttributesLen int
|
||||
WitnessesLen int
|
||||
}{ // 1 trans
|
||||
{ID: "58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce", Size: 252, Version: 0, SignersLen: 1, AttributesLen: 0, WitnessesLen: 1},
|
||||
{ID: "affad44bb6acacabc058db0bf1e12ab1239ae5e04007b4d4a2ea0cda868e284a", Size: 864, Version: 0, SignersLen: 2, AttributesLen: 0, WitnessesLen: 2},
|
||||
}
|
||||
|
||||
for i, tx := range b.Transactions {
|
||||
|
@ -192,23 +192,23 @@ func TestBlockSizeCalculation(t *testing.T) {
|
|||
|
||||
// Block specific tests
|
||||
assert.Equal(t, 0, int(b.Version))
|
||||
assert.Equal(t, "1305663ae6f05cbf91ea26926a4c495b9db11d1dcbaa72f4ebaa666a780c4405", b.PrevHash.StringLE())
|
||||
assert.Equal(t, "9d7aa9e63c83b14bfbc422b915d4974fc7d7d6e6b9209653c61bb8ef6450de8c", b.MerkleRoot.StringLE())
|
||||
assert.Equal(t, 1597650434401, int(b.Timestamp))
|
||||
assert.Equal(t, 61541, int(b.Index))
|
||||
assert.Equal(t, "fd2b68ac95461aa8ecd9ce7817bc0dea12985fc5ca52cfb5c39426e4071c1952", b.PrevHash.StringLE())
|
||||
assert.Equal(t, "0a4ce89ab8b057ff5f3b421f5c85d3a90db9e613c020b9916096fb5282f719a9", b.MerkleRoot.StringLE())
|
||||
assert.Equal(t, 1612366104874, int(b.Timestamp))
|
||||
assert.Equal(t, 256, int(b.Index))
|
||||
|
||||
nextConsensus := address.Uint160ToString(b.NextConsensus)
|
||||
assert.Equal(t, "NUQ6Q4BWvHU71HNxPQ4LMSHPMK1jSz1nw4", nextConsensus)
|
||||
assert.Equal(t, "NgPkjjLTNcQad99iRYeXRUuowE4gxLAnDL", nextConsensus)
|
||||
|
||||
assert.Equal(t, "DEAR/10hOM9UbREu9xLuihUnf3tvHV0lZLl0l6wVV4LmCJzTAF3J3oGosiuy8cOi7brFXgFYHLJ5gP3t86i8V/pHDEBlclPDdKSNp3P8ZTWR8oKmOmBpXymrbIYwACDtUFoBnlVj4b5JPvpxvd43sWtOw/X23C0qJVAVGwIBdrTb56/kDEA+/cVZy2v/E1/XkTgmfbiXxv3tAeOg8VwPscM3NZk11l56xJI58CCVGnSpbhHnPSJcl4mVP/7EDV98moRwex2aDEAoBPJKuANPpBIjl3ukiIPrlJURhOMeVzmHLa9PZUYd4xluvzM/bX3Er/C3shQ3kxeUFfUKcVSEq6TjO5fcY24VDEDtay/+rvl+73RoFa0W9biu10OJLpP3IWu3ROtcL0ytka4pGRm2HNmo1Q/oVjDV4BDEmgHtaHcnw65afhfU2iE6", base64.StdEncoding.EncodeToString(b.Script.InvocationScript))
|
||||
assert.Equal(t, "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhA0CNzUFjlvZHg6xYfqHhWTxX2f6ogMimoZIOkqJZR3gGDCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsMIQK6LHD1mW81ekMZhwWFn64s/qE+EXKWKAB3Kz1Yip1KvQwhAviJ7NQ8USb/GTLXX6h96jT8lTJftyTbk8j3n+Msw/GAFwtBE43vrw==", base64.StdEncoding.EncodeToString(b.Script.VerificationScript))
|
||||
assert.Equal(t, "b2d9f9fe9860ff71a45c5278e2a84c22bdda84dd8e9313f1e440bea955ea540d", b.Hash().StringLE())
|
||||
assert.Equal(t, "DEAZyIVwKWzpgvm8bSzWuVF1awS0QBguORR682YoVfkJ05KGG7pz9OsLBZ9/F1BHO7TCIcEcc8Sr9AcqbonrSRoCDEDhhZnqTUi8tXYbrTBrVj8i9Yxl8NraAMID4DJryWdD6u42OzAHr0of27qc5nojujhLffBfljuBSyQpyeQcUOpyDEAZr7sLz6n4TgNApkwATGXiP/DZ8AummAGDtznrW6Y8XWHngB7F0j3NKvUQ7lyRt11rT+zNjz5R5vIbBrs8C2ktDEDgNW0xGP/OB8CRHXX/l/+0tPO3drkyCddpG9PKCgyd4oEhQu8cwbSv4Q0V1Y0dZcJBoxUB5Qus/U+Xli7jb6OJDEADaXZxdEb56jlYhF4oM8I8KnthEzGw1Q7pfeI97fehTm78ZOJXWIxESThZzI3D2ndVz0Rcdr5MeA/espG6J2ao", base64.StdEncoding.EncodeToString(b.Script.InvocationScript))
|
||||
assert.Equal(t, "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw==", base64.StdEncoding.EncodeToString(b.Script.VerificationScript))
|
||||
assert.Equal(t, "51ee44e12cdc1d3041a50d352063127fa65d86670686f14cc08f01b3cee7de17", b.Hash().StringLE())
|
||||
|
||||
benc, err := testserdes.EncodeBinary(b)
|
||||
assert.NoError(t, err)
|
||||
// test size of the block
|
||||
assert.Equal(t, 952, len(benc))
|
||||
assert.Equal(t, rawBlock, hex.EncodeToString(benc))
|
||||
assert.Equal(t, 1564, len(benc))
|
||||
assert.Equal(t, rawBlock, base64.StdEncoding.EncodeToString(benc))
|
||||
}
|
||||
|
||||
func TestBlockCompare(t *testing.T) {
|
||||
|
|
|
@ -1,49 +1,57 @@
|
|||
{
|
||||
"raw": "000000002c343609ae0055bcdb57cc6e89b8e466cb264522feb1e0f916eb4a6a0d50f6a9129f211ef3bddbb1ed3ac496d6ee2de537764c4fb26c4b470e2f3a52fe6474dd75de3eb973010000c8000000e0a3c55cad72028fb5901748b19a27be21f6540401fd4a010c40d9bd422d752b9703080dd03c0b7182578d393e28f64ada3b76211f7b939c74a835bf354608af0ce8569ed9a65a7c578f1bbb742563c3086539e8b5ad5a0900590c405125cd7e76c2ce97546b9e5ea74ab313fb5875dc6d0567102ca2efee14e1de8d2b1deb332101b7c703d9c051ea6d43230db5fc787941bb40ad2c327a491936c10c402ad062631f244303d5818be9bce3d8aa5384ffaf8c531181166f45a230f96f93f42ea1c24286fe90e683249b39233223d84fe0996dcb458ef1288607ead535a50c40da40c40953d461d34014c5e66859874f6eec0740373054ea57dd66f615e2fa03fa395222b502f54210c0914975839c472702454e8d18040b702e6443f7e84f020c40393978243b8e81c6e08f0b021b9795c1c8f8d4d6155f0f16e28f30715bc38798a98b82d98e02a47f84d8b441ba157e8b280d27024fa1159e861c45fab9a647befdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf02045be5c3458d87a02c00f5f0617fc6ab5b000000000016f51200000000004615200001574d3c03df4a9b2772af08e4b296721009b7a6fd0100530c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b11c00c11726567697374657243616e6469646174650c1425059ecb4878d3a875f91c51ceded330d4575fde41627d5b5201420c40e3dfd02f6ec79dd6dbbe434540349187d975d5931bcf961c9d6b463d97165437049beec702ee14e69eb953c785134e689a3108464a130147174a80421756f391290c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0b4195440d78",
|
||||
"hash": "0xfe767cae1a0a2c0825cc3610dd5fccd6b0dac4a5e2ab56644eea53cafce64848",
|
||||
"size": 942,
|
||||
"version": 0,
|
||||
"previousblockhash": "0xa9f6500d6a4aeb16f9e0b1fe224526cb66e4b8896ecc57dbbc5500ae0936342c",
|
||||
"merkleroot": "0xdd7464fe523a2f0e474b6cb24f4c7637e52deed696c43aedb1dbbdf31e219f12",
|
||||
"time": 1596540771957,
|
||||
"index": 200,
|
||||
"nextconsensus": "NgPkjjLTNcQad99iRYeXRUuowE4gxLAnDL",
|
||||
"witnesses": [
|
||||
"raw": "0000000052191c07e42694c3b5cf52cac55f9812ea0dbc1778ced9eca81a4695ac682bfda919f78252fb966091b920c013e6b90da9d3855c1f423b5fff57b0b89ae84c0a2a4982687701000000010000e0a3c55cad72028fb5901748b19a27be21f6540401fd4a010c4019c88570296ce982f9bc6d2cd6b951756b04b440182e39147af3662855f909d392861bba73f4eb0b059f7f1750473bb4c221c11c73c4abf4072a6e89eb491a020c40e18599ea4d48bcb5761bad306b563f22f58c65f0dada00c203e0326bc96743eaee363b3007af4a1fdbba9ce67a23ba384b7df05f963b814b2429c9e41c50ea720c4019afbb0bcfa9f84e0340a64c004c65e23ff0d9f00ba6980183b739eb5ba63c5d61e7801ec5d23dcd2af510ee5c91b75d6b4feccd8f3e51e6f21b06bb3c0b692d0c40e0356d3118ffce07c0911d75ff97ffb4b4f3b776b93209d7691bd3ca0a0c9de2812142ef1cc1b4afe10d15d58d1d65c241a31501e50bacfd4f97962ee36fa3890c40036976717446f9ea3958845e2833c23c2a7b611331b0d50ee97de23dedf7a14e6efc64e257588c44493859cc8dc3da7755cf445c76be4c780fdeb291ba2766a8fdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf0204fbfc24031bb336f6004883fd4bb494980000000000983c8500000000007f17000002574d3c03df4a9b2772af08e4b296721009b7a6fd00e0a3c55cad72028fb5901748b19a27be21f6540401005f0b0300e40b54020000000c14f6ed986d8f6478b647ddae2083069ca4cfdb23400c14e0a3c55cad72028fb5901748b19a27be21f6540414c01f0c087472616e736665720c1428b3adab7269f9c2181db3cb741ebf551930e27041627d5b523902420c4001a8eb709edc764591af846e7bfba10a908577ad57365b590593a4f81ea5a86ac046b9e1ac69ed39ec30cb97c2c7ef538f00fc105027758454b2bede94cd3bef290c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0b4195440d78fd4a010c40e254613ac2b3bd756d907932b15278e62b094a3eab90eff5aa2c56b598161852775cbd76076ac01fe48afdf897077845c415b3ca7884668e94396719b6db66e30c40a7427e3cd5238e3a5d4ab3b4361a37872af3dd8be336b9f1f19f0bd4972edb879b781d0c45dc684da7b220b8d399bea1948c1fe924daa5edbb8df117894130530c4099a1516792326083e50d99d4a97425b31c429136949688081619084403e0065c6ba576a0a4589d9115e3cf71c843c52e476b62ff4349c73838b2c2cb39f6c43d0c409ec13c315e485503ce8d1c821b0ed41ce3f39e914352973ec8ee1fefd024e106e709610bf9d500f56ec0e72c09e427cd8fd0a68bd9ef3b21176e8afd80aaef710c4022d33dc3217be4bb22144d98552ef35f23b1f10367924b4c6bea71d6c280cf2a2fff15f3c9f235cd5620bf310709aa53d6403e6d2fe6d07f13d83803a2c13a7ffdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf",
|
||||
"size" : 1564,
|
||||
"index" : 256,
|
||||
"time" : 1612366104874,
|
||||
"confirmations" : 10883,
|
||||
"consensusdata" : {
|
||||
"primary" : 4,
|
||||
"nonce" : "f636b31b0324fcfb"
|
||||
},
|
||||
"previousblockhash" : "0xfd2b68ac95461aa8ecd9ce7817bc0dea12985fc5ca52cfb5c39426e4071c1952",
|
||||
"nextconsensus" : "NgPkjjLTNcQad99iRYeXRUuowE4gxLAnDL",
|
||||
"hash" : "0x51ee44e12cdc1d3041a50d352063127fa65d86670686f14cc08f01b3cee7de17",
|
||||
"witnesses" : [
|
||||
{
|
||||
"invocation": "DEDZvUItdSuXAwgN0DwLcYJXjTk+KPZK2jt2IR97k5x0qDW/NUYIrwzoVp7Zplp8V48bu3QlY8MIZTnota1aCQBZDEBRJc1+dsLOl1Rrnl6nSrMT+1h13G0FZxAsou/uFOHejSsd6zMhAbfHA9nAUeptQyMNtfx4eUG7QK0sMnpJGTbBDEAq0GJjHyRDA9WBi+m849iqU4T/r4xTEYEWb0WiMPlvk/QuocJChv6Q5oMkmzkjMiPYT+CZbctFjvEohgfq1TWlDEDaQMQJU9Rh00AUxeZoWYdPbuwHQDcwVOpX3Wb2FeL6A/o5UiK1AvVCEMCRSXWDnEcnAkVOjRgEC3AuZEP36E8CDEA5OXgkO46BxuCPCwIbl5XByPjU1hVfDxbijzBxW8OHmKmLgtmOAqR/hNi0QboVfosoDScCT6EVnoYcRfq5pke+",
|
||||
"verification": "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw=="
|
||||
"verification" : "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw==",
|
||||
"invocation" : "DEAZyIVwKWzpgvm8bSzWuVF1awS0QBguORR682YoVfkJ05KGG7pz9OsLBZ9/F1BHO7TCIcEcc8Sr9AcqbonrSRoCDEDhhZnqTUi8tXYbrTBrVj8i9Yxl8NraAMID4DJryWdD6u42OzAHr0of27qc5nojujhLffBfljuBSyQpyeQcUOpyDEAZr7sLz6n4TgNApkwATGXiP/DZ8AummAGDtznrW6Y8XWHngB7F0j3NKvUQ7lyRt11rT+zNjz5R5vIbBrs8C2ktDEDgNW0xGP/OB8CRHXX/l/+0tPO3drkyCddpG9PKCgyd4oEhQu8cwbSv4Q0V1Y0dZcJBoxUB5Qus/U+Xli7jb6OJDEADaXZxdEb56jlYhF4oM8I8KnthEzGw1Q7pfeI97fehTm78ZOJXWIxESThZzI3D2ndVz0Rcdr5MeA/espG6J2ao"
|
||||
}
|
||||
],
|
||||
"consensusdata": {
|
||||
"primary": 4,
|
||||
"nonce": "2ca0878d45c3e55b"
|
||||
},
|
||||
"tx": [
|
||||
"nextblockhash" : "0xad6ff40813e18d09bc08ec39e765a9eae40123878f5b6e9bc3bde2ff52e32877",
|
||||
"version" : 0,
|
||||
"tx" : [
|
||||
{
|
||||
"hash": "0xca3e47909a27096ee880fac3b1f261dc912b0ba04c83f9142692cfefccedd41a",
|
||||
"size": 242,
|
||||
"version": 0,
|
||||
"nonce": 2137125109,
|
||||
"sender": "NTsaVneGBcARqEddHLAYaS6bncsZNS6X3S",
|
||||
"sysfee": "6007750",
|
||||
"netfee": "1242390",
|
||||
"validuntilblock": 2102598,
|
||||
"signers": [
|
||||
"signers" : [
|
||||
{
|
||||
"account": "0xfda6b709107296b2e408af72279b4adf033c4d57",
|
||||
"scopes": "CalledByEntry"
|
||||
"account" : "0xfda6b709107296b2e408af72279b4adf033c4d57",
|
||||
"scopes" : "None"
|
||||
},
|
||||
{
|
||||
"account" : "0x0454f621be279ab1481790b58f0272ad5cc5a3e0",
|
||||
"scopes" : "CalledByEntry"
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"script": "DCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsRwAwRcmVnaXN0ZXJDYW5kaWRhdGUMFCUFnstIeNOodfkcUc7e0zDUV1/eQWJ9W1I=",
|
||||
"witnesses": [
|
||||
"script" : "CwMA5AtUAgAAAAwU9u2YbY9keLZH3a4ggwacpM/bI0AMFOCjxVytcgKPtZAXSLGaJ74h9lQEFMAfDAh0cmFuc2ZlcgwUKLOtq3Jp+cIYHbPLdB6/VRkw4nBBYn1bUjk=",
|
||||
"attributes" : [],
|
||||
"validuntilblock" : 6015,
|
||||
"sender" : "NTsaVneGBcARqEddHLAYaS6bncsZNS6X3S",
|
||||
"sysfee" : "9999540",
|
||||
"size" : 864,
|
||||
"netfee" : "8731800",
|
||||
"nonce" : 1274905416,
|
||||
"version" : 0,
|
||||
"hash" : "0xaffad44bb6acacabc058db0bf1e12ab1239ae5e04007b4d4a2ea0cda868e284a",
|
||||
"witnesses" : [
|
||||
{
|
||||
"invocation": "DEDj39Avbsed1tu+Q0VANJGH2XXVkxvPlhyda0Y9lxZUNwSb7scC7hTmnrlTx4UTTmiaMQhGShMBRxdKgEIXVvOR",
|
||||
"verification": "DCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsLQZVEDXg="
|
||||
"verification" : "DCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsLQZVEDXg=",
|
||||
"invocation" : "DEABqOtwntx2RZGvhG57+6EKkIV3rVc2W1kFk6T4HqWoasBGueGsae057DDLl8LH71OPAPwQUCd1hFSyvt6UzTvv"
|
||||
},
|
||||
{
|
||||
"verification" : "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw==",
|
||||
"invocation" : "DEDiVGE6wrO9dW2QeTKxUnjmKwlKPquQ7/WqLFa1mBYYUndcvXYHasAf5Ir9+JcHeEXEFbPKeIRmjpQ5Zxm222bjDECnQn481SOOOl1Ks7Q2GjeHKvPdi+M2ufHxnwvUly7bh5t4HQxF3GhNp7IguNOZvqGUjB/pJNql7buN8ReJQTBTDECZoVFnkjJgg+UNmdSpdCWzHEKRNpSWiAgWGQhEA+AGXGuldqCkWJ2RFePPcchDxS5Ha2L/Q0nHODiywss59sQ9DECewTwxXkhVA86NHIIbDtQc4/OekUNSlz7I7h/v0CThBucJYQv51QD1bsDnLAnkJ82P0KaL2e87IRduiv2Aqu9xDEAi0z3DIXvkuyIUTZhVLvNfI7HxA2eSS0xr6nHWwoDPKi//FfPJ8jXNViC/MQcJqlPWQD5tL+bQfxPYOAOiwTp/"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"confirmations": 67197,
|
||||
"nextblockhash": "0x99b23a3bb26cae7e78b880a8b6bacf85a7ae923c7d6239f9a9f72604909fbba3"
|
||||
"merkleroot" : "0x0a4ce89ab8b057ff5f3b421f5c85d3a90db9e613c020b9916096fb5282f719a9"
|
||||
}
|
|
@ -1,24 +1,57 @@
|
|||
{
|
||||
"raw": "00000000f791a09cffc085e7864d56ad8a74ee3e04f43c9affcbf14a87a903a889e8e215b5ef5b1df95f0fa5fe508157abdc64680a850dfb36018406758f02da97fc6ced5fccc5da73010000b88800005d12ac6c589d59f92e82d8bf60659cb716ffc1f101fd4a010c40fecf3fed562e1d39cfbc198b4bd5ccdfcea48b300917f3fb45c6f67004bfce8f816198018ccc93a595d62c1030eb29de56380ca67c087dadf4fd73e7f2ef2b910c409b6f623a720fabf6c21dc6e45f0a408a61b3664a81c08a644440b760884db2578fc00e0a16ac0c5bcb441713c0eb56b8448e6fe11c874cc78340ff62350e56f50c40b069d11b240c193fbbbb8115771827a133ca43e03d85ed0ce51893e1ea8ad9c779e8f683f1f455f57518c97a892fdfad7806364a11a9fb349b668a97862c503e0c4027fbc2eca5271da68905deee04ce3cd67450cf52c80c0ffea6d13c68708f3ba3ff6d4312bfff4d096ed5533342c5cf408c4130d05bfd0487dccb025a4b43c0fd0c408bbd56726fb88e4cf4f8dd33a57f9ab6297c8d84de210a585aaacb74cc00746daf44ea6e713d33c2e87344baec2f3cf70c72513d3bd5c7071c5c7d434c828c11fdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd0c2102f889ecd43c5126ff1932d75fa87dea34fc95325fb724db93c8f79fe32cc3f180170b41138defaf01001a82894d04b16977",
|
||||
"hash": "0xc39ffd0da100be6e8bd1ae536c8cb0b53f9988b635aca58ede3bdc3b6c832d78",
|
||||
"size": 700,
|
||||
"version": 0,
|
||||
"previousblockhash": "0x15e2e889a803a9874af1cbff9a3cf4043eee748aad564d86e785c0ff9ca091f7",
|
||||
"merkleroot": "0xed6cfc97da028f7506840136fb0d850a6864dcab578150fea50f5ff91d5befb5",
|
||||
"time": 1597103262815,
|
||||
"index": 35000,
|
||||
"nextconsensus": "NUQ6Q4BWvHU71HNxPQ4LMSHPMK1jSz1nw4",
|
||||
"witnesses": [
|
||||
"raw": "0000000017dee7ceb3018fc04cf1860667865da67f126320350da541301ddc2ce144ee518569bc5fe21c5dd18d696cf55146ba32e9637d5cc19d689f50edef2b9adea5fb798782687701000001010000e0a3c55cad72028fb5901748b19a27be21f6540401fd4a010c4004e28d6d2ac118f748cc33abd3b3e9202d24e444c317522c7e9671ab2549fad95fd29bf460f37a6e0bdcf89530b7d519c548fd76c91bae3ecb789e59c47d40890c40873957285b0ea260da2de2117f6a1445f5d486e69acbfba4ae88379389e84d6184a86bc299a9f2f76e2a4c876a46921f1dd2da57cf612fcafd931575718cd24e0c40dc2a6075b7e300e99f3f9aa8c8eaecd6dbffacef4fb80f616a983d63e9e23cc533903901bd95856f07ed37159dc4754b0b7cec0efaf45653705b659f38b255610c408826a929309d085d30f945995a407881c9480d2440ea7dddf19e442a3b7d66a0fa08bf94c7c6e6abe32998fad34599075d59a926a1dd8b63a73b2f87c11994c10c4007d1e52a7d6027f7339ca6d592c9ca9236fd45dd3cf65e1f3ff13dcdc9306f2458e165a162e05f5a8935b2086831aee8f2f1ce756863326141755d7acb69405ffdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf02052596e078047eabb50002e81753b49498000000000040218500000000008017000002f6ed986d8f6478b647ddae2083069ca4cfdb234000e0a3c55cad72028fb5901748b19a27be21f654040100580b00640c14f6ed986d8f6478b647ddae2083069ca4cfdb23400c14e0a3c55cad72028fb5901748b19a27be21f6540414c01f0c087472616e736665720c1483ab0679ad55c050a13ad43f5936ea73f5eb1ef641627d5b523902420c40c97b7ed4ae85087be530bf8b2527fee6ebe319a819a35877e632ae515cf713b4d7b8ed746d4869af06a49cfc3d291807e080391c93fd1300073eefd8b3943c84290c21025f73a4317c3559f9c3ac9eadff4f1d98d3a36fdd6bc6aeb672f026c082c3fcd70b4195440d78fd4a010c40db0e67f368f38bba3cefa6f9732e4b76e650852502414535933866cb2717018a46b7b45b48782db118826cf882010c908515902eeb4df9b3a97c8b3c4a06c85a0c40184633aca12b59cc483bdf5321280c9361d1c057a176688df10050a4fbec15c36034711a44bcc10c54be93de4184d4555d6db4b5f314255bb1c018057950d5410c405932b9e324bc9af44068a1ef8a4d67873c5db31a7bd4947b5a6a6c9ab56f7a723df3ee6d4fc8644a3d0814a635165cb583181c039cf75c2a557fef9c0feac6f30c4079d308c5df6650473abc196cccb25af9e2502b20107174b4b39b94b2e3b7b0dff98784e984cd8c2df4ea689fda0690bde7889dc3108c2595aa774600c6b6a1120c40162d4e8e29255314cbd7099af0169a9aede2e0ecdd1635f14ca1ae36158165a284357ab4236d324e92b531f2b9ace43ddc372924c9020a929d76600404c49599fdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf",
|
||||
"hash" : "0xad6ff40813e18d09bc08ec39e765a9eae40123878f5b6e9bc3bde2ff52e32877",
|
||||
"tx" : [
|
||||
{
|
||||
"invocation": "DED+zz/tVi4dOc+8GYtL1czfzqSLMAkX8/tFxvZwBL/Oj4FhmAGMzJOlldYsEDDrKd5WOAymfAh9rfT9c+fy7yuRDECbb2I6cg+r9sIdxuRfCkCKYbNmSoHAimREQLdgiE2yV4/ADgoWrAxby0QXE8DrVrhEjm/hHIdMx4NA/2I1Dlb1DECwadEbJAwZP7u7gRV3GCehM8pD4D2F7QzlGJPh6orZx3no9oPx9FX1dRjJeokv3614BjZKEan7NJtmipeGLFA+DEAn+8LspScdpokF3u4EzjzWdFDPUsgMD/6m0TxocI87o/9tQxK//00JbtVTM0LFz0CMQTDQW/0Eh9zLAlpLQ8D9DECLvVZyb7iOTPT43TOlf5q2KXyNhN4hClhaqst0zAB0ba9E6m5xPTPC6HNEuuwvPPcMclE9O9XHBxxcfUNMgowR",
|
||||
"verification": "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhA0CNzUFjlvZHg6xYfqHhWTxX2f6ogMimoZIOkqJZR3gGDCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsMIQK6LHD1mW81ekMZhwWFn64s/qE+EXKWKAB3Kz1Yip1KvQwhAviJ7NQ8USb/GTLXX6h96jT8lTJftyTbk8j3n+Msw/GAFwtBE43vrw=="
|
||||
"script" : "CwBkDBT27Zhtj2R4tkfdriCDBpykz9sjQAwU4KPFXK1yAo+1kBdIsZonviH2VAQUwB8MCHRyYW5zZmVyDBSDqwZ5rVXAUKE61D9ZNupz9ese9kFifVtSOQ==",
|
||||
"witnesses" : [
|
||||
{
|
||||
"invocation" : "DEDJe37UroUIe+Uwv4slJ/7m6+MZqBmjWHfmMq5RXPcTtNe47XRtSGmvBqSc/D0pGAfggDkck/0TAAc+79izlDyE",
|
||||
"verification" : "DCECX3OkMXw1WfnDrJ6t/08dmNOjb91rxq62cvAmwILD/NcLQZVEDXg="
|
||||
},
|
||||
{
|
||||
"verification" : "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw==",
|
||||
"invocation" : "DEDbDmfzaPOLujzvpvlzLkt25lCFJQJBRTWTOGbLJxcBika3tFtIeC2xGIJs+IIBDJCFFZAu6035s6l8izxKBshaDEAYRjOsoStZzEg731MhKAyTYdHAV6F2aI3xAFCk++wVw2A0cRpEvMEMVL6T3kGE1FVdbbS18xQlW7HAGAV5UNVBDEBZMrnjJLya9EBooe+KTWeHPF2zGnvUlHtaamyatW96cj3z7m1PyGRKPQgUpjUWXLWDGBwDnPdcKlV/75wP6sbzDEB50wjF32ZQRzq8GWzMslr54lArIBBxdLSzm5Sy47ew3/mHhOmEzYwt9Opon9oGkL3niJ3DEIwllap3RgDGtqESDEAWLU6OKSVTFMvXCZrwFpqa7eLg7N0WNfFMoa42FYFlooQ1erQjbTJOkrUx8rms5D3cNykkyQIKkp12YAQExJWZ"
|
||||
}
|
||||
],
|
||||
"version" : 0,
|
||||
"sender" : "NiRc3N9xfq64MuqJ9EDdKtz1jhSa5YPUF7",
|
||||
"hash" : "0x28ef8933bbd65cb0fb4063a33af66429f85f1a369bb84335505e84d23349a4e6",
|
||||
"signers" : [
|
||||
{
|
||||
"scopes" : "None",
|
||||
"account" : "0x4023dbcfa49c068320aedd47b678648f6d98edf6"
|
||||
},
|
||||
{
|
||||
"scopes" : "CalledByEntry",
|
||||
"account" : "0x0454f621be279ab1481790b58f0272ad5cc5a3e0"
|
||||
}
|
||||
],
|
||||
"sysfee" : "9999540",
|
||||
"size" : 857,
|
||||
"nonce" : 1394075650,
|
||||
"netfee" : "8724800",
|
||||
"validuntilblock" : 6016,
|
||||
"attributes" : []
|
||||
}
|
||||
],
|
||||
"consensusdata": {
|
||||
"primary": 0,
|
||||
"nonce": "7769b1044d89821a"
|
||||
"version" : 0,
|
||||
"confirmations" : 10893,
|
||||
"previousblockhash" : "0x51ee44e12cdc1d3041a50d352063127fa65d86670686f14cc08f01b3cee7de17",
|
||||
"index" : 257,
|
||||
"nextconsensus" : "NgPkjjLTNcQad99iRYeXRUuowE4gxLAnDL",
|
||||
"size" : 1557,
|
||||
"witnesses" : [
|
||||
{
|
||||
"verification" : "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw==",
|
||||
"invocation" : "DEAE4o1tKsEY90jMM6vTs+kgLSTkRMMXUix+lnGrJUn62V/Sm/Rg83puC9z4lTC31RnFSP12yRuuPst4nlnEfUCJDECHOVcoWw6iYNot4hF/ahRF9dSG5prL+6SuiDeTiehNYYSoa8KZqfL3bipMh2pGkh8d0tpXz2Evyv2TFXVxjNJODEDcKmB1t+MA6Z8/mqjI6uzW2/+s70+4D2FqmD1j6eI8xTOQOQG9lYVvB+03FZ3EdUsLfOwO+vRWU3BbZZ84slVhDECIJqkpMJ0IXTD5RZlaQHiByUgNJEDqfd3xnkQqO31moPoIv5THxuar4ymY+tNFmQddWakmod2LY6c7L4fBGZTBDEAH0eUqfWAn9zOcptWSycqSNv1F3Tz2Xh8/8T3NyTBvJFjhZaFi4F9aiTWyCGgxrujy8c51aGMyYUF1XXrLaUBf"
|
||||
}
|
||||
],
|
||||
"merkleroot" : "0xfba5de9a2befed509f689dc15c7d63e932ba4651f56c698dd15d1ce25fbc6985",
|
||||
"consensusdata" : {
|
||||
"primary" : 5,
|
||||
"nonce" : "b5ab7e0478e09625"
|
||||
},
|
||||
"tx": [],
|
||||
"confirmations": 32432,
|
||||
"nextblockhash": "0x03bac24218cbee1326d1d3bfd7e18c96dd1cfa7f45d66ddf67f2523fc273b2aa"
|
||||
"time" : 1612366120825,
|
||||
"nextblockhash" : "0xf885b36a9bd63bcdca73d2022c86ec9133288df8d29db0696de5fd6365006580"
|
||||
}
|
|
@ -9,8 +9,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// tx from testnet 58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce
|
||||
rawInvocationTX = "00be80024f7673890000000000261c130000000000e404210001f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e01005d0300743ba40b0000000c14aa07cc3f2193a973904a09a6e60b87f1f96273970c14f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e13c00c087472616e736665720c14bcaf41d684c7d4ad6ee0d99da9707b9d1f0c8e6641627d5b523801420c402360bbf64b9644c25f066dbd406454b07ab9f56e8e25d92d90c96c598f6c29d97eabdcf226f3575481662cfcdd064ee410978e5fae3f09a2f83129ba9cd82641290c2103caf763f91d3691cba5b5df3eb13e668fdace0295b37e2e259fd0fb152d354f900b4195440d78"
|
||||
// tx from testnet affad44bb6acacabc058db0bf1e12ab1239ae5e04007b4d4a2ea0cda868e284a
|
||||
rawInvocationTX = "004883fd4bb494980000000000983c8500000000007f17000002574d3c03df4a9b2772af08e4b296721009b7a6fd00e0a3c55cad72028fb5901748b19a27be21f6540401005f0b0300e40b54020000000c14f6ed986d8f6478b647ddae2083069ca4cfdb23400c14e0a3c55cad72028fb5901748b19a27be21f6540414c01f0c087472616e736665720c1428b3adab7269f9c2181db3cb741ebf551930e27041627d5b523902420c4001a8eb709edc764591af846e7bfba10a908577ad57365b590593a4f81ea5a86ac046b9e1ac69ed39ec30cb97c2c7ef538f00fc105027758454b2bede94cd3bef290c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0b4195440d78fd4a010c40e254613ac2b3bd756d907932b15278e62b094a3eab90eff5aa2c56b598161852775cbd76076ac01fe48afdf897077845c415b3ca7884668e94396719b6db66e30c40a7427e3cd5238e3a5d4ab3b4361a37872af3dd8be336b9f1f19f0bd4972edb879b781d0c45dc684da7b220b8d399bea1948c1fe924daa5edbb8df117894130530c4099a1516792326083e50d99d4a97425b31c429136949688081619084403e0065c6ba576a0a4589d9115e3cf71c843c52e476b62ff4349c73838b2c2cb39f6c43d0c409ec13c315e485503ce8d1c821b0ed41ce3f39e914352973ec8ee1fefd024e106e709610bf9d500f56ec0e72c09e427cd8fd0a68bd9ef3b21176e8afd80aaef710c4022d33dc3217be4bb22144d98552ef35f23b1f10367924b4c6bea71d6c280cf2a2fff15f3c9f235cd5620bf310709aa53d6403e6d2fe6d07f13d83803a2c13a7ffdfd00150c2103009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a20c21030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba0c210214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff010c21023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d0c2103408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a2594778060c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0c2102ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd170b41138defaf"
|
||||
)
|
||||
|
||||
func decodeTransaction(rawTX string, t *testing.T) *Transaction {
|
||||
|
|
|
@ -8,15 +8,13 @@ import (
|
|||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/internal/random"
|
||||
"github.com/nspcc-dev/neo-go/internal/testserdes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestWitnessEncodeDecode(t *testing.T) {
|
||||
|
@ -45,24 +43,30 @@ func TestWitnessEncodeDecode(t *testing.T) {
|
|||
func TestDecodeEncodeInvocationTX(t *testing.T) {
|
||||
tx := decodeTransaction(rawInvocationTX, t)
|
||||
|
||||
script := "AwB0O6QLAAAADBSqB8w/IZOpc5BKCabmC4fx+WJzlwwU+BPCzI4Yu+SzuH+O+RBbULuTkY4TwAwIdHJhbnNmZXIMFLyvQdaEx9StbuDZnalwe50fDI5mQWJ9W1I4"
|
||||
script := "CwMA5AtUAgAAAAwU9u2YbY9keLZH3a4ggwacpM/bI0AMFOCjxVytcgKPtZAXSLGaJ74h9lQEFMAfDAh0cmFuc2ZlcgwUKLOtq3Jp+cIYHbPLdB6/VRkw4nBBYn1bUjk="
|
||||
assert.Equal(t, script, base64.StdEncoding.EncodeToString(tx.Script))
|
||||
assert.Equal(t, uint32(1325564094), tx.Nonce)
|
||||
assert.Equal(t, int64(9007990), tx.SystemFee)
|
||||
assert.Equal(t, int64(1252390), tx.NetworkFee)
|
||||
assert.Equal(t, uint32(2163940), tx.ValidUntilBlock)
|
||||
assert.Equal(t, "58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce", tx.Hash().StringLE())
|
||||
assert.Equal(t, uint32(1274905416), tx.Nonce)
|
||||
assert.Equal(t, int64(9999540), tx.SystemFee)
|
||||
assert.Equal(t, int64(8731800), tx.NetworkFee)
|
||||
assert.Equal(t, uint32(6015), tx.ValidUntilBlock)
|
||||
assert.Equal(t, "affad44bb6acacabc058db0bf1e12ab1239ae5e04007b4d4a2ea0cda868e284a", tx.Hash().StringLE())
|
||||
|
||||
assert.Equal(t, 1, len(tx.Signers))
|
||||
assert.Equal(t, CalledByEntry, tx.Signers[0].Scopes)
|
||||
assert.Equal(t, "NiXgSLtGUjTRTgp4y9ax7vyJ9UZAjsRDVt", address.Uint160ToString(tx.Signers[0].Account))
|
||||
assert.Equal(t, 2, len(tx.Signers))
|
||||
assert.Equal(t, None, tx.Signers[0].Scopes)
|
||||
assert.Equal(t, "fda6b709107296b2e408af72279b4adf033c4d57", tx.Signers[0].Account.StringLE())
|
||||
assert.Equal(t, CalledByEntry, tx.Signers[1].Scopes)
|
||||
assert.Equal(t, "0454f621be279ab1481790b58f0272ad5cc5a3e0", tx.Signers[1].Account.StringLE())
|
||||
|
||||
assert.Equal(t, 0, len(tx.Attributes))
|
||||
invoc := "DEAjYLv2S5ZEwl8Gbb1AZFSwern1bo4l2S2QyWxZj2wp2X6r3PIm81dUgWYs/N0GTuQQl45frj8JovgxKbqc2CZB"
|
||||
verif := "DCEDyvdj+R02kcultd8+sT5mj9rOApWzfi4ln9D7FS01T5ALQZVEDXg="
|
||||
assert.Equal(t, 1, len(tx.Scripts))
|
||||
assert.Equal(t, invoc, base64.StdEncoding.EncodeToString(tx.Scripts[0].InvocationScript))
|
||||
assert.Equal(t, verif, base64.StdEncoding.EncodeToString(tx.Scripts[0].VerificationScript))
|
||||
invoc1 := "DEABqOtwntx2RZGvhG57+6EKkIV3rVc2W1kFk6T4HqWoasBGueGsae057DDLl8LH71OPAPwQUCd1hFSyvt6UzTvv"
|
||||
verif1 := "DCECp4NL6bMuKYHRV8tbvTrLQs/RHqXDsQIk16ROmMWRDxsLQZVEDXg="
|
||||
invoc2 := "DEDiVGE6wrO9dW2QeTKxUnjmKwlKPquQ7/WqLFa1mBYYUndcvXYHasAf5Ir9+JcHeEXEFbPKeIRmjpQ5Zxm222bjDECnQn481SOOOl1Ks7Q2GjeHKvPdi+M2ufHxnwvUly7bh5t4HQxF3GhNp7IguNOZvqGUjB/pJNql7buN8ReJQTBTDECZoVFnkjJgg+UNmdSpdCWzHEKRNpSWiAgWGQhEA+AGXGuldqCkWJ2RFePPcchDxS5Ha2L/Q0nHODiywss59sQ9DECewTwxXkhVA86NHIIbDtQc4/OekUNSlz7I7h/v0CThBucJYQv51QD1bsDnLAnkJ82P0KaL2e87IRduiv2Aqu9xDEAi0z3DIXvkuyIUTZhVLvNfI7HxA2eSS0xr6nHWwoDPKi//FfPJ8jXNViC/MQcJqlPWQD5tL+bQfxPYOAOiwTp/"
|
||||
verif2 := "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9FwtBE43vrw=="
|
||||
assert.Equal(t, 2, len(tx.Scripts))
|
||||
assert.Equal(t, invoc1, base64.StdEncoding.EncodeToString(tx.Scripts[0].InvocationScript))
|
||||
assert.Equal(t, verif1, base64.StdEncoding.EncodeToString(tx.Scripts[0].VerificationScript))
|
||||
assert.Equal(t, invoc2, base64.StdEncoding.EncodeToString(tx.Scripts[1].InvocationScript))
|
||||
assert.Equal(t, verif2, base64.StdEncoding.EncodeToString(tx.Scripts[1].VerificationScript))
|
||||
|
||||
data, err := testserdes.EncodeBinary(tx)
|
||||
assert.NoError(t, err)
|
||||
|
|
Loading…
Reference in a new issue