I believe that churches, social organizations or funds should have every right to be represented in global networks unlike fake startups.
I mean enough mooching money from ICO/SCO you fools and start developing useful DApps! You can create the most part of MVP in 1–2 weeks if you understand the business model and have a team of professionals.
Just now I’m going to prove it and we will develop a real DApp together — CryptoChurch.
Blockchain is a commodity. If you agree, then we can start.
First off, we need to select the main technology.
After a year of deep analytics, I’ve come to select Ethereum as a core architecture. There are only two reasons for that:
- It’s very easy for developers since the tools have already been developed.
- A lot of worshipers have collected free Ethereum from praying to cryptogods from their home PC.
Simple smart contact
What is the most important thing for CryptoChurch?
I can’t guess your thoughts, but I can say ….
We are going to create a simple smart contract with basic functionality to collect donations. Use Google Chrome to enter http://remix.ethereum.org/
Delete a draft with an old code and copy text from the example (you can find code at the end of the article)
So, line 1 is the version of the compiler. On the Internet, you can usually find e ^0.4.24, but we follow the ConsenSys Should we lock pragma? :
Further, in the third line, we create a smart contract of the church, in which two basic functions are realized:
constructor() — function that is executed automatically when a contract is created and determines the person who will manage it. The person who has built the church, he rules, we call this position “the priest.”
gatherDonation — function for transferring donations (keyword payable permits translations), which must be at least a given amount.
Role allocation. Making contract more complex
We understand that different activities are implied by CryptoChruch, and it is necessary to limit permissions. We add special function St() for marking actions allowed only for the priest:
Next, we create function for withdrawing funds from the CryptoChruch smart contract directly to the priest account:
So what else are we missing? Let’s find out who donated! This is another new feature that displays a list of address-donors:
Preparation for smart contracts launch
MetaMask is the best liaison with the Ethereum world. It proactively wedges into the web browser allowing to interact with Ethereum network by launching Ethereum DApps without full-fledged blockchain node. The plugin also activates the keystore, which allows to conduct comprehensive transactions without understanding what a private key is.
Download, install and log in to your account. Save the mnemonics phrase in case you need to restore the access and keys.
In the upper menu select the network you are going to work with — “Rinkeby Test Network.” If the parish is wealthy, go to Main Ethereum Network.”
Look closer, zero balance on account. So what’s to be done?
Since it’s a test network, you can get a free refill. Go to https://faucet.rinkeby.io/. You can see that you need to complete a simple task. Copy your account address from Metamask plugin and paste into the post field, for example, Google+ ( https://plus.google.com) , fortunately this social network died long time ago. Copy the link to faucet form and choose — what the hell — as much as 3 days.
Here is how it looked for me:
Now wait until the virtual currency hits your account wishing that a test network is in no way different from the real Ethereum, meaning 18.75 Ether is nearly … $$$$$
Look, our friend Google has recently added a cryptocurrency calculator to its engine. Enter into the search field — 18.75 ETH to USD.
Launching contract in the Network
Let’s get back to the editor: http://remix.ethereum.org. Look through the Contract carefully not to miss any critical (red) mistake.
Choose the bookmark on the right — Run, Environment option and select “Injected Web Rinkeby” using mouse — this is an active MetaMask account.
Make sure your account has pulled in from MetaMask with non-zero balance by checking Account field.
Click on Deploy button, MetaMask window will pop up showing transaction details for contract creation. Click on the green Submit button and confirm transaction.
In the open MetaMask choose the last transaction for “SEND” section and go to transaction record on etherscan.io. Use my link to etherscan as an example. If you were able to see Success as in the screenshot below — Congrats, your CryptoChurch just went live!
Then go to remix editor and train to donate money to make sure gatherDonation() function works.
For training purposes, you can transfer 0.11 ether to my contact — thus I’ll know that you’ve read my article. Reminder — this is a test network.
Don’t forget that all transactions require MetaMask confirmation. Now, it’s all set up and you can launch the CryptoChurch.
It’s still too early to reveal — there is one very important aspect to be addressed.
Probably, the worshiper will try to transfer the money directly to the smart contract address instead of donating (as in bringing them straight to the church). The current configuration won’t let that happen. As an exception, you can use the priest address.
What if someone wants to donate anonymously, without making the lists? Or what is a person wants to transfer a small amount which can’t get through the limits of donation collection? Then you need add a special function that will allow one to transfer directly to the smart contract.
Final editing, we check the smart contract, hit Deploy and confirm the operation in the popup MetaMask window.
Go to MetaMask, SEND section, last operation — on the website with the last transaction log for smart contract creation. Here is how it looks for me:
Then we go the Contract and look for the desirable“Success” word.
You can have a look at my example here.
Have you managed to launch? If so, congrats on opening your СryptoChurch!
Transparency of transactions
We’re talking about Blockchain, right? It means that everything should be transparent!
Upload your contract’s text to etherscan in Code section where the worshipers can see how the contract works and check the source code. I won’t go into detail because I believe that you can make it. See my source code as an example — you’ll need to achieve a green tick Code and publicly accessible contract’s source code.
Remember that it’s a public Blockchain, which means that a savvy worshiper can see the transaction details and check the balance of CryptoChurch anytime.
- CryptoChurch is a simple in its creation and maintenance tool.
- The funds will be transferred to the Church’s account and not that of a priest.
- The transactions are full transparent and the smart contract is available for monitoring.
- The worshipers can donate money that come from mining or cryptotrading.
Good luck to all and stay in a good mood! Be in touch and visit Digital Data Science and Analytics Agency website.
If you enjoyed my article, feel free to like, comment and share. Thank you!