Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Block related eth namespace APIs #1121

Merged
merged 4 commits into from
Feb 9, 2022

Conversation

aeharvlee
Copy link
Contributor

@aeharvlee aeharvlee commented Jan 21, 2022

Proposed changes

Implemented eth namespace Block related apis

Api Ethereum Source Code
eth_getBlockByNumber GetBlockByNumber
eth_getBlockByHash GetBlockByHash

Related Confluence: Klaytn, Ethereum data structures comparison

How to test this PR

First, please clone my origin repo.

1. Run added tests in this PR.

  • Run go test -run "TestEthereumAPI_GetBlock*" -v ./... -count=1

2. Build ken and test with it.

1. Build ken with source codes related with this PR.

  • Run make ken

2. Run ken

  • In my case, I tested with CN 1 - PN 1 - EN 1 in my local.
  • Please note that you should enable eth namepsace to RPC_API and WS_API in kend.conf

Test Logs

When using number or hash with fullTxs option as false

KEN
> eth.getBlockByNumber(335373, false)
{
  baseFeePerGas: "0x0",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0x3b9ac9ff",
  gasUsed: "0x33450",
  hash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x9712f943b296758aaae79944ec975884188d3a96",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: "0x51e0d",
  parentHash: "0xcf5a2af5c9bcadf7ea44627150f49d1516ef1477a7de3ba5e7c5a62a0299429f",
  receiptsRoot: "0x5796d51faa6ac84ac7f4eec93c0428a38cd42fccf408e2f68f5a6d90b376d20e",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x796",
  stateRoot: "0x45b7c3f5b4693af35d059652f83ebb1a1df063c9449eba995ae63acb8fcb8eb6",
  timestamp: "0x61ea5082",
  totalDifficulty: "0x51e0e",
  transactions: ["0x0e866cc55778fb0dc258d939b633f38eafd1f41b96859e1d1f81d81a507f40f5", "0x7a402842c230b911bc2994da18d941dc99bee1dce91ec983c7616a27724382e3"],
  transactionsRoot: "0x8de347b975aadca95c543d052f8a1dfc289fe32086972a3fb3cf86abe14ef97e",
  uncles: []
}
> eth.getBlockByHash('0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6')
{
  baseFeePerGas: "0x0",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0x3b9ac9ff",
  gasUsed: "0x33450",
  hash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x9712f943b296758aaae79944ec975884188d3a96",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: "0x51e0d",
  parentHash: "0xcf5a2af5c9bcadf7ea44627150f49d1516ef1477a7de3ba5e7c5a62a0299429f",
  receiptsRoot: "0x5796d51faa6ac84ac7f4eec93c0428a38cd42fccf408e2f68f5a6d90b376d20e",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x796",
  stateRoot: "0x45b7c3f5b4693af35d059652f83ebb1a1df063c9449eba995ae63acb8fcb8eb6",
  timestamp: "0x61ea5082",
  totalDifficulty: "0x51e0e",
  transactions: ["0x0e866cc55778fb0dc258d939b633f38eafd1f41b96859e1d1f81d81a507f40f5", "0x7a402842c230b911bc2994da18d941dc99bee1dce91ec983c7616a27724382e3"],
  transactionsRoot: "0x8de347b975aadca95c543d052f8a1dfc289fe32086972a3fb3cf86abe14ef97e",
  uncles: []
}
Geth
> eth.getBlockByNumber("0xd0054e", false)
{
  baseFeePerGas: "0x1cc10d0cce",
  difficulty: "0x26bd640f42997a",
  extraData: "0x486976656f6e2065752d68656176792d32",
  gasLimit: "0x1c85c21",
  gasUsed: "0x44437",
  hash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
  logsBloom: "0x0000100000000094000000400000080000000040000000000000000000000002000000000000000000000000004001000000200000000000000008000220000000080400000800000000000a000000000000000000000000000010000000000000002000000408000000000000000010000080101002000000000010000000100000010000200800000400000080000000000000000000000002000000102000024000080200000000000082000000000000000000000000010000000000000000100012000000000000011000000000002000201000000008000000002000000010002800000000001400000000000000000000000100000000200000000000",
  miner: "0x1ad91ee08f21be3de0ba2ba6918e714da6b45836",
  mixHash: "0x57659bc7114af80d87a81a74d88a4ebbddb1ac2fc5d33b893740cd720efcfed1",
  nonce: "0xb25436b782aab31a",
  number: "0xd0054e",
  parentHash: "0x2b88fdb3821669357a0b8367115e30145135c44bb8f62641d4e7765a7f555d17",
  receiptsRoot: "0xc36bc44d0b52dee954be9bbd519bddc0bf6e991af2ed6f6ba506f89f10cdb9a7",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x64c",
  stateRoot: "0x123a0da1c621236e64f9b486a9a9712ec6ce07d6690acab5a18b716d17cdc29f",
  timestamp: "0x6194f184",
  totalDifficulty: "0x754d52d07a525aacfb2",
  transactions: ["0x5b3492f8199ee2a551d991b7d00bd48967ca5e5c1c15d6e1ee9fda97e3126e9a", "0x8e1870262f2ba0452458280ad6ad5d54e5288623e415692c822979b7608c7297", "0x98053d20b01c9e56964a57084fb91ccc01b242adfb09c23534162dcbbcc094c2", "0x64c5ba9837b1c05bb292c7816fc47319d324aeb9aea4be10e034c61f6efd8aa4", "0x69aba6a547b0da9c7132157191f94428cd89ad2b50ab6bceea5a8ec04bf166fa", "0x2ecf1df1e4c8246549359319831bb0583f4b983596474ea31b610f5209d27b66"],
  transactionsRoot: "0x29b9880f57c0e79d0be5aa4fcc6b4cfcbed3e51478ad8f44533acce012df8cf1",
  uncles: []
}
> eth.getBlockByHash("0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5", false)
{
  baseFeePerGas: "0x1cc10d0cce",
  difficulty: "0x26bd640f42997a",
  extraData: "0x486976656f6e2065752d68656176792d32",
  gasLimit: "0x1c85c21"
0000000000000008000220000000080400000800000000000a000000000000000000000000000010000000000000002000000408000000000000000010000080101002000000000010000000100000010000200800000400000080000000000000000000000002000000102000024000080200000000000082000000000000000000000000010000000000000000100012000000000000011000000000002000201000000008000000002000000010002800000000001400000000000000000000000100000000200000000000",
  miner: "0x1ad91ee08f21be3de0ba2ba6918e714da6b45836",
  mixHash: "0x57659bc7114af80d87a81a74d88a4ebbddb1ac2fc5d33b893740cd720efcfed1",
  nonce: "0xb25436b782aab31a",
  number: "0xd0054e",
  parentHash: "0x2b88fdb3821669357a0b8367115e30145135c44bb8f62641d4e7765a7f555d17",
  receiptsRoot: "0xc36bc44d0b52dee954be9bbd519bddc0bf6e991af2ed6f6ba506f89f10cdb9a7",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x64c",
  stateRoot: "0x123a0da1c621236e64f9b486a9a9712ec6ce07d6690acab5a18b716d17cdc29f",
  timestamp: "0x6194f184",
  totalDifficulty: "0x754d52d07a525aacfb2",
  transactions: ["0x5b3492f8199ee2a551d991b7d00bd48967ca5e5c1c15d6e1ee9fda97e3126e9a", "0x8e1870262f2ba0452458280ad6ad5d54e5288623e415692c822979b7608c7297", "0x98053d20b01c9e56964a57084fb91ccc01b242adfb09c23534162dcbbcc094c2", "0x64c5ba9837b1c05bb292c7816fc47319d324aeb9aea4be10e034c61f6efd8aa4", "0x69aba6a547b0da9c7132157191f94428cd89ad2b50ab6bceea5a8ec04bf166fa", "0x2ecf1df1e4c8246549359319831bb0583f4b983596474ea31b610f5209d27b66"],
  transactionsRoot: "0x29b9880f57c0e79d0be5aa4fcc6b4cfcbed3e51478ad8f44533acce012df8cf1",
  uncles: []
}

When using number or hash with fullTxs option as true

KEN
> eth.getBlockByNumber(335373, true)
{
  baseFeePerGas: "0x0",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0x3b9ac9ff",
  gasUsed: "0x33450",
  hash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x9712f943b296758aaae79944ec975884188d3a96",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: "0x51e0d",
  parentHash: "0xcf5a2af5c9bcadf7ea44627150f49d1516ef1477a7de3ba5e7c5a62a0299429f",
  receiptsRoot: "0x5796d51faa6ac84ac7f4eec93c0428a38cd42fccf408e2f68f5a6d90b376d20e",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x796",
  stateRoot: "0x45b7c3f5b4693af35d059652f83ebb1a1df063c9449eba995ae63acb8fcb8eb6",
  timestamp: "0x61ea5082",
  totalDifficulty: "0x51e0e",
  transactions: [{
      blockHash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
      blockNumber: "0x51e0d",
      from: "0x3e2ac308cd78ac2fe162f9522deb2b56d9da9499",
      gas: "0x99999",
      gasPrice: "0x5d21dba00",
      hash: "0x0e866cc55778fb0dc258d939b633f38eafd1f41b96859e1d1f81d81a507f40f5",
      input: "0x",
      nonce: "0x0",
      r: "0xa3b0af9924d7c52a13e1b2619c7d90283a41d02af84035c67de1942e698cfde8",
      s: "0x3e077ee1529caa10e8b0d4fabf7cf4dd41745820312fb6d3516701a2c27a1f85",
      to: "0x8944d588cf8a4d255e2510f1c05b1eb4557bdaba",
      transactionIndex: "0x0",
      type: "0x0",
      v: "0x1cb4c6",
      value: "0x1"
  }, {
      blockHash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
      blockNumber: "0x51e0d",
      from: "0x3e2ac308cd78ac2fe162f9522deb2b56d9da9499",
      gas: "0x99999",
      gasPrice: "0x5d21dba00",
      hash: "0x7a402842c230b911bc2994da18d941dc99bee1dce91ec983c7616a27724382e3",
      input: "0x",
      nonce: "0x1",
      r: "0x6f7c0cb06765938add10ea17dcbcf6e7b78f3402fc45c9b61b05d8dcc444c1cc",
      s: "0x6c3bf618465410b4b2c0d8865ea019d25908ee82f1a790af0971b52b9360c40",
      to: "0x8944d588cf8a4d255e2510f1c05b1eb4557bdaba",
      transactionIndex: "0x1",
      type: "0x0",
      v: "0x1cb4c5",
      value: "0x1"
  }],
  transactionsRoot: "0x8de347b975aadca95c543d052f8a1dfc289fe32086972a3fb3cf86abe14ef97e",
  uncles: []
}
> eth.getBlockByHash('0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6', true)
{
  baseFeePerGas: "0x0",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0x3b9ac9ff",
  gasUsed: "0x33450",
  hash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x9712f943b296758aaae79944ec975884188d3a96",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: "0x51e0d",
  parentHash: "0xcf5a2af5c9bcadf7ea44627150f49d1516ef1477a7de3ba5e7c5a62a0299429f",
  receiptsRoot: "0x5796d51faa6ac84ac7f4eec93c0428a38cd42fccf408e2f68f5a6d90b376d20e",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x796",
  stateRoot: "0x45b7c3f5b4693af35d059652f83ebb1a1df063c9449eba995ae63acb8fcb8eb6",
  timestamp: "0x61ea5082",
  totalDifficulty: "0x51e0e",
  transactions: [{
      blockHash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
      blockNumber: "0x51e0d",
      from: "0x3e2ac308cd78ac2fe162f9522deb2b56d9da9499",
      gas: "0x99999",
      gasPrice: "0x5d21dba00",
      hash: "0x0e866cc55778fb0dc258d939b633f38eafd1f41b96859e1d1f81d81a507f40f5",
      input: "0x",
      nonce: "0x0",
      r: "0xa3b0af9924d7c52a13e1b2619c7d90283a41d02af84035c67de1942e698cfde8",
      s: "0x3e077ee1529caa10e8b0d4fabf7cf4dd41745820312fb6d3516701a2c27a1f85",
      to: "0x8944d588cf8a4d255e2510f1c05b1eb4557bdaba",
      transactionIndex: "0x0",
      type: "0x0",
      v: "0x1cb4c6",
      value: "0x1"
  }, {
      blockHash: "0x6982bd11dc673ca87c54a2734b233fcd94e4c984b521862f4f3cf057db8f63e6",
      blockNumber: "0x51e0d",
      from: "0x3e2ac308cd78ac2fe162f9522deb2b56d9da9499",
      gas: "0x99999",
      gasPrice: "0x5d21dba00",
      hash: "0x7a402842c230b911bc2994da18d941dc99bee1dce91ec983c7616a27724382e3",
      input: "0x",
      nonce: "0x1",
      r: "0x6f7c0cb06765938add10ea17dcbcf6e7b78f3402fc45c9b61b05d8dcc444c1cc",
      s: "0x6c3bf618465410b4b2c0d8865ea019d25908ee82f1a790af0971b52b9360c40",
      to: "0x8944d588cf8a4d255e2510f1c05b1eb4557bdaba",
      transactionIndex: "0x1",
      type: "0x0",
      v: "0x1cb4c5",
      value: "0x1"
  }],
  transactionsRoot: "0x8de347b975aadca95c543d052f8a1dfc289fe32086972a3fb3cf86abe14ef97e",
  uncles: []
}
Geth
> eth.getBlockByNumber("0xd0054e", true)
{
  baseFeePerGas: "0x1cc10d0cce",
  difficulty: "0x26bd640f42997a",
  extraData: "0x486976656f6e2065752d68656176792d32",
  gasLimit: "0x1c85c21",
  gasUsed: "0x44437",
  hash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
  logsBloom: "0x0000100000000094000000400000080000000040000000000000000000000002000000000000000000000000004001000000200000000000000008000220000000080400000800000000000a000000000000000000000000000010000000000000002000000408000000000000000010000080101002000000000010000000100000010000200800000400000080000000000000000000000002000000102000024000080200000000000082000000000000000000000000010000000000000000100012000000000000011000000000002000201000000008000000002000000010002800000000001400000000000000000000000100000000200000000000",
  miner: "0x1ad91ee08f21be3de0ba2ba6918e714da6b45836",
  mixHash: "0x57659bc7114af80d87a81a74d88a4ebbddb1ac2fc5d33b893740cd720efcfed1",
  nonce: "0xb25436b782aab31a",
  number: "0xd0054e",
  parentHash: "0x2b88fdb3821669357a0b8367115e30145135c44bb8f62641d4e7765a7f555d17",
  receiptsRoot: "0xc36bc44d0b52dee954be9bbd519bddc0bf6e991af2ed6f6ba506f89f10cdb9a7",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x64c",
  stateRoot: "0x123a0da1c621236e64f9b486a9a9712ec6ce07d6690acab5a18b716d17cdc29f",
  timestamp: "0x6194f184",
  totalDifficulty: "0x754d52d07a525aacfb2",
  transactions: [{
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xc5ff53779d377d4468b7b268bd6ad70a82ef8cc3",
      gas: "0x12f58",
      gasPrice: "0x1d1a753bce",
      hash: "0x5b3492f8199ee2a551d991b7d00bd48967ca5e5c1c15d6e1ee9fda97e3126e9a",
      input: "0xa9059cbb00000000000000000000000002a33965382f6471f91e54e0eb594cbdec0e012a000000000000000000000000000000000000000010c8d257e522581adacfedfb",
      maxFeePerGas: "0x1eb6534788",
      maxPriorityFeePerGas: "0x59682f00",
      nonce: "0x1276",
      r: "0x56d369f1dc0d45bd7e0d171b2ec10a4fa9185db77298ebc7476c5dbf7319f241",
      s: "0x6801be8f200e4ff9153c7385e0a24b23dc285d6402f88a688d2c7edf8ee3218",
      to: "0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
      transactionIndex: "0x0",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  }, {
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      from: "0x4ad64983349c49defe8d7a4686202d24b25d0ce8",
      gas: "0x15f90",
      gasPrice: "0x255248758d",
      hash: "0x8e1870262f2ba0452458280ad6ad5d54e5288623e415692c822979b7608c7297",
      input: "0x",
      nonce: "0x8c892",
      r: "0x5a134f29e8ed28d540800fe70a52763f155ce67bdbb0de2740ea332b03dcdb07",
      s: "0x459e3a9cb2df201c7528e045a8a51192c5e21bc740e0541e3e3afbee85e10fbb",
      to: "0x41422219461377e5f62f35e195833aa3f142a7f5",
      transactionIndex: "0x1",
      type: "0x0",
      v: "0x25",
      value: "0x812aab5df843000"
  }, {
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      from: "0x9afa066884ce723200438b672c0b8d5769e03a6a",
      gas: "0x30d40",
      gasPrice: "0x1fd9ea5800",
      hash: "0x98053d20b01c9e56964a57084fb91ccc01b242adfb09c23534162dcbbcc094c2",
      input: "0xa9059cbb0000000000000000000000003ba76ed939e89b7d4518914fe6166a03b7363a820000000000000000000000000000000000000000000000058e884a6f25ab9000",
      nonce: "0x2e1fd",
      r: "0xc991781f49a9463107c50beb93b3c355c435aaa1ed340c2458ee4bfa34f292e5",
      s: "0x629b5f5eab0bb305e1106fe7ccb6f5fe98bdbe496fbe537654314a4383f90cca",
      to: "0xd26114cd6ee289accf82350c8d8487fedb8a0c07",
      transactionIndex: "0x2",
      type: "0x0",
      v: "0x25",
      value: "0x0"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0x3cd751e6b0078be393132286c442345e5dc49699",
      gas: "0x3d090",
      gasPrice: "0x1e26adc8ce",
      hash: "0x64c5ba9837b1c05bb292c7816fc47319d324aeb9aea4be10e034c61f6efd8aa4",
      input: "0xa9059cbb000000000000000000000000a68b3d93eb82b2e19e8b12720b355419e67dbddb000000000000000000000000000000000000000000000000000000000b532b80",
      maxFeePerGas: "0x39bdf3b000",
      maxPriorityFeePerGas: "0x165a0bc00",
      nonce: "0x410e76",
      r: "0xd0e9dcf67160c8e46fce89123b82167ee422bdbaa5648be3dd554ee61cc9712a",
      s: "0x60fda234342aa6925261380ed69e3f12d19397fd8be4eaf3ee2cd04838966964",
      to: "0xdac17f958d2ee523a2206206994597c13d831ec7",
      transactionIndex: "0x3",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xddfabcdc4d8ffc6d5beaf154f18b778f892a0740",
      gas: "0x15f90",
      gasPrice: "0x1e26adc8ce",
      hash: "0x69aba6a547b0da9c7132157191f94428cd89ad2b50ab6bceea5a8ec04bf166fa",
      input: "0x",
      maxFeePerGas: "0x39bdf3b000",
      maxPriorityFeePerGas: "0x165a0bc00",
      nonce: "0x30ba19",
      r: "0x79ef08397b8ece499077b39b8536f9dc2ed2a99ee6286a199ec3743f45a7f36e",
      s: "0x116931abbb36c55e7e3b3c18257e3c054b56585ed7b28f926ad05acaedff9c82",
      to: "0x8c003a63b549b2fa003fa73aacaa79b205605501",
      transactionIndex: "0x4",
      type: "0x2",
      v: "0x1",
      value: "0x454d55e1c5e6fc00"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xfabc6fc448f53879557192c2d7679e42c09e7022",
      gas: "0x190bb",
      gasPrice: "0x1d3af2e399",
      hash: "0x2ecf1df1e4c8246549359319831bb0583f4b983596474ea31b610f5209d27b66",
      input: "0xe3dec8fb000000000000000000000000fabc6fc448f53879557192c2d7679e42c09e702200000000000000000000000028cca76f6e8ec81e4550ecd761f899110b060e970000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000021e19e0c9bab2400000",
      maxFeePerGas: "0x36ce7b58d5",
      maxPriorityFeePerGas: "0x79e5d6cb",
      nonce: "0x4a2",
      r: "0xffcd6172b6cf0c4b5b6a7b631f62fd9e21dedc2d7decaceb03627a1166e149ad",
      s: "0xd4276faf51ef61db42cd542394785c3aa136ce4d095dabc252b48d8c586fc8",
      to: "0xa0c68c638235ee32657e8f720a23cec1bfc77c77",
      transactionIndex: "0x5",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  }],
  transactionsRoot: "0x29b9880f57c0e79d0be5aa4fcc6b4cfcbed3e51478ad8f44533acce012df8cf1",
  uncles: []
}
> eth.getBlockByHash("0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5", true)
{
  baseFeePerGas: "0x1cc10d0cce",
  difficulty: "0x26bd640f42997a",
  extraData: "0x486976656f6e2065752d68656176792d32",
  gasLimit: "0x1c85c21",
  gasUsed: "0x44437",
  hash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
  logsBloom: "0x0000100000000094000000400000080000000040000000000000000000000002000000000000000000000000004001000000200000000000000008000220000000080400000800000000000a000000000000000000000000000010000000000000002000000408000000000000000010000080101002000000000010000000100000010000200800000400000080000000000000000000000002000000102000024000080200000000000082000000000000000000000000010000000000000000100012000000000000011000000000002000201000000008000000002000000010002800000000001400000000000000000000000100000000200000000000",
  miner: "0x1ad91ee08f21be3de0ba2ba6918e714da6b45836",
  mixHash: "0x57659bc7114af80d87a81a74d88a4ebbddb1ac2fc5d33b893740cd720efcfed1",
  totalDifficulty: "0x754d52d07a525aacfb2",
  transactions: [{
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xc5ff53779d377d4468b7b268bd6ad70a82ef8cc3",
      gas: "0x12f58",
      gasPrice: "0x1d1a753bce",
      hash: "0x5b3492f8199ee2a551d991b7d00bd48967ca5e5c1c15d6e1ee9fda97e3126e9a",
      input: "0xa9059cbb00000000000000000000000002a33965382f6471f91e54e0eb594cbdec0e012a000000000000000000000000000000000000000010c8d257e522581adacfedfb",
      maxFeePerGas: "0x1eb6534788",
      maxPriorityFeePerGas: "0x59682f00",
      nonce: "0x1276",
      r: "0x56d369f1dc0d45bd7e0d171b2ec10a4fa9185db77298ebc7476c5dbf7319f241",
      s: "0x6801be8f200e4ff9153c7385e0a24b23dc285d6402f88a688d2c7edf8ee3218",
      to: "0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
      transactionIndex: "0x0",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  },
      to: "0x41422219461377e5f62f35e195833aa3f142a7f5",
      transactionIndex: "0x1",
      type: "0x0",
      v: "0x25",
      value: "0x812aab5df843000"
  }, {
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      from: "0x9afa066884ce723200438b672c0b8d5769e03a6a",
      gas: "0x30d40",
      gasPrice: "0x1fd9ea5800",
      hash: "0x98053d20b01c9e56964a57084fb91ccc01b242adfb09c23534162dcbbcc094c2",
      input: "0xa9059cbb0000000000000000000000003ba76ed939e89b7d4518914fe6166a03b7363a820000000000000000000000000000000000000000000000058e884a6f25ab9000",
      nonce: "0x2e1fd",
      r: "0xc991781f49a9463107c50beb93b3c355c435aaa1ed340c2458ee4bfa34f292e5",
      s: "0x629b5f5eab0bb305e1106fe7ccb6f5fe98bdbe496fbe537654314a4383f90cca",
      to: "0xd26114cd6ee289accf82350c8d8487fedb8a0c07",
      transactionIndex: "0x2",
      type: "0x0",
      v: "0x25",
      value: "0x0"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0x3cd751e6b0078be393132286c442345e5dc49699",
      gas: "0x3d090",
      gasPrice: "0x1e26adc8ce",
      hash: "0x64c5ba9837b1c05bb292c7816fc47319d324aeb9aea4be10e034c61f6efd8aa4",
      input: "0xa9059cbb000000000000000000000000a68b3d93eb82b2e19e8b12720b355419e67dbddb000000000000000000000000000000000000000000000000000000000b532b80",
      maxFeePerGas: "0x39bdf3b000",
      maxPriorityFeePerGas: "0x165a0bc00",
      nonce: "0x410e76",
      r: "0xd0e9dcf67160c8e46fce89123b82167ee422bdbaa5648be3dd554ee61cc9712a",
      s: "0x60fda234342aa6925261380ed69e3f12d19397fd8be4eaf3ee2cd04838966964",
      to: "0xdac17f958d2ee523a2206206994597c13d831ec7",
      transactionIndex: "0x3",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xddfabcdc4d8ffc6d5beaf154f18b778f892a0740",
      gas: "0x15f90",
      gasPrice: "0x1e26adc8ce",
      hash: "0x69aba6a547b0da9c7132157191f94428cd89ad2b50ab6bceea5a8ec04bf166fa",
      input: "0x",
      maxFeePerGas: "0x39bdf3b000",
      maxPriorityFeePerGas: "0x165a0bc00",
      nonce: "0x30ba19",
      r: "0x79ef08397b8ece499077b39b8536f9dc2ed2a99ee6286a199ec3743f45a7f36e",
      s: "0x116931abbb36c55e7e3b3c18257e3c054b56585ed7b28f926ad05acaedff9c82",
      to: "0x8c003a63b549b2fa003fa73aacaa79b205605501",
      transactionIndex: "0x4",
      type: "0x2",
      v: "0x1",
      value: "0x454d55e1c5e6fc00"
  }, {
      accessList: [],
      blockHash: "0x456a7cbb6fada11a0ca8cec24510d89da1c52898f1087528752ae6e13973fbc5",
      blockNumber: "0xd0054e",
      chainId: "0x1",
      from: "0xfabc6fc448f53879557192c2d7679e42c09e7022",
      gas: "0x190bb",
      gasPrice: "0x1d3af2e399",
      hash: "0x2ecf1df1e4c8246549359319831bb0583f4b983596474ea31b610f5209d27b66",
      input: "0xe3dec8fb000000000000000000000000fabc6fc448f53879557192c2d7679e42c09e702200000000000000000000000028cca76f6e8ec81e4550ecd761f899110b060e970000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000021e19e0c9bab2400000",
      maxFeePerGas: "0x36ce7b58d5",
      maxPriorityFeePerGas: "0x79e5d6cb",
      nonce: "0x4a2",
      r: "0xffcd6172b6cf0c4b5b6a7b631f62fd9e21dedc2d7decaceb03627a1166e149ad",
      s: "0xd4276faf51ef61db42cd542394785c3aa136ce4d095dabc252b48d8c586fc8",
      to: "0xa0c68c638235ee32657e8f720a23cec1bfc77c77",
      transactionIndex: "0x5",
      type: "0x2",
      v: "0x0",
      value: "0x0"
  }],
  transactionsRoot: "0x29b9880f57c0e79d0be5aa4fcc6b4cfcbed3e51478ad8f44533acce012df8cf1",
  uncles: []
}

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Klaytn now supports eth namespace Block related apis

Add rpcMarshalBlock
* format the block which will be returned to api caller
@aeharvlee aeharvlee self-assigned this Jan 21, 2022
@aeharvlee aeharvlee changed the title Implemented Block related APIs Implemented Block related eth namespace APIs Jan 21, 2022
api/api_ethereum_test.go Outdated Show resolved Hide resolved
Instead of re-defining DummyGasLimit, it will be great to use pre-defined UpperGasLimit in Klaytn.
@aidan-kwon aidan-kwon added this to In progress in Interface via automation Jan 21, 2022
@aidan-kwon aidan-kwon added this to the v1.8.0 milestone Jan 21, 2022
jimni1222
jimni1222 previously approved these changes Jan 24, 2022
aidan-kwon
aidan-kwon previously approved these changes Jan 28, 2022
@aeharvlee aeharvlee dismissed stale reviews from aidan-kwon and jimni1222 via f19daec February 3, 2022 02:07
Interface automation moved this from In progress to Review in progress Feb 3, 2022
@aeharvlee
Copy link
Contributor Author

@aidan-kwon
@jimni1222

I resolved merge conflicts.

api/api_ethereum.go Outdated Show resolved Hide resolved
Co-authored-by: Jamie <32922423+jimni1222@users.noreply.github.com>
@aeharvlee
Copy link
Contributor Author

@jeongkyun-oh @yoomee1313
Can you review this PR? 🙂

@aeharvlee aeharvlee merged commit ffc4fd7 into klaytn:dev Feb 9, 2022
Interface automation moved this from Review in progress to Done Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants