owned this note
owned this note
Published
Linked with GitHub
## Connectivity WORKS
Docs: https://contracts.polkadot.io/connect-to-asset-hub
RPC URL URL: https://westend-asset-hub-eth-rpc.polkadot.io
Chain ID: 420420421
Currency Symbol: WND [Faucet](https://faucet.polkadot.io/westend)
Block Explorer URL: https://assethub-westend.subscan.io
[This](https://assethub-westend.subscan.io/event?page=1&time_dimension=date&module=revive&page_size=100) shows Substrate revive events on Westend Subscan.
I got some WND from the faucet into [my account 0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D](https://assethub-westend.subscan.io/account/5H45yowj5dGEqXamcj3odubSeATXPJ7C7Sd7iWDt8c9c6GCf)
The basic strategy employed by revive is:
* padded a 20 byte account with 12bytes of EE...EE to get a derived 32 byte pub key
```
0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D [20 byte]
0xdcb4651b5bbd105cda8d3ba5740b6c4f02b9256deeeeeeeeeeeeeeeeeeeeeeee [32 byte]
```
So following the instructions, I deployed a [contract 0xdb49e85e263614520115e14dbb3cfc85967ffc69](https://assethub-westend.subscan.io/account/5H2EJJMffNvVQU6HUFgzaYvTvkB7JGc4STSv7ej7eYmCzovR) at [block 10043713](
https://assethub-westend.subscan.io/extrinsic/10043713-2)
```
0xdb49e85e263614520115e14dbb3cfc85967ffc69 [20 byte]
0xdb49e85e263614520115e14dbb3cfc85967ffc69eeeeeeeeeeeeeeeeeeeeeeee [32 byte]
```

* transaction hash 0xc68a3a6eebac465aa0428475c60bed13db7b78ed0a28a0927b38b196b59d56ea
* block hash 0xcd10b172b2d64c8f47f6c2921234a23b97f70a5400eb237e64f15a354734fbce
Then I did a "Store" operation in [Block 10043929](
https://assethub-westend.subscan.io/extrinsic/10043929-2)

```
status 0x1 Transaction mined and execution succeed
transaction hash 0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405
block hash 0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da
block number 10043929
from 0xdcb4651b5bbd105cda8d3ba5740b6c4f02b9256d
to Storage.store(uint256) 0xdb49e85e263614520115e14dbb3cfc85967ffc69
gas 4535572732 gas
transaction cost 4990172732 gas
input 0x6057361d0000000000000000000000000000000000000000000000000000000000bc5c01
decoded input {
"uint256 num": "12344321"
}
```
# RPC Method checks
## eth_getBlockNumber WORKS!
This returns the latest block number:
```
# curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io -H "Content-Type: application/json" -d '{"jsonrpc": "2.0","method": "eth_blockNumber","params": [],"id": 1}'
{"jsonrpc":"2.0","id":1,"result":"0x993ef1"}
```
0x993ef1 is 10043121, a recent West end block.
## eth_getBalance WORKS
This is my (Sourabh) account: `0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D`
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"eth_getBalance",
"params": ["0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D", "latest"],
"id":1
}'
{"jsonrpc":"2.0","id":1,"result":"0x8ab6d1b56473f000"}
```
0x8ab6d1b56473f000 is 9995407000000000000 and 9995407000000000000/10^18=9.995407 WND
which matches https://assethub-westend.subscan.io/account/5H45yowj5dGEqXamcj3odubSeATXPJ7C7Sd7iWDt8c9c6GCf
## eth_getBlockByNumber WORKS! ... but does not return transactions yet =(
```
# curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io -H "Content-Type: application/json" -d '{"jsonrpc": "2.0","method": "eth_getBlockByNumber","params": ["0x98ec9a", true],"id": 1}'
{"jsonrpc":"2.0","id":1,"result":{"difficulty":"0x0","extraData":"0x","gasLimit":"0x3567e000000","gasUsed":"0x0","hash":"0xd070b5b0a0b863d4ad28e19a71419b339ed537e7406bb8cd7f809aec1146979c","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x98ec9a","parentHash":"0xc58e5edc54065980ffb078b07b017fc6fa8822ff1f3155f7a347872604ad7616","receiptsRoot":"0x91f9c6bf6394031745ecb2106c2f0994acce54051c379db67e7c5a8be35b5d34","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","size":"0x0","stateRoot":"0x567c1c189cc3e3d9bbd416e55d3f70825c3f60bea28f388317781d237f00bda6","timestamp":"0x6752cf34","transactions":[],"transactionsRoot":"0x91f9c6bf6394031745ecb2106c2f0994acce54051c379db67e7c5a8be35b5d34","uncles":[]}}
```
## eth_getBlockByHash WORKS but is missing transactions in the same way =(
```
# curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io -H "Content-Type: application/json" -d '{"jsonrpc": "2.0","method": "eth_getBlockByHash","params":["0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da",false],"id": 1}'
{"jsonrpc":"2.0","id":1,"result":{"difficulty":"0x0","extraData":"0x","gasLimit":"0x3567e000000","gasUsed":"0x0","hash":"0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x994219","parentHash":"0x06459b324dfa2af628116e8e1432da69ee4250a7a58f1ab4ee7d5982c5e8bb34","receiptsRoot":"0x5c3401306deb0cfc5bba46233bf0355be6b2a970b4e46c904161ee31319de8e9","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","size":"0x0","stateRoot":"0xc4e426b2fb07cac1f1aeca6e62aba34c03db9bf9de6914694f5f09fa6fd9bb3f","timestamp":"0x675508ec","transactions":[],"transactionsRoot":"0x5c3401306deb0cfc5bba46233bf0355be6b2a970b4e46c904161ee31319de8e9","uncles":[]}}
```
These all return responses, but no transactions!
* 10022112 0x98ece0 (block hash 0x8f1147b5b75c7b917a0524f67279f8a1bd3cf8f712bc6e5709a2d68bef49e4fd)
* 10022042 0x98ec9a (block hash 0xd070b5b0a0b863d4ad28e19a71419b339ed537e7406bb8cd7f809aec1146979c)
* 10021968 0x98ec50 (block hash 0xe231a2e8877729557b9168f11135ce21a57acb19a6e4df7448acc29c5b13b163)
* 10009512 0x98bba8 (block hash 0x99f92aa9134dd0d5769ddc3aba50bf7653808abcf19bb01f0446f5d14ad8b62f)
## eth_getCode WORKS
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0xdb49e85E263614520115e14Dbb3CFc85967ffc69", "latest"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x50564d00009e07000000000000010700c14004c00040046206000000000b000000100000001b0000002d000000380000006765745f73746f72616765696e7075747365616c5f72657475726e7365745f696d6d757461626c655f646174617365745f73746f7261676576616c75655f7472616e73666572726564051102860b0463616c6c8612066465706c6f7906870d1502861b670099009e00bd002701630182019e01b001d2017a03b503d0034404b604f704d205e305f10512061a0652790e7a1004070f0a41040a0000012f8a3965980802871f1277e03b370000010a040713000a0800000229781416070000025278040720000265870713000407200002658707130013006811e05a10185a15105a16086815201211e0127601040704080610029d60070800020d0100040407200003027702184e0111631762033804036203300403620328040360072004030706070610040906100617016811c05a10385a15305a16286815401211e0521604074004082006100848ff0707e4000408080002620358000262035000026203480002760700000000000000805a681060076000026817e01277e05a671852715d17185d17105d17085d0702774e05115b6a185ba7105ba8185ba9085baa0c98080ca7070c87070f077c04074004082006100adefe07077a5b6a105ba7485ba8585ba9405baa509d7b9d879d989da90c98080cb7090c89096a99200cb8086988200c98080f084b02775a671806100ca2fe07073e0a0810000207080d040740040302774e03115b6718040806100e83fe07071f5b67105b6818087808040704094e02110407040806101067fe0f07040001681004070104090400124e02116811e0fe5a1018015a1510015a160801681520011211e004074004082006101433fe0f07040004020800026203580002620350000262034800027607000000000000008004062004035f082804035f092004035f0a3004035f0b380403278c1b99041f9901548c0927b827ac54b80c0cba0a54ac0960076000020709a10104092000035f072000039d776b77200747c1ce642e93010f471d36576086015a19305a12385d11585d11505d11485d11400217404e05115b17505b18585b19485b1a400c98080ca7070c87070f07c1015f072004035f083804035f092804035f0a300403687bfc247b0765790c68ccff1c9c06249c0953670968a7ff6579092479071baa0170a8086587073d78279a54780a0c970727c81bb9201f990154c809547a0907096a015b1a305ba71c5ba8145ba90c5baa049d775a17309d875a17289d975a17209da65d21d8005d21d0005d21c8005d21c0005d21b8005d21b0005d21a8005d21a0005d2190005d2198005d2188005d21800000010218c000021aa000021b80000409ff04074e5d21f8005d21f0005d21e8005d21e0005a16785b17205a17705b17285a17685b17305a17600218e000021a600409ff040b2004074e040407400408200610168bfc07075bfe5b1a385ba7485ba8585ba9405baa509d7b9d870cb7080ca9099d990c98086a88200cb9096999200c98080f082dfe0276526706101850fc070720fe5b1738086708040704094e0204001a051b0206101a18025a12385d21b8005d21b0005d21a8005d21a0000217a0004e05115b17b0005b18b8005b19a8005b1aa0000c98080ca7070c87070f07385b675b68185b69085b6a10687bfc247b0765790b68bbff1c9b0c249b0953c70968a7ff6579092479071ba9017098086587072d071b0407040806101cc1fb070791fd01183804070104094e02115d21f8005d21f0005d21e8005d21e0005d21d8005d21d0005d21c8005d21c0005d11705d11785d11685d116000010218e000021ac000021b600409ff04074e5b17d8005a17205b17d0005a17285b17c8005a17305b16c00004074004082006101e4ffb07071ffd5b1a385ba7485ba8585ba9405baa509d7b9d870cb7080ca9099d990c98086a88200cb9096999200c98080f08f1fc5a1618027604082052670610200efb0707defc52675b16386576065b18209d8c5b18289d885b19309d995b1a189daa106a186aab38106b1f6aab30106b1e6aab28106b1d6aab20106b1c6aab18106b1b6aab10106b1a6aaa08106a191069106a9a38106a176a9a30106a166a9a28106a156a9a20106a146a9a18106a136a9a10106a126a99081069111068086a893810690f6a893010690e6a892810690d6a892010690c6a891810690b6a891010690a6a8808106809106c6ac8381068076ac8301068066ac8281068056ac8201068046ac8181068036ac8101068026acc08106c0104082006102233fa070703fc026804092004070400244e02116811f85a100407040806102614fa0f0704000408080002028804070104094e0204070400280542fa04070610283dfa04070106102a35fa00a58424092a241452482549928a10a15a082124429224252142082180842425a926494992842449aa9224494a4848a8292449b54226a51111912464082104104208a12495244408252020499234499244082124499224492a29492249524a292222222222828848232292244924a9244492a49292245121922a0989888846442449499224499224a910498d88888848122292462291484224492a2949122985284929a5244992244992244992244992244992244949922449922444294d1532942a29240400"}
```
## eth_getTransactionByHash WORKS
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da","blockNumber":"0x994219","from":"0xdcb4651b5bbd105cda8d3ba5740b6c4f02b9256d","hash":"0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405","transactionIndex":"0x2","chainId":"0x190f1b45","gas":"0x10e5758fc","gasPrice":"0x1","input":"0x6057361d0000000000000000000000000000000000000000000000000000000000bc5c01","nonce":"0x3","to":"0xdb49e85e263614520115e14dbb3cfc85967ffc69","type":"0x0","value":"0x0","r":"0x3d71f0a68e2502d79315240190effacfc1a49d51710d974454d171233f396181","s":"0x73e75f25a534532367f55f9280e3717be1c8b2377ef23541116c7fd95919c317","v":"0x321e36ae"}}
```
## eth_getTransactionReceipt WORKS
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da","blockNumber":"0x994219","contractAddress":null,"cumulativeGasUsed":"0x0","effectiveGasPrice":"0x1","from":"0xdcb4651b5bbd105cda8d3ba5740b6c4f02b9256d","gasUsed":"0x1296ffe3c","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0xdb49e85e263614520115e14dbb3cfc85967ffc69","transactionHash":"0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405","transactionIndex":"0x2","type":"0x0"}}
```
## eth_call WORKS
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0xdb49e85E263614520115e14Dbb3CFc85967ffc69",
"data": "0x2e64cec1"
}, "latest"],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000032"
}
```
## eth_chainId WORKS
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x190f1b45"}
```
## eth_estimateGas does NOT work
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"to": "0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D",
"value": "0x10"
}],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"Failed to convert value"}}
```
## eth_gasPrice WORKS, but check that its reasonable
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x1"}
```
This does not match up with:
```
gas 4535572732 gas
transaction cost 4990172732 gas
```
## eth_getBlockTransactionCountByHash WORKS!
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x1"}
```
## eth_getBlockTransactionCountByNumber WORKS!
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x994219"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x1"}
```
## eth_getTransactionByBlockHashAndIndex WORKS!
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0x8f1147b5b75c7b917a0524f67279f8a1bd3cf8f712bc6e5709a2d68bef49e4fd", "0x0"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x1"}
```
## eth_getTransactionByBlockNumberAndIndex WORKS! .. but uses the Substrate Extrinsics Index instead of the Ethereum Block Index
Not sure is this expected?
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["0x994219", "0x2"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x5b216d7ffc6e43111842d2ebdeb88ed5a1783321d14015f917b267f71280c4da","blockNumber":"0x994219","from":"0xdcb4651b5bbd105cda8d3ba5740b6c4f02b9256d","hash":"0xc294056321a85ee38e8efd7f2f7ce8935a0383b16dc0e825fde1adf6caf2a405","transactionIndex":"0x2","chainId":"0x190f1b45","gas":"0x10e5758fc","gasPrice":"0x1","input":"0x6057361d0000000000000000000000000000000000000000000000000000000000bc5c01","nonce":"0x3","to":"0xdb49e85e263614520115e14dbb3cfc85967ffc69","type":"0x0","value":"0x0","r":"0x3d71f0a68e2502d79315240190effacfc1a49d51710d974454d171233f396181","s":"0x73e75f25a534532367f55f9280e3717be1c8b2377ef23541116c7fd95919c317","v":"0x321e36ae"}}
```
## eth_getTransactionCount works
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0xDcB4651B5BbD105CDa8d3bA5740b6C4f02b9256D", "latest"],
"id": 1
}'
{"jsonrpc":"2.0","id":1,"result":"0x0"}
```
then after deploying my contract:
```
{"jsonrpc":"2.0","id":1,"result":"0x2"}
```
and running a transaction
```
{"jsonrpc":"2.0","id":1,"result":"0x3"}
```
## eth_sendRawTransaction NOT TESTED YET
Will check
```
curl -X POST https://westend-asset-hub-eth-rpc.polkadot.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xTODO"],
"id": 1
}'
```
# REQUESTS
Filed issue: https://github.com/paritytech/polkadot-sdk/issues/6790
* Critical: need to get the transactions of the block ASAP
* Important: need tracing -- `debug_traceTransaction` and `debug_traceBlockByHash` https://contracts.polkadot.io/known_issues/#missing-features-1
* Need a bulk RPC to get all the receipts of a Block `eth_getBlockReceipts`
* Need to get details of finalization model