Closed ErvinDimitri closed 3 years ago
I think there is a mixup of gasPrice
and gasLimit
in your code.
Please try removing any gasLimit
or gasPrice
from the constructor arguments and supplying them as txOptions
to the setAttribute
method:
pubkey = 'PUBLIC KEY'
identif=pubkey // when you use chainNameOrId, the DID string gets constructed automatically
const main = async () => {
let prov = await new Web3Provider(provider)
const ethrDid = await new EthrDID({identifier: identif, provider: prov, registry:bscAddr, chainNameOrId:chainId})
let gasPrice = (await prov.getGasPrice()).toNumber() * 2
let gasLimit = 10000000 // the BSC testnet block limit seems to be 30 million
let response = ethrDid.setAttribute('drivL','142536',1629981511, null, {gasPrice, gasLimit})
.then( (info) => console.log(response))
.catch( (error) => console.log(error)
)
provider.engine.stop()
}
main()
Note
Please avoid posting personally identifiable information on-chain as this can have serious privacy implications.
When you call setAttribute
, the attribute information remains public for as long as the blockchain is maintained, even if you later call revokeAttribute
.
It's working. Thank you very much!!!
I have a question about posting personal information on-chain:
If the data is encrypted (using a password defined by user) and store on IPFS and then post only the hash on-chain (or encrypt the IPFS's hash too and post on-chain) Is this strategy efficient and secure?
Glad to hear it works,and yes, that sounds like a reasonable strategy.
Current Behavior
I am trying to run the following code on bsc testnet (already deployed the smart contract on bsc testnet) I already ran in Ropsten Network and had no issues
On the following code, I pretend to set an attribute and I am getting the following error: { code: -32000, message: 'transaction underpriced' } So i decided to add gasPrice as a parameter on setAttribute() function, but now I am getting another error: { code: -32000, message: 'exceeds block gas limit' }
Expected Behavior
Should just return the Tx hash
Failure Information
when i decrease the gasPrice, i receive this message { code: -32000, message: 'transaction underpriced' } when i increase the gasPrice, i receive this message: { code: -32000, message: 'exceeds block gas limit' }
Steps to Reproduce
Running the following code:
Environment Details
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Node version 14.17.1