I am creating a DApp that connects to a smart contract deployed on a local test RSK blockchain (regtest) run by RSKj Java app. I intend to send transactions via Web3 connected to Metamask. In DApp I am getting the accounts list by sending a Web3 request:
const accounts = await web3.eth.getAccounts()
Further, accounts
will contain:
[
'0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
'0x7986b3DF570230288501EEa3D890bd66948C9B79',
'0x0a3aA774752ec2042c46548456c094A76C7F3a79',
'0xCF7CDBbB5F7BA79d3ffe74A0bBA13FC0295F6036',
'0x39B12C05E8503356E3a7DF0B7B33efA4c054C409',
'0xc354D97642FAa06781b76Ffb6786f72cd7746C97',
'0xDEBe71E1dE41Fc77C44Df4b6Db940026E31b0e71',
'0x7857288e171C6159C5576d1bD9AC40c0c48a771C',
'0xa4Dea4d5C954f5FD9e87f0e9752911E83a3D18b3',
'0x09a1edA29F664ac8f68106F6567276dF0C65D859',
'0xeC4ddeB4380Ad69B3E509BaAd9f158CDF4E4681d'
]
How do I import these accounts (or at least the first one of them) to Metamask in order to send transactions to the smart contract?
The first account from the list is referred as a “cow” seed in this file in RSKj. You can take the corresponding private key from there.
Do the following:
c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4
,regtest
network