Как я могу просмотреть необработанные данные блока Ethereum? - PullRequest
0 голосов
/ 05 января 2020

я пытаюсь просмотреть необработанные данные побайтно в блоке в блокчейне ethereum. я хочу увидеть, как он фактически добавляется в цепочку.

шкаф, который я нашел, это web3.eth.getBlock (1212121, true) с ethconsole. результат содержит некоторые элементы, которые я не уверен, находятся ли они в блоке, такие как «size» или «totalDifficulty». этот результат команды:

> web3.eth.getBlock(1212121,true)
{ difficulty: '20632001790827',
  extraData: '0xd783010305844765746887676f312e352e31856c696e7578',
  gasLimit: 4712388,
  gasUsed: 409654,
  hash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
  logsBloom: '0x40000000000000000002000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000008000000000000000800000108000100000000000000401000020000000000000000800a02000000000000000000000090000000000000000000000020100000000000000000000000000000000002800000000000000000000000000000020000000000000000000000000408000000000000010000000002000000000000000000000000000000000000000000000000008020000000000400000000000000000000000000400000000000000000000001000000',
  miner: '0x2a65Aca4D5fC5B5C859090a6c34d164135398226',
  mixHash: '0xe9c763a3b4c2fd3c25ce2909b2b4be610d34ed4c6bfb25ae30929cf9b4fbf37f',
  nonce: '0xa62df06cbd58960e',
  number: 1212121,
  parentHash: '0x33dc0cd459f5c9befc3866727494b1d4c7af1aefc7361b9343aecc7e4ef75c49',
  receiptsRoot: '0xcd45d340d3e4f8cb92724b434f9e74d5972fca7240fffa3e6d2d4a1a9b84874c',
  sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  size: 2866,
  stateRoot: '0xc929d0dbf6abaf1178dd24434ca66c95847540eb49a4c86689f64b63513e1ecd',
  timestamp: 1458873705,
  totalDifficulty: '10587466690743571712',
  transactions: 
   [ { blockHash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
       blockNumber: 1212121,
       from: '0x90384D665f5687be20FA3EfC029939d249f0570c',
       gas: 250000,
       gasPrice: '20000000000',
       hash: '0x79d6d88c9662437dac7064549fbf77d35d1da1c2246b5ec729686f3f56add401',
       input: '0x3ed486790000000000000000000000002e6480c43704100a7f60f6006d94aff5a5801f490000000000000000000000000000000000000000000000000000000056f4a56100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000835958229c6adfd769fc836ceaedd41e15d6290300000000000000000000000000000000000000000000000000000000021fd2c00000000000000000000000000000000000000000000000000000000000000002affb2869dcbe152a484a945026a2de025419971f335d636db4aa9b2070c47d5d0474f35ba4a3bbf111b7cbe746094fb248ef80cbb1790b302fcf972d8bb1a8bb0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001c',
       nonce: 2914,
       to: '0xaD62F56a03334B647E55dbdB5B8642C24605a801',
       transactionIndex: 0,
       value: '1',
       v: '0x1b',
       r: '0x8ca42b848ed12cc18f20c152ecf597f62576c600d663a09dd69c0ee8d50829fd',
       s: '0x1f8ee0543d8b7b2a5484dfb0b0d5f8c8e676b2a49cf3a1e53b2d85a3c64c1af3' },
     { blockHash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
       blockNumber: 1212121,
       from: '0x90384D665f5687be20FA3EfC029939d249f0570c',
       gas: 250000,
       gasPrice: '20000000000',
       hash: '0x52e6fb23ebd870deace5a8ded5809a8184bc277a07874f821642d38639da1a66',
       input: '0x3ed486790000000000000000000000002e6480c43704100a7f60f6006d94aff5a5801f490000000000000000000000000000000000000000000000000000000056f4a56200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000835958229c6adfd769fc836ceaedd41e15d62903000000000000000000000000000000000000000000000000000000000069be50000000000000000000000000000000000000000000000000000000000000000208a26863e7ed834c95d44ae453428ae5dab27344c93ebf81ac7e8db961f83ad12191c6e6d73b2f1036e62310f65f0d7d54fc887b24432d95f9a051d3bb95c3660000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001b',
       nonce: 2915,
       to: '0xaD62F56a03334B647E55dbdB5B8642C24605a801',
       transactionIndex: 1,
       value: '1',
       v: '0x1c',
       r: '0xa55b8f2203be4d79653a50ca729b126499ef67c20ee3e1fbbd82507f3527f83a',
       s: '0xd853f6e2d4914cee9cbea8d4eb5d874a2a7e6b7a7223b451c504a2a30f75ad3' },
     { blockHash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
       blockNumber: 1212121,
       from: '0x90384D665f5687be20FA3EfC029939d249f0570c',
       gas: 250000,
       gasPrice: '20000000000',
       hash: '0x4b64e1af8df53d6479dcd9c7ef36a8128cbdd85be07fbe0848bb5c8f18f88868',
       input: '0x3ed486790000000000000000000000002e6480c43704100a7f60f6006d94aff5a5801f490000000000000000000000000000000000000000000000000000000056f4a56300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000060be9422457ce5d68701ac893d9ec9db639792f200000000000000000000000000000000000000000000000000000000046cf7100000000000000000000000000000000000000000000000000000000000000002758066c4fcb14ad292b3d714e0c791c510fb16e5a5d97d469f4dca7a718c7de31c4979e591ddaf14861bf66380fc799d4b2f2ea7615bd8a34d8eecead15aa77e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001c',
       nonce: 2916,
       to: '0xaD62F56a03334B647E55dbdB5B8642C24605a801',
       transactionIndex: 2,
       value: '1',
       v: '0x1c',
       r: '0x8b41131ed19fc8fa5888c59a5f15084b3a9f5963d6d62b69ebed8791cca2a3fe',
       s: '0x251070a69ad098def1049fd69818d337239ddd705379b2b7b8ddc94fed4225bc' },
     { blockHash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
       blockNumber: 1212121,
       from: '0x90384D665f5687be20FA3EfC029939d249f0570c',
       gas: 250000,
       gasPrice: '20000000000',
       hash: '0x86ee9f55ec67268a5507a64c9591299c5b5b173e408728e45d8da851703f8b5d',
       input: '0x3ed486790000000000000000000000002e6480c43704100a7f60f6006d94aff5a5801f490000000000000000000000000000000000000000000000000000000056f4a56500000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008782b18597724d71d337e408e25c1a00c49a2a1b00000000000000000000000000000000000000000000000000000000132d83f00000000000000000000000000000000000000000000000000000000000000002f7949f93b8fb7983f4c786292c1210d4aef088fe5ddc59a11d6a12795450b2747dbd6dedbee599369e64ec95d364b0c7f80ed75816078d02f0dbab40fa3b944c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001c',
       nonce: 2917,
       to: '0xaD62F56a03334B647E55dbdB5B8642C24605a801',
       transactionIndex: 3,
       value: '1',
       v: '0x1c',
       r: '0xf055c79b4bed2d9ea6518fba84e55efeb43b93f142fa639c753872acbd3c29fb',
       s: '0x2e97c34681b2d7389a53d8c605be91ee1d0904e1582e4f58abec82abbc97a088' },
     { blockHash: '0xe58280354d08c9fef9c4cfeff54e3c9257db6508c5594a14fcaab55c33aff7ae',
       blockNumber: 1212121,
       from: '0x90384D665f5687be20FA3EfC029939d249f0570c',
       gas: 250000,
       gasPrice: '20000000000',
       hash: '0xbf4b4bbaeae0fffecf4a693e2f4b7d13790c4d120709e21a3b5d19b7f7be2e51',
       input: '0x3ed486790000000000000000000000002e6480c43704100a7f60f6006d94aff5a5801f490000000000000000000000000000000000000000000000000000000056f4a56600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000006f180ebbe72e7033b47d6937c11a64947b2e06ec0000000000000000000000000000000000000000000000000000000000e297d00000000000000000000000000000000000000000000000000000000000000002f3d50c6e9894955652f3a21d3cc531636fd7ad574fc9152298c91af3fefdbb5833691995bb8c2b5de36ac6df4b37e578c5847a176e5e81c6ec65f5da8091d28d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001b',
       nonce: 2918,
       to: '0xaD62F56a03334B647E55dbdB5B8642C24605a801',
       transactionIndex: 4,
       value: '1',
       v: '0x1b',
       r: '0x14c49a89bfd848640c8a942158322f402a2d7839e55e9bf1a71c99c11735d5a9',
       s: '0x31dbb910f8d18c8ba3ab59c4f28d8ca096a25d71ca1ec2f0c1228259b6cce10' } ],
  transactionsRoot: '0x9a66f376a40ecc62c3ea600bf2371f1929d5cc7d66fbf48e8ac9a64d61fbc295',
  uncles: [] }


1 Ответ

0 голосов
/ 08 января 2020

См. Ответ от @ WesternZealot в reddit :

https://ethereum.github.io/yellowpaper/paper.pdf

См. Раздел 4.3 до конца 4.3.3. Это даст вам понимание того, как данные сериализуются в блоке.

Затем, чтобы проверить фактический блок, вы должны запустить клиент Ethereum (такой как Geth) в режиме полного узла, пока не будет хотя бы одного Блок был загружен, затем найдите, где находится блок на вашем компьютере и проверьте его содержимое.

...