Categories
Cryptocurrency Ethereum Mastering Development

Tax coins for Universal Basic Income

I am working on building a coin that will be useful in providing UBI, but need a method to maintain the price of the coin, so that it doesn’t fall below threshold. Here is the idea: So every month, each person will be paid 10,000 Dollar-Tax coins. But dollar tax coins has the special property […]

Categories
Cryptocurrency Ethereum Mastering Development

How to convert uint256 that is “7500” into wei so that you can multiply it? 7500 into 0.000000000000750?

If you have a uint value how would you get it into wei form? I f I have a uint256 that equals "1" I want to convert it to 0.000000000000000001 or 1 wei. If the value is 7500, it would be 0.000000000000750 The idea here is: there is a value that changes that acts as […]

Categories
Cryptocurrency Ethereum Mastering Development

Can you use biconomy or GSN to pay for gas when deploying a contract?

I’m building a small dapp to allow users to deploy smart contracts without needed gas, where I’ll use GSN or biconomy. I’m not sure you can use meta-transaction services like these for transactions like this, since what I’m gathering on their website is you have to have a smart contract in play. I’d just like […]

Categories
Cryptocurrency Ethereum Mastering Development

Unable to connect to Geth/web3 from outside AWS using public IP with Websocket

I tried RPC api to connect to Geth/web3 hosted in AWS EC2 using the public IP. But developers have disabled web3 in RPC(HTTP) Web3 api for non local connection. It means that you can only make a web3 connection using localhost or 127.0.0.1. The other solution which I tried is using websocket. But it is […]

Categories
Cryptocurrency Ethereum Mastering Development

Truffle test. Convert ‘0x0000000000000000’ to zero. Assert it doesn’t exist

I am writing a truffle javascript test and I need to test if a key in a mapping was deleted. After deleting it, its values are equal to ‘0x0000000…’ . How can I test in a truffle javascript test that that equals to zero? magicSmartContract.delete_card(’33’); deleted_card = await magicSmartContract.get_card(’33’); assert(deleted_card[0], 0); // This It is […]

Categories
Cryptocurrency Ethereum Mastering Development

how to create a ENS subdomain and set the IPFS content hash

I try to create an ENS subdomain using web3js, but it fails: web3.eth.ens.setSubnodeOwner("rocinha.eth", "c1", owner, {from: owner}).then(console.log); // it succeeds. gasUsed: 46925! 1.04 EUR! // then I try to set the ipfs content hash: web3.eth.ens.setContenthash("c1.rocinha.eth", contentHash, {from: owner}).then(console.log); > Could not verify interface of resolver contract at "0x0000000000000000000000000000000000000000". I am not sure about the 3rd […]

Categories
Cryptocurrency Ethereum Mastering Development

Fatal: Error starting protocol stack: gap — Chain freezer table opened

I started to get following error: Fatal: Error starting protocol stack: gap (#3697270) in the chain between ancients and leveldb. What may be the cause of this error? I was able to fix it by syncing my chain from scratch. (geth version: 1.9.13-unstable) // Please see the debug log with the highest verbostiy: $ sudo […]

Categories
Cryptocurrency Ethereum Mastering Development

Execution erorr: Invalid opcode on estimateGas | Possible unhandled promise rejection

pragma solidity ^0.5.0; I get invalid opcode error when trying to estimate gas needed for my transaction from react-native using the following line of code: const gasAmount = await contract.methods .Track(RecordOwner, account, meidcalRecordHash) .estimateGas({from: account}); After some searching, I found that invalid opcode can be the result of either one of the following runtime operations: […]

Categories
Cryptocurrency Ethereum Mastering Development

Recovered address not matching signer address (using ethers)

Below is a simple signature verification flow I wrote, along with a test case with Buidler (all mainly to learn how to verify signatures in a Solidity smart contract). The problem is that the address I recover from the signature and the associated hash is different from the address of the signer that signed the […]

Categories
Cryptocurrency Ethereum Mastering Development

Convert uint256 into Wei within solidity? (Turn the number “500” into “0000000000000500”)

How would you take a uint256 that is a value – such as 500, or 7506, and turn it into its wei equivalent? return (value) * 10**18; Returns 750600000000000… Its almost like I need to pack a buffer on the left side – but thats not the right answer. If the value is larger than […]