diff --git a/README.md b/README.md index b4f27917..dddf6995 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ > #### Interact with the [Ethereum](https://ethereum.org/) blockchain from the [Internet Computer](https://internetcomputer.org/). +### Test canister: [6yxaq-riaaa-aaaap-abkpa-cai](https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.ic0.app/?id=6yxaq-riaaa-aaaap-abkpa-cai) + ## Overview **IC 🔗 ETH** is an Internet Computer canister smart contract for communicating with the Ethereum blockchain using an [on-chain API](./API.md). @@ -23,7 +25,7 @@ Add the following to your `dfx.json` config file: "wasm": "https://github.com/internet-computer-protocol/ic-eth-rpc/releases/latest/download/ic_eth_dev.wasm.gz", "remote": { "id": { - "ic": "TODO: deploy canister" + "ic": "6yxaq-riaaa-aaaap-abkpa-cai" } }, "frontend": {} @@ -85,18 +87,18 @@ dfx deploy ### Ethereum RPC (local replica) ```bash # Use a custom provider -dfx canister call --wallet $(dfx identity get-wallet) --with-cycles 600000000 ic_eth request '("https://cloudflare-eth.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' -dfx canister call --wallet $(dfx identity get-wallet) --with-cycles 600000000 ic_eth request '("https://ethereum.publicnode.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' +dfx canister call ic_eth --wallet $(dfx identity get-wallet) --with-cycles 600000000 request '("https://cloudflare-eth.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' +dfx canister call ic_eth --wallet $(dfx identity get-wallet) --with-cycles 600000000 request '("https://ethereum.publicnode.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' # Register your own provider dfx canister call ic_eth register_provider '(record { chain_id=1; base_url="https://cloudflare-eth.com"; credential_path="/v1/mainnet"; cycles_per_call=10; cycles_per_message_byte=1; })' -dfx canister call --wallet $(dfx identity get-wallet) --with-cycles 600000000 ic_eth provider_request '(0,"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' +dfx canister call ic_eth --wallet $(dfx identity get-wallet) --with-cycles 600000000 provider_request '(0,"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' ``` ### Ethereum RPC (IC mainnet) ```bash -dfx canister --network ic call --wallet $(dfx identity --network ic get-wallet) --with-cycles 600000000 ic_eth request '("https://cloudflare-eth.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' -dfx canister --network ic call --wallet $(dfx identity --network ic get-wallet) --with-cycles 600000000 ic_eth request '("https://ethereum.publicnode.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' +dfx canister --network ic call ic_eth --wallet $(dfx identity --network ic get-wallet) --with-cycles 600000000 request '("https://cloudflare-eth.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' +dfx canister --network ic call ic_eth --wallet $(dfx identity --network ic get-wallet) --with-cycles 600000000 request '("https://ethereum.publicnode.com","{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' ``` ### Authorization (local replica) @@ -110,7 +112,7 @@ dfx canister call ic_eth deauthorize "(principal \"$PRINCIPAL\", variant { Regis ## Caveats -### API Keys are stored in the Canister +### API Keys are stored in the canister Registered API keys are available to IC nodes in plaintext. While the canister memory is not exposed generallly to users, it is available to node providers and to canister controllers. In the future features such as SEV-SNP will enable privacy of canister memory, but until we have those features the API keys should not be considered to be entirely safe from leakage and potential misuse. API key providers should limit the scope of their API keys and monitor usage to detect any misuse. @@ -118,18 +120,18 @@ Registered API keys are available to IC nodes in plaintext. While the canister Application subnets have some number of nodes (typically 13), so a `request` call will result in 13 HTTP outcalls using the registered API key. API providers should be aware of this when considering rate and operation limits. -### Signed Transactions should be Signed Securely +### Signed Transactions should be securely signed This canister takes pre-signed transactions e.g. for `eth_sendRawTransaction` and these should be signed in a secure way, for example using Threshold ECDSA or by signing the transaction in a secure manner offline. In any case, private keys should not be stored in canisters because canister memory is (currently) not private from node providers. ### JSON is not validated -This canister does not validate the JSON passed to the ETH service. Registered API key providers should be aware of this in case the back end service is vulnerable to a bad JSON/request body. Registered API providers should be aware that there are methods in the ETH RPC API specification which give access to the ETH node keys. Public service providers tend to block these, but registered API providers should ensure that they are not giving access to private keys or other proviledged operations. +This canister does not validate the JSON passed to the ETH service. Registered API key providers should be aware of this in case the back end service is vulnerable to a bad JSON request body. Registered API providers should be aware that there are methods in the ETH RPC API specification which give access to the ETH node keys. Public service providers tend to block these, but registered API providers should ensure that they are not giving access to private keys or other proviledged operations. -### Requests sent to service providers are subject to the service providers privacy policy +### Requests sent to service providers are subject to the service provider's privacy policy Users should be aware of the privacy policy of the service provider to which their requests are sent as some service providers have stronger privacy guarantees. -### Idempotency issues because of one HTTP outcalls per node in the subnet +### Idempotency issues because of one HTTP outcall per node in the subnet HTTP outcalls result in one HTTP outcall per node in the subnet and the results are then combined after filtering through a Transform function. Some ETH RPC calls may not be idempotent or may vary which will cause the call to be reported as a failure as there will be no consensus on the result. In particular `json_rpc_provider_cycles_cost` may be accepted only once and subsequent calls may result in a duplicate error. Furthermore this behavior may differ by service provider. Users should be aware of this and use appropriate caution and/or a different or modified solution.