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

Post v2 getblock RPC broke third party integrations #138

Closed
erasmospunk opened this issue Sep 13, 2018 · 2 comments
Closed

Post v2 getblock RPC broke third party integrations #138

erasmospunk opened this issue Sep 13, 2018 · 2 comments
Labels

Comments

@erasmospunk
Copy link

Take block 809411 when it was the tip:

{
  "bits": "1b04c83b",
  "chainwork": "000000000000000000000000000000000000000000000000c95a64aa1be22959",
  "confirmations": 1,
  "difficulty": 13704.08630421534,
  "hash": "88042e07ad4d36735f001c67b81787eb3dd504d670a36e949f9c3f55cc798b11",
  "height": 809411,
  "mediantime": 1536863272,
  "merkleroot": "c147180f1c2546f3cb76f25c7f9e13ae7fe277b51f3ce2a40b7e27ceaa6417c6",
  "nonce": 117381589,
  "previousblockhash": "f6ea7a25f7586f823a31afe8055bf1fd39faf92d6bab347e07f166fd918219b4",
  "size": 1122,
  "strippedsize": 1057,
  "time": 1536863632,
  "tx": [
    "953278614b545be0b036c43bd5e583dd1cfdc1b499a895d778a843ce2921fae8",
    "97041878e79e78d6818f4b5d902aed8b2285338b625778ac27b202e2cedfa8c3",
    "40abbcb4f0d9cf06447be71f55fc51d683e26b5c63c60058cbfb548fccfc7ddf"
  ],
  "version": 536870912,
  "versionHex": "20000000",
  "weight": 1122,
  "witness_merkleroot": "40abbcb4f0d9cf06447be71f55fc51d683e26b5c63c60058cbfb548fccfc7ddf",
  "witness_time": 1536863799,
  "witness_version": 536870912,
  "witness_versionHex": "20000000"
}

Raw bytes:

0000002037ae9a5bdf7dfccc8f54fbcb5800c6635c6be283d651fc551fe77b4406cfd9f0b4bcab4000000020b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf6c61764aace277e0ba4e23c1fb577e27fae139e7f5cf276cbf346251c0f1847c190ad9a5b3bc8041bd519ff06208d746d20cbf6bf07520d4ea9af38fdfe113b90666499b9d232d6b1b8c71b50747262e382b59595abb0b4823f256827b4fb83ea96679484019c26d63565bd3ae00301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4703c3590c0431ae9a5b0881000de7030100007a706f6f6c2e636100fabe6d6d1fd8a8ce0cfb03089fcf6b16ec73ec454e955a7a243a5a8566a1197e31df801b100000000000000000000000030050d6dc010000001976a9144ca5a9df8777b80dbf38d8ac2b06d01874928a7588ac00000000000000008f6a506f57c2b2000000202fae9a5b66208da935d2c7f402ed20e543ff2764ec10eabc7afd67027c6ab99011bf69e82057a36531ef22b8ddc8e156d5152bd6fbb1747adbbde1aff9e0f5c8b5d809b322101646f55a93c694959baa6e94b302896362772eb281c35389a61a23eca5ef77b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf60094357700000000232102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bbac000000000100000001e50e8bfa20fb2142893065d79fd909b71f125fa957f35299e1e74512ad951815000000006a473044022006a4d402682413dfcd95ffa7759ad04cc7eff536107e39ce97280f6069e249b802202d0b1bf4e4ff2583053c24c308025284b54c129bff2a4b61a6e863d40dde404b012102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bb000000000200e057eb481b00004a00485d4fe99826311603fc2891583cabbc6bc6343e1f5d4fe99826311603fc2891583cabbc6bc6343e1fcddf0b00000000000c150f00000000000000000000000000a4000000000000000000000000000000056a03c3590c0000000002000000020000000000000000000000000000000000000000000000000000000000000000ffffffff0403c3590c0000000060d3f7589983357f6cd9eaa498299524509452cb7261e6657f8889b4012f38a3000000006b483045022100fa8b4ae9d05ca3019a256b0f71a8f3d0a244cb46b7377149b3c3d618d1a7bce5022067884fe8ddd92c9a879f42d8378404f828c7dba6edebfdbe746382ede948660801210213d619fac9a940823dc71e907ba2fbc0d9bba2b6cc99968088d8f22cc02c918e000000000200203d88792d00004a0048e74a11d4ad542517d49815021d02dd5c6819c082e74a11d4ad542517d49815021d02dd5c6819c08299120c000000000098200d0000000000000000000000000075000000000000000094357700000000232103104edaf4705853ca7a59626f1800cf75e5611d21587d778c7a09d0ad46b40140ac00000000

Once the block 809412 came out the block 809411 was transformed to this:

{
  "bits": "1b04c83b",
  "chainwork": "000000000000000000000000000000000000000000000000c95a64aa1be22958",
  "confirmations": 5,
  "difficulty": 13704.08630421534,
  "hash": "512377d4fff2a53b3ffdfbca5142b92bde3bad951a70cbc9553e81e69cc33af6",
  "height": 809411,
  "mediantime": 1536863272,
  "merkleroot": "c147180f1c2546f3cb76f25c7f9e13ae7fe277b51f3ce2a40b7e27ceaa6417c6",
  "nextblockhash": "abb7d8cb18b5866cb76aa98bcc59355f8ba281135273ece7f13a1f8c4eb0737a",
  "nonce": 117381589,
  "previousblockhash": "f6ea7a25f7586f823a31afe8055bf1fd39faf92d6bab347e07f166fd918219b4",
  "size": 727,
  "strippedsize": 727,
  "time": 1536863632,
  "tx": [
    "953278614b545be0b036c43bd5e583dd1cfdc1b499a895d778a843ce2921fae8",
    "97041878e79e78d6818f4b5d902aed8b2285338b625778ac27b202e2cedfa8c3"
  ],
  "version": 536870912,
  "versionHex": "20000000",
  "weight": 727,
  "witness_merkleroot": "0000000000000000000000000000000000000000000000000000000000000000",
  "witness_time": 0,
  "witness_version": 0,
  "witness_versionHex": "00000000"
}

Raw bytes:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000020b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf6c61764aace277e0ba4e23c1fb577e27fae139e7f5cf276cbf346251c0f1847c190ad9a5b3bc8041bd519ff060201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4703c3590c0431ae9a5b0881000de7030100007a706f6f6c2e636100fabe6d6d1fd8a8ce0cfb03089fcf6b16ec73ec454e955a7a243a5a8566a1197e31df801b100000000000000000000000030050d6dc010000001976a9144ca5a9df8777b80dbf38d8ac2b06d01874928a7588ac00000000000000008f6a506f57c2b2000000202fae9a5b66208da935d2c7f402ed20e543ff2764ec10eabc7afd67027c6ab99011bf69e82057a36531ef22b8ddc8e156d5152bd6fbb1747adbbde1aff9e0f5c8b5d809b322101646f55a93c694959baa6e94b302896362772eb281c35389a61a23eca5ef77b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf60094357700000000232102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bbac000000000100000001e50e8bfa20fb2142893065d79fd909b71f125fa957f35299e1e74512ad951815000000006a473044022006a4d402682413dfcd95ffa7759ad04cc7eff536107e39ce97280f6069e249b802202d0b1bf4e4ff2583053c24c308025284b54c129bff2a4b61a6e863d40dde404b012102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bb000000000200e057eb481b00004a00485d4fe99826311603fc2891583cabbc6bc6343e1f5d4fe99826311603fc2891583cabbc6bc6343e1fcddf0b00000000000c150f00000000000000000000000000a4000000000000000000000000000000056a03c3590c00000000

This seems to be the same block but completely changed:

  1. the 40abbcb4f0d9cf06447be71f55fc51d683e26b5c63c60058cbfb548fccfc7ddf tx disappeared
  2. the block hash changed, although the CBlock::GetHashLegacy() gives the same value

The getblock RPC should return the same bytes for the same block regardless if it is the tip or not.

Ideally the raw format should revert the the old pre v2 style i.e. the block 809411 should be:

00000020b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf6c61764aace277e0ba4e23c1fb577e27fae139e7f5cf276cbf346251c0f1847c190ad9a5b3bc8041bd519ff060201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4703c3590c0431ae9a5b0881000de7030100007a706f6f6c2e636100fabe6d6d1fd8a8ce0cfb03089fcf6b16ec73ec454e955a7a243a5a8566a1197e31df801b100000000000000000000000030050d6dc010000001976a9144ca5a9df8777b80dbf38d8ac2b06d01874928a7588ac00000000000000008f6a506f57c2b2000000202fae9a5b66208da935d2c7f402ed20e543ff2764ec10eabc7afd67027c6ab99011bf69e82057a36531ef22b8ddc8e156d5152bd6fbb1747adbbde1aff9e0f5c8b5d809b322101646f55a93c694959baa6e94b302896362772eb281c35389a61a23eca5ef77b4198291fd66f1077e34ab6b2df9fa39fdf15b05e8af313a826f58f7257aeaf60094357700000000232102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bbac000000000100000001e50e8bfa20fb2142893065d79fd909b71f125fa957f35299e1e74512ad951815000000006a473044022006a4d402682413dfcd95ffa7759ad04cc7eff536107e39ce97280f6069e249b802202d0b1bf4e4ff2583053c24c308025284b54c129bff2a4b61a6e863d40dde404b012102a8846495fa67e19d99ff1efdc3a1a2206ee883bd046e5d6ef7f9019eb41237bb000000000200e057eb481b00004a00485d4fe99826311603fc2891583cabbc6bc6343e1f5d4fe99826311603fc2891583cabbc6bc6343e1fcddf0b00000000000c150f00000000000000000000000000a4000000000000000000000000000000056a03c3590c00000000

Please fix this issue.

@mjmacleod
Copy link
Member

This is not an issue at all but rather by design, so there is nothing to fix.
Should you wish to discuss how the coin works feel free to join our slack for discussion or read any of the literature on PoW² .

@erasmospunk
Copy link
Author

The block is the same, you are just adding some metadata and then replacing them with zeroes. If you don't want to break third party integrations like our wallet, just create an new API for the PoW² and revert to the normal getblock.

@muntorg muntorg locked as off-topic and limited conversation to collaborators Sep 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants