Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Implement eth_sendRawTransaction #101

Merged
merged 3 commits into from
Sep 18, 2019

Conversation

austinabell
Copy link

  • RLP decodes raw transaction bytes, encodes it based on TxEncoder (amino in this case), then broadcasts tx to the node

I verified the tx decoding based on how I encoded the transaction and everything is functional as intended for this endpoint. One thing that needs to be revisited and verified is the transaction signing and verifying based on config/fork as there is no rigid setup for config for the running node.

To run:

make install 
rm -rf ~/.emint*
emintd init moniker --chain-id 3
emintcli config chain-id 3
emintcli config output json
emintcli config indent true
emintcli config trust-node true
emintcli keys add austin
testpass
testpass
emintcli emintkeys add austineth
testpass
testpass
emintd add-genesis-account $(emintcli keys show austin -a) 1000photon,100000000stake
emintd add-genesis-account $(emintcli emintkeys show austineth -a) 100000000photon,100000000stake
emintd gentx --name austin
testpass
emintd collect-gentxs
emintd validate-genesis
emintd start --pruning=nothing --rpc.unsafe

request:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf866068609184e72a0008303000094fa3caabc8eefec2b5e2895e5afbf79379e7268a780801ca07f158e380711daf356974ea62bd7850e58e9b970bd1f1bd284a1bd1f38356cc6a05491535e9f67184a37e7f4209affc580df8fda69f1bfa67d6d5c134d57a52951"],"id":1}' -H "Content-Type: application/json" http://localhost:8545/rpc
## {"jsonrpc":"2.0","id":1,"result":"0xd3137915bb6c655e6097e84326e17f6742b2f97796f4a595653ea277f4314bbf"}

Transaction probably won't work because it is signed with wrong chainconfig, but can test with another raw transaction if needed.

@austinabell austinabell force-pushed the austin/eth_sendRawTransaction branch from 4d07e34 to ca7bc64 Compare September 18, 2019 19:07
@austinabell
Copy link
Author

Rebase comparison failed so I force pushed with an updated branch with the commits cherry picked ontop so will make sure you're cool with changes before I merge.

@austinabell austinabell merged commit 2ca42cc into development Sep 18, 2019
@austinabell austinabell deleted the austin/eth_sendRawTransaction branch September 18, 2019 20:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants