{"id":27742574,"url":"https://github.com/astarnetwork/polkadotjs-ecdsa-hardware","last_synced_at":"2026-01-22T05:32:21.215Z","repository":{"id":103304155,"uuid":"567420764","full_name":"AstarNetwork/polkadotjs-ecdsa-hardware","owner":"AstarNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-21T14:16:27.000Z","size":46001,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-28T16:57:30.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AstarNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-17T18:52:55.000Z","updated_at":"2023-03-16T04:54:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"eae782b3-f0da-4f6b-b5bb-c8e78b1f7ca1","html_url":"https://github.com/AstarNetwork/polkadotjs-ecdsa-hardware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AstarNetwork/polkadotjs-ecdsa-hardware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fpolkadotjs-ecdsa-hardware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fpolkadotjs-ecdsa-hardware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fpolkadotjs-ecdsa-hardware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fpolkadotjs-ecdsa-hardware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstarNetwork","download_url":"https://codeload.github.com/AstarNetwork/polkadotjs-ecdsa-hardware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fpolkadotjs-ecdsa-hardware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28656247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-28T16:43:25.091Z","updated_at":"2026-01-22T05:32:21.209Z","avatar_url":"https://github.com/AstarNetwork.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# MetaMask Support\n\n- Created: June 28, 2022 8:49 AM\n- Last Edited Time: November 17, 2022 7:56 PM\n\nThe guide of using Metamask on substrate-based chains.\n\nSubstrate does not allow the users to sign custom transactions with arbitrary data using Metamask or any other Ethereum wallet to use the standard API calls. For example, JSON-RPC API defines the `eth_sign` call which is used for signing arbitrary data. However, this call requires a standard [prefix](https://web3js.readthedocs.io/en/v1.2.11/web3-eth-personal.html#sign) to all data by `\\0x19Ethereum Signed Message` due to security concerns. This is done to prevent users from unknowingly sign transactions, and by design, it is impossible to sign binary data, like Substrate Extrinsic.\n\n## Custom signatures pallet\n\nTo mitigate the limitations in eth_sign, we created the Custom Signatures pallet. The main idea is to move the transaction signature validation out of the Substrate core and provide a custom signature method for runtime developers. Because the signature is expected to be prefixed, this call can be used with the personal_sign method as well, which is recommended by the Ethereum community.\n\n```bash\nimpl pallet_custom_signatures::Trait for Runtime {\n\ttype Event = Event;\n\ttype Call = Call;\n\ttype Signature = EthereumSignature;\n\ttype Signer = \u003cSignature as Verify\u003e::Signer;\n\ttype UnsignedPriority = EcdsaUnsignedPriority;\n}\n```\n\nHere, the developer will have to define the implementation for the EthereumSignature signing method, prefixed by Ethereum Signed Message string. Using this pallet the users can send unsigned transactions with a dedicated parameter - signature, generated by any Ethereum-compatible wallet. The chain will check if the sender account (that is included in the method parameter) has the correct assets to execute this call or not and send it accordingly.\n\n## User interface application\n\nThe Astar team extends standard PolkadotJS Apps by adding a custom signature transaction page. The Custom Signature page allows the user to submit a transaction that was signed with an Ethereum private key and use it as a native ECDSA account in Substrate. Plus, you are able to use MetaMask for signature requests, which allows users to use their Ethereum address inside Ledger and Trezor to create a transaction. This page will look for any window.ethereum object being injected by a dApp browser extension (ex: MetaMask) and send a signature request to the extension which can be confirmed by the user. Because this is a light-weight zero-dependency implementation of MetaMask, we kept the ECDSA account data only available within the Custom Signature page. This can be improved to add global support for Web3js injected accounts if required.\n\n## Setup local test environment\n\n### Clone Custom Signature Polkadot.JS app\n\n- Clone → [https://github.com/hoonsubin/apps/tree/page/custom-signature](https://github.com/hoonsubin/apps/tree/page/custom-signature)\n- Use `yarn build` to install the dependencies\n- Use `yarn start` to start a local instance of the app\n\n![Untitled](ecdsa/ecdsa-0.png)\n\nVisit [http://localhost:3000/](http://localhost:3000/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer) to load the `custom-signature` branch for Polkadot.JS\n\n### Run Astar local network\n\nYou can get the binary in one of the following ways:\n\n- Download the latest binary from [Github](https://github.com/AstarNetwork/Astar/releases)\n- Build from source\n\nIf you want to download the binary, go to the [Release page of Astar Github repository](https://github.com/AstarNetwork/Astar/releases). You can find the pre-built binaries for MacOS and Ubuntu as well as Docker images. If you want to build from source, [this readme](https://github.com/AstarNetwork/Astar#building-from-source) helps you a lot!\n\n### [](https://dev.astar.network/docs/EVM/first-contract/local-network#run-the-local-network)\n\nYou are already ready to run the local network. Simply run the following command:\n\n`./astar-collator --port 30333 --ws-port 9944 --rpc-port 9933 --rpc-cors all --alice --dev`\n\n### Access your local network via Explorer[](https://dev.astar.network/docs/EVM/first-contract/local-network#access-your-local-network-via-explorer)\n\nAccess the following [URL](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer). Then you can see the following screen:\n\n![Untitled](ecdsa/ecdsa-1.png)\n\n### Or use the Shiden public network\n\nVisit [http://localhost:3000/?rpc=wss://shiden.public.blastapi.io#/custom-signature](http://localhost:3000/?rpc=wss%3A%2F%2Fshiden.public.blastapi.io#/custom-signature) to use the public network.\n\nNote that you will need to fund your account with SDN to send transactions.\n\n\n## Usage: Ledger\n\n### Step 1:\n\nTo start, connect your Ledger hardware wallet to your PC and go to the Ethereum app from the dashboard.\n\n![Untitled](ecdsa/ecdsa-2.png)\n\n### Step 2:\n\nOnce you have connected your device and it's running the Ethereum app, you can now open MetaMask to import your account. You can import by opening the account list menu and clicking on the 'Import Account' button.\n\n![Untitled](ecdsa/ecdsa-3.png)\n\nChoose Ledger to read your accounts from your connected Ledger device.\n\n![Untitled](ecdsa/ecdsa-4.png)\n\n![Untitled](ecdsa/ecdsa-5.png)\n\n### Step 3:\n\nIf you have successfully imported your Ledger accounts to MetaMask, please visit the official Polkadot/Substrate Portal and navigate to the \"Custom Signature\" page, which is under the \"Accounts\" tab.\n\n![Untitled](ecdsa/ecdsa-6.png)\n\nYou will be presented with a 'Load account from MetaMask' button if you haven't loaded your account.\n\n![Untitled](ecdsa/ecdsa-7.png)\n\nBefore clicking the button, make sure that you're MetaMask is connected with the browser, and that it's the main account that the app can read from.\n\n![Untitled](ecdsa/ecdsa-8.png)\n\n### Step 4:\n\nAfter confirming your main account, click the 'Load account from MetaMask' button to send a 'request account' and 'personal sign' request to your Ethereum account. This allows the page to recover your public key and encode that to a Substrate-compatible ECDSA SS58 address.\n\n![Untitled](ecdsa/ecdsa-9.png)\n\n\u003caside\u003e\n🚨 Note: After MetaMask asks to sign this message, you will receive another signature request from your Ledger device. You must confirm both of them to sign the message\n\n\u003c/aside\u003e\n\n![Untitled](ecdsa/ecdsa-10.png)\n\n### Step 5:\n\nIf everything went well and you have correctly signed the message, the Custom Signature page will change to display your SS58 address on top with an extrinsic input form on the bottom half.\n\n![Untitled](ecdsa/ecdsa-11.png)\n\nProvide the call method you wish to submit to the chain and click the 'Sign Transaction' button on the bottom right corner. Clicking this will show a prompt from MetaMask to sign this message. Similar to the login function, you must confirm the sign from both MetaMask and Ledger.\n\n![Untitled](ecdsa/ecdsa-12.png)\n\n![Untitled](ecdsa/ecdsa-13.png)\n\n### **Step 6:**\n\nOnce you confirm the transaction signature, there will be a modal popup that asks you to confirm the transaction.  Click the 'Send Transaction' button to send a request.\n\n![Untitled](ecdsa/ecdsa-14.png)\n\nAfter you confirm the transaction, there will be another modal that will ask you to submit an unsigned transaction to the network. Click the 'Submit (no signature)' button to confirm. This will request the network to execute the call with the loaded Ethereum account as the sender.\n\n![Untitled](ecdsa/ecdsa-15.png)\n\n\u003caside\u003e\n🚨 You may notice that we have three different confirmation modals to submit this transaction; Ethereum signature confirmation, transaction confirmation, and authorize transaction modal.\n\nThe first confirmation is required to obtain the signature from MetaMask, and the second confirmation is used to build the `ethCall.call` method arguments which will be sent to the network. The final confirmation modal is the default behavior for submitting transactions within the Polkadot/Substrate Portal.\n\n\u003c/aside\u003e\n\n### **Ending:**\n\nAfter a few seconds, your transaction should have been completed. You can confirm this by looking at the event history for the event `ethCall.Executed` with the event emitted by the call you requested.\n\n![Untitled](ecdsa/ecdsa-16.png)\n\nPlease note that transactions sent though this method has no priority or lifetime. So users should not use this as their daily driver account.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fpolkadotjs-ecdsa-hardware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastarnetwork%2Fpolkadotjs-ecdsa-hardware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fpolkadotjs-ecdsa-hardware/lists"}