Hello, everyone!
I want to send a transaction from web3.py using an address that is not in the first place in Metamask. I'm getting an error:
"TypeError: from field must match key's "my main account", but it was "my second account" "

What do I need to do to send a transaction not from the main address? Why does Metamask allow to send transactions from this address, but web3.py does not? Thanks in advance!

Dec 15, 2021, 11:26 PM
Show your code of transaction sending
Dec 15, 2021, 11:27 PM
The account I am using is created with the same key as the main account
Dec 15, 2021, 11:34 PM
Source code says that you have different keys
Dec 15, 2021, 11:38 PM
I looked too, and it's strange because both accounts are in Metamask, and no other has been imported
Dec 15, 2021, 11:39 PM
Change your account in Metamask and do your action.
Why do you need to make tx from not main address?
Dec 15, 2021, 11:41 PM
This is just for interest, I can also send from the main
Dec 15, 2021, 11:42 PM
Maybe Metamask need main address for sending. Excuse me if I did not help
Dec 15, 2021, 11:43 PM
I found out what the problem is. For some reason I thought that if all accounts were created in Metamask, they had the same key. But it turns out they don't. Sorry for the inconvenience :)
Dec 15, 2021, 11:51 PM
It is normal. Every address as I know has unique private key :)
Dec 15, 2021, 11:52 PM
Correct, every address has a unique private key
Metamask generates multiple addresses using same seed phrase but they each have their own private key
Dec 16, 2021, 12:42 AM
It was a revelation for me today, thank you very much!
Dec 16, 2021, 12:44 AM
Sure!
Dec 16, 2021, 12:47 AM
or to be more precise, every address has many private keys (something like 2^96 private keys possible for each address)
Dec 16, 2021, 3:07 PM
Oh nice I didn’t realize that thank you!
Dec 16, 2021, 3:09 PM
kinda scary eh? Thankfully it's a very large number space and thus basically impossible to guess one
Dec 16, 2021, 3:09 PM
Hahaha yea, there’s some site that shows random private keys and corresponding addresses for Ethereum network (and consequently all EVM chains) and their balances and every one I’ve seen is zero
Dec 16, 2021, 3:10 PM
ah yeah I remember seeing a site like that for bitcoin...list of all private keys 😉
Dec 16, 2021, 3:11 PM

© 2024 Draquery.com All rights reserved.