Skip to content

Instantly share code, notes, and snippets.

@letterj
Last active March 3, 2020 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letterj/6a6f99f5af8083e8aca38bce258053ec to your computer and use it in GitHub Desktop.
Save letterj/6a6f99f5af8083e8aca38bce258053ec to your computer and use it in GitHub Desktop.
Running the script from etherment-scripts. It is the original script with the exception of uncommenting the getBlock command
> ethermint-scripts@1.0.0 testDeploy /Users/letterj/workshop/chainsafe/ethermint-scripts/web3
> node ./deploy_contract.js
Unlocked account address: 0x96d51a7B830ADB1D0706f0F8A0B9BcEbcAD4Afb8
Contract Address: 0x2Abc87e407Ce61921B6d4Ba4A69fb20Ac194dfce
Tx 0 : 0x00000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000100000000000000000000000000000010000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Tx 0 : 0x00020000000000000004000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
block number: 309
done
{
difficulty: null,
extraData: null,
gasLimit: 4294967295,
gasUsed: null,
hash: '0xa7c875e760512a868b6de953dafc5e32b89d5cb796747760a1d1de0d322586ad',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
miner: '0x0000000000000000000000000000000000000000',
nonce: null,
number: 309,
parentHash: '0x71deedc0f5cc061bceda8dc53e5598acc87806d6542f573bda82fbdd917e6843',
sha3Uncles: null,
size: 879,
stateRoot: '0xb906e48475382fadfa0563e92aa94975af2aea6a9bad864e71c2599961574e4d',
timestamp: 1582824427,
totalDifficulty: null,
transactions: [
'0xb52190965e6badc7f8576373a946959e1bc3f6094304cc83f25b0b33783122e5'
],
transactionsRoot: '0x6f5a74b67993215380dd7a18e8aeb107e5753e1a32efc494d2ca43696c978196',
uncles: null
}
Running eth_getBlockByNumber from the RPC call:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x135", true],"id":1}' -H "Content-Type: application/json" http://localhost:8545 | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1859 100 1778 100 81 434k 20250 --:--:-- --:--:-- --:--:-- 453k
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": null,
"extraData": null,
"gasLimit": "0xffffffff",
"gasUsed": "0x47b760",
"hash": "0xa7c875e760512a868b6de953dafc5e32b89d5cb796747760a1d1de0d322586ad",
"logsBloom": "0x00020000000000000024000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000100000000000000000000000000000010000000000000000000100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000010000000000000000000000000000000000000000000",
"miner": "0x0000000000000000000000000000000000000000",
"nonce": null,
"number": "0x135",
"parentHash": "0x71deedc0f5cc061bceda8dc53e5598acc87806d6542f573bda82fbdd917e6843",
"sha3Uncles": null,
"size": "0x36f",
"stateRoot": "0xb906e48475382fadfa0563e92aa94975af2aea6a9bad864e71c2599961574e4d",
"timestamp": "0x5e57fbeb",
"totalDifficulty": null,
"transactions": [
{
"blockHash": "0xa7c875e760512a868b6de953dafc5e32b89d5cb796747760a1d1de0d322586ad",
"blockNumber": "0x135",
"from": "0x96d51a7b830adb1d0706f0f8a0b9bcebcad4afb8",
"gas": "0x72bf0",
"gasPrice": "0xa",
"hash": "0xa17b9b36061b45c1797a6456acd3dcf6a7eee17067e62c5758313cc33c9d1dce",
"input": "0x221564090000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x6",
"to": "0x2abc87e407ce61921b6d4ba4a69fb20ac194dfce",
"transactionIndex": "0x0",
"value": "0x0",
"v": "0x29",
"r": "0xb9193373434def20c7ea82427ad0733ef8e0ece7f73e36e894189a1fec818467",
"s": "0x6138e113866005921fc76d0e4253eb248b1fb7f9d9af9f98c43e918a716a8a77"
}
],
"transactionsRoot": "0x6f5a74b67993215380dd7a18e8aeb107e5753e1a32efc494d2ca43696c978196",
"uncles": null
}
}
The blocks appear to be the same. num, size, hash, But look at the logs bloom and transactions
Web3 logsBloom in the block:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
RPC logsBloom in the block:
"0x00020000000000000024000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000100000000000000000000000000000010000000000000000000100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000010000000000000000000000000000000000000000000"
Transactions array from the web3 block
transactions: [
'0xb52190965e6badc7f8576373a946959e1bc3f6094304cc83f25b0b33783122e5'
]
Transactions array from the RPC block
"transactions": [
{
"blockHash": "0xa7c875e760512a868b6de953dafc5e32b89d5cb796747760a1d1de0d322586ad",
"blockNumber": "0x135",
"from": "0x96d51a7b830adb1d0706f0f8a0b9bcebcad4afb8",
"gas": "0x72bf0",
"gasPrice": "0xa",
"hash": "0xa17b9b36061b45c1797a6456acd3dcf6a7eee17067e62c5758313cc33c9d1dce",
"input": "0x221564090000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x6",
"to": "0x2abc87e407ce61921b6d4ba4a69fb20ac194dfce",
"transactionIndex": "0x0",
"value": "0x0",
"v": "0x29",
"r": "0xb9193373434def20c7ea82427ad0733ef8e0ece7f73e36e894189a1fec818467",
"s": "0x6138e113866005921fc76d0e4253eb248b1fb7f9d9af9f98c43e918a716a8a77"
}
],
Calling eth_getTransactionReceipt using the hash from both the web3 and RPC getblock calls
RPC call using the
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb52190965e6badc7f8576373a946959e1bc3f6094304cc83f25b0b33783122e5"],"id":1}' -H "Content-Type: application/json" http://localhost:8545 | jq
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xa7c875e760512a868b6de953dafc5e32b89d5cb796747760a1d1de0d322586ad",
"blockNumber": "0x135",
"contractAddress": null,
"cumulativeGasUsed": null,
"from": "0x96d51a7b830adb1d0706f0f8a0b9bcebcad4afb8",
"gasUsed": "0x578a",
"logs": null,
"logsBloom": "0x00020000000000000004000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x2abc87e407ce61921b6d4ba4a69fb20ac194dfce",
"transactionHash": "0xb52190965e6badc7f8576373a946959e1bc3f6094304cc83f25b0b33783122e5",
"transactionIndex": "0x0"
}
}
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xa17b9b36061b45c1797a6456acd3dcf6a7eee17067e62c5758313cc33c9d1dce"],"id":1}' -H "Content-Type: application/json" http://localhost:8545 | jq
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment