I am learning solidity NFT, I am trying to generate v, r ,s using python web3
require(owner() == ecrecover(keccak256(abi.encodePacked(this, tokenId)), v, r, s), "owner should sign tokenId");
My python script
from web3.auto import w3
from eth_account.messages import encode_defunct
msg = "contractaddrsstokenid"
private_key = "mywalletprivatekey"
message = encode_defunct(text=msg)
signed_message = w3.eth.account.sign_message(message, private_key=private_key)
print(signed_message)
it returns v, s, r and signature. But values are supported in contract, it says invalid format. i have changed to base64 and use. It fails with "owner should sign tokenId". How can i create v,s,r using python web3.
tokenId
type? uint256, bytes32, ...