\r
describe('block signing tests using official test vectors', async () => {\r
it('should create a valid signature for a receive block', async () => {\r
- const work = 'c5cf86de24b24419'\r
const block = new ReceiveBlock(\r
- 'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',\r
- '18618869000000000000000000000000',\r
- 'CBC911F57B6827649423C92C88C0C56637A4274FF019E77E24D61D12B5338783',\r
- '7000000000000000000000000000000',\r
- 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
- '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
- work\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.account,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.balance,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.link,\r
+ '0',\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.representative,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.previous,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.work\r
)\r
- await block.sign('781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3')\r
- assert.equal(block.signature, 'F25D751AD0379A5718E08F3773DA6061A9E18842EF5615163C7F207B804CC2C5DD2720CFCE5FE6A78E4CC108DD9CAB65051526403FA2C24A1ED943BB4EA7880B')\r
- assert.equal(block.work, work)\r
+ await block.sign(NANO_TEST_VECTORS.RECEIVE_BLOCK.key)\r
+ assert.equal(block.signature, NANO_TEST_VECTORS.RECEIVE_BLOCK.signature)\r
})\r
\r
it('should create a valid signature for a receive block without work', async () => {\r
const block = new ReceiveBlock(\r
- 'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',\r
- '18618869000000000000000000000000',\r
- 'CBC911F57B6827649423C92C88C0C56637A4274FF019E77E24D61D12B5338783',\r
- '7000000000000000000000000000000',\r
- 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
- '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.account,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.balance,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.link,\r
+ '0',\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.representative,\r
+ NANO_TEST_VECTORS.RECEIVE_BLOCK.previous\r
)\r
- await block.sign('781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3')\r
- assert.equal(block.signature, 'F25D751AD0379A5718E08F3773DA6061A9E18842EF5615163C7F207B804CC2C5DD2720CFCE5FE6A78E4CC108DD9CAB65051526403FA2C24A1ED943BB4EA7880B')\r
+ await block.sign(NANO_TEST_VECTORS.RECEIVE_BLOCK.key)\r
+ assert.equal(block.signature, NANO_TEST_VECTORS.RECEIVE_BLOCK.signature)\r
assert.equal(block.work, '')\r
})\r
\r
it('should create a valid signature for a send block', async () => {\r
- const work = 'fbffed7c73b61367'\r
const block = new SendBlock(\r
- 'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',\r
- '5618869000000000000000000000000',\r
- 'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p',\r
- '2000000000000000000000000000000',\r
- 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
- '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
- work,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.account,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.balance,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.link,\r
+ '0',\r
+ NANO_TEST_VECTORS.SEND_BLOCK.representative,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.previous,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.work\r
)\r
- await block.sign('781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3')\r
- assert.equal(block.signature.toUpperCase(), '79240D56231EF1885F354473733AF158DC6DA50E53836179565A20C0BE89D473ED3FF8CD11545FF0ED162A0B2C4626FD6BF84518568F8BB965A4884C7C32C205')\r
- assert.equal(block.work, work)\r
+ await block.sign(NANO_TEST_VECTORS.SEND_BLOCK.key)\r
+ assert.equal(block.signature, NANO_TEST_VECTORS.SEND_BLOCK.signature)\r
})\r
\r
it('should create a valid signature for a send block without work', async () => {\r
const block = new SendBlock(\r
- 'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',\r
- '5618869000000000000000000000000',\r
- 'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p',\r
- '2000000000000000000000000000000',\r
- 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
- '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
+ NANO_TEST_VECTORS.SEND_BLOCK.account,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.balance,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.link,\r
+ '0',\r
+ NANO_TEST_VECTORS.SEND_BLOCK.representative,\r
+ NANO_TEST_VECTORS.SEND_BLOCK.previous\r
)\r
- await block.sign('781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3')\r
- assert.equal(block.signature.toUpperCase(), '79240D56231EF1885F354473733AF158DC6DA50E53836179565A20C0BE89D473ED3FF8CD11545FF0ED162A0B2C4626FD6BF84518568F8BB965A4884C7C32C205')\r
+ await block.sign(NANO_TEST_VECTORS.SEND_BLOCK.key)\r
+ assert.equal(block.signature, NANO_TEST_VECTORS.SEND_BLOCK.signature)\r
assert.equal(block.work, '')\r
})\r
\r