I want to develop a dApp (Smart Contract) on Ethereum and have a mobile application on top of it.
My concern is: every time we interact with Smart Contract to inquiry or change data, we need a account as well as a certain number of ETH used as Gas. It looks no problem on the development environment, but getting into trouble in real life, I mean about user experience (UX).
- Whenever a user download and install the app, we will create for them an Ethereum account. BUT where they can get ETH to interact with Smart Contract? And absolutely, they don't care and don't want to be bothered with exchange ETH.
I have an alternative solution: we have only 1 Ethereum account with some ETH in their and act as the Proxy to the Smart Contract. Whenever user's request come, we delegate the request to Smart Contract and return to user. BUT it seems we will lost the main characteristic of Blockhain: Decentralized :) Who know we might arbitrarily change the Smart Contract without user attention.
Any suggestion is appreciated. Thank you!
You can send some ether to each new user that is just enough to call your contract.
Related
I'm new in the blockchain community, and i have to realize a web 3.0 project.
In this project, we have an ERC20, and for each user who sign up on our platform, I have to create a custodial wallet attached to this user.
User A want to be able to send tokens to User B.
I didn't find something concrete on google... so I'm maybe going in the wrong direction.
My question is: Is it possible to do that type of custodial wallet with smart contract in Solidity, and can you explain me how ?
In other to achieve this you will need 3 smart contracts:
Factory: This is the smart contract that has a function deployWallet that can only be called by a certain address, most likely the deployer address. What this does is deploy a new instance of another contract WalletProxy and store the address in a mapping to a UUID string which you use to identify each customer in your off-chain DB.
WalletImplementation: This contract holds the action you want your wallets to perform, e.g transferERC20, stake, swap, etc., and can be anything. It's going to be a contract you can always swap out and use another one with a more updated function, but be careful you need to understand how upgrades work in smart contracts and design Version 1 well. This contract will only be deployed once for every new version created.
WalletProxy: This is the contract you deploy every time a new wallet is created by calling the deployWallet function in the Factory.sol contract, only callable by a certain address. It serves as a wallet for each user and it's only a proxy contract that uses delegatecall to call functions from WalletImplementation, so in the future, if there is any update like WalletImplementation V2 it will always have access to it. The tricky part is also writing it in such a way that only a certain address can call all of the deployed wallet proxy contracts.
Reference Contracts:
I created the following contracts for the same demonstration purposes when asked how to create a custodian wallet using smart contracts.
Factory.sol
WalletImplementation.sol
WalletProxy.sol
I also did a live session where I built a simple exchange using the pattern described above. You can also go through the full codebase here https://github.com/CeloTAs/cXchange
I am very new to quorum programming. I already made some Smart Contracts with solidity on ethereum and made some dapps with Truffle, React and Metamask.
Now I did this Quorum Tutorial: https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains
Before I get to the problem I have, I tell you what I am trying to do:
Right now we have a database in our school, where the teacher can save the marks of the students, and the students can log in and see the marks they have. I'm trying to make a prototype, where this data is stored on a private blockchain like quorum.
So what I already did is a react front end for the prototype and I want that teachers can log in, save marks for a student and then the students can log in and see their marks. This means that students and teachers all need a login.
The Problems I face:
How can I set up a local productive quorum node?
For ethereum and ganache, you can use metamask and then use the
metamask account in the react front-end to make transactions. How
does it look like with quorum?
How can I make a login? Or does the teacher and student need to know
a private key for their account?
As you can see, Im very new in this world and I need to learn a bit more about the concept.
Thank you for your help
How can I set up a local productive quorum node?
Something like Quourum Maker may assist you in being able to quickly bootstrap a Quorum network without having to go through tedious manual configuration. The Quorum documentation is also full of tutorials that can guide you through this process.
For ethereum and ganache, you can use metamask and then use the metamask account in the react front-end to make transactions. How does it look like with quorum?
You could utilize something akin to ethereumjs-wallet to create wallets in-code and send the transactions via the Quorum web3.js library. You would need to then map these wallets to users in an off-chain database which leads into your next question.
How can I make a login? Or does the teacher and student need to know a private key for their account?
You can handle authentication in your web application via an IDP in which students and faculty already have existing credentials with if you have the appropriate access to do so. Otherwise, you could utilize SSO with well-known IDPs via something akin to Auth0.
Your flow would essentially involve first having the user authenticate, then tying their identity to a generated Ethereum wallet upon their first authentication and persisting these tied identities to an off-chain database. Subsequent authentications would pull the persisted wallet information from the off-chain database and use that for transaction signing. Other considerations would involve utilizing appropriate key management services as well as utilizing an HSM for secure transaction signing.
I could have given you the steps but on a second thought, I think its a good idea to start using something simpler like https://github.com/ssbc/ssb-db and then, come back to Ethereum.
I'm reading about blockchain and started devoloping my first smart contract, i have a lot of experience devoloping IT solutions, but everything in blockchain look very different than what i'm used to, i can't visualize some approach and possible i'm losing something in my reading, if someone could help me with those questions below ...
:)
so lets go
Suposing i have a blockchain solution running in ethereum. It's a voting system and this system was devoloped by a district to do a research with your citizens so
If one of the citizens vote, it's a transacation in ethereum and this must be paid using gas. To do that, you need ether and when you create an account this is zero. How would the citizens vote ? will they need to buy ether in a exchange (or mining ?) ?
how can i block votes outside my district if everybody in the network can send data to my smart contract ?
Is it common to have a traditional system for store other datas (address, phones, SSI) and use only a particular transaction, like vote, in blockchain ? how can i integrate them ?
i have created a wallet in myetherwallet. This wallet is the same as a new account command using geth ? is it possible to connect to my wallet created in myetherwallet from geth ?
where can i find a god material for those topics ?
Please find below responses from my end. Remember, the more responses we get to these questions the more diverse it can become as ideas differ from one individual to another based on lots of factors. Anyhow, here we go...
If one of the citizens vote, it's a transacation in ethereum and this must be paid using gas. To do that, you need ether and when you create an account this is zero. How would the citizens vote ? will they need to buy ether in a exchange (or mining ?) ?
Yes, for starters they have to pay the gas. Although, there's an ERC827 out there not to pay fee, and also some discussions around delegating the payment to a specific account, such that instead of individual users the owner of the smart contract can pay. In this case maybe the government can bear the amount.
how can i block votes outside my district if everybody in the network can send data to my smart contract ?
You can run consortium chain like quorum to limit the participants to a specific group. So that the transactions aren’t visible to everyone. Because on the Blockchain main chain of Ethereum it’s visible to everyone.
Is it common to have a traditional system for store other datas (address, phones, SSI) and use only a particular transaction, like vote, in blockchain ? how can i integrate them ?
Yup, you don't want to take the Personal Information (PI) onto Blockchain as its visible for everyone to view. Instead you can have them store in a database and use an Oracle service to be able to talk to outside Blockchain.
i have created a wallet in myetherwallet. This wallet is the same as a new account command using geth ? is it possible to connect to my wallet created in myetherwallet from geth ?
Yes, pretty much possible. You can use your password (or) mnemonic to connect to that account from your geth node.
where can i find a god material for those topics ?
Get this book on amazon or if you are eager to read it before you get the paperback book read it on github here. A better way to read this as a book on github is install an extension called Octotree
Hope, i have answered your questions, except one :)
I have a web site which sells certain information for its users for a fixed cost.
I want to go ICO with my business and trying to change my operating model so it can leverage blockchain technology.
However I want to make sure that auction participants are in some way abstracted from their Ethereum wallet and budding in points (they will pay later if action is actually won. i.e. eBay model) without knowing that they are actually using blockchain behind the scenes. Once bidding is complete, ICO investors will automatically get their share distributed to them, and winning bidder will receive their info upon payment (in most cases real money which we will convert to ETH and mark status as paid in solidity contract)
Is there any solution for that problem, can i create wallets on the fly for the bidders accounts? Since my site is always a seller, is there a way to set auctions automatically (interact with my contract from my lets say java backed etc?)
Is there any work around/ suggestions?
Thank You
You can create wallets on the fly for your customers. That's perfectly doable. But as you create the wallets, customers can't trust those wallets you have their private keys, so they should withdraw the funds immediately to their wallets. This took us to step 0: Wallet creation. So either way, your customers have to create a wallet for themselves, for security reasons.
I'm working on Ethereum ICO project, I studied Solidity and created a test token and deployed to Ethereum blockchain using MetaMask & Etherscan. but I'm not sure how to proceed further. I'm trying to connect different dots to achieve my goal. I have few questions related to ICO:
When launching an ICO, do we need to implement only ERC20 token standards into Smart Contracts or we need to write other logic's as well like how token buyers going to be benefited from this contract?
When investors send Ethers against ICO token, where to store those Ethers or how those Ethers can be managed so later all can be used for further development?
How to revert back Ethers if ICO goal is not reached?
How to transfer tokens to investors if ICO goal is reached?
Do we need Dapp for launching an ICO?
How contract manages tokens reserved for developers?
I studied Truffle but not sure how to use it for ICO launch?
It will be highly appreciated if anybody can guide me by replying all the above questions and share their personal experience launching an ICO.
Thanks in advance.
Its up to you but if you want people to be able to use your token in metamask / other exchanges to implement it you need to use ERC20 token, its tested and everyone knows how to implement
All depends on how you configure the contract but usually the person who lunch the contract will have access to the contract and can transfer the funds ... of course your contract your contract needs to be ownable in order to have such a properties enabled
You can do this by setting your crowdsale contract as RefundableCrowdsale
There is contract for crowdsale and in it, in distribution section you've options to transfer funds, essentially token is just a database with a list of wallets and how much of the wallet they own. meaning you don't really transfer anything and more like recording the name in the contract.
Not necessary, essentially investors just need to send ether to your contract.
I think that could be a a separate contract holding the fund for x amount of time before it gets released. The zeppelin-solidity seems to provide Tokenvesting.sol for this purpose.
Truffle is a framework, using industry standards of how you should deploy a contract it also helps with debugging
I would advice you to go through openzeppelin and by reading it you get a general idea of how everything works - helps with learning solidity