August 22, 2026

Capitalizations Index – B ∞/21M

Create your first smart contract on the Ethereum Blockchain: Fundraising Contract

Create your first smart contract on the Ethereum Blockchain: Fundraising Contract

It is almost inevitable to escape the term cryptocurrency in today’s world. If you have crawled upon this post, then it is probably certain that you understand that there is more to the Blockchain then cryptocurrencies.

To completely understand this tutorial, it is important to understand what a blockchain even is. If you are already familiar with the topic, feel free to skip ahead, otherwise, I would recommend a quick read here.

Dapps (Decentralized applications) are applications that communicate with the blockchain via “Smart contracts”, typically with a javascript/html frontend living on a centralized server, and a smart contract living in the blockchain. This post will only go over the backend side (smart contract). (Complete Dapp Tutorial coming later)

As this post is not dedicated to general programming, I will not go into details on the programming syntax and logic, however, it is important to know that the only programming language on the Ethereum blockchain with smart contracts is “Solidity”. You can find the docs and more information regarding “Solidity” here.

Ready to start?!
Navigate to remix.ethereum.org which is a web-based solidity compiler which allows us to write and test our smart contracts. You should see something like this:

The first thing we need to do is define which version of solidity we will be using. Type this in at the top of the editor to define the version.

pragma solidity 0.5.6;

Our contract will be called “DappFrundraiser”. All of the code that exists in this contract must live within the two brackets. Also, include an empty constructor which we will use in the next block.

contract DappFundraiser 
}

So what exactly is our contract going to do?

Variables:
owner : who is the contract admin (who deployed it)
contributers: who has contributed to the fundraiser 
contriubterAmount: the amount a user has contributed
miniumContribution: the least amount somebody can contribute
fundingGoal: how much funding does the contract need/want to raise

Functions:
contribute() : contribute to the campaign
getContributionBalance(): see how much funds have been added to the fundraiser from contributors

Now we can add our variables into the contract using the following syntax:

//  address of admin - the one who deployed the contract
address owner;
// addresses of contributers
address[] public contributers;
// address of contributer - also allowing us to see how much was contributed
mapping(address => uint) public contributerAmount;

// minimum amount a user can contribute to the fundraiser
uint public minimumContribution;

//amount of funding needed before contract has reached its goal
uint public fundingGoal;

Solidity comes with a global variable called msg. We will use the following in this contract:
msg.sender (address): sender of the message (current call)
msg.value (uint): number of wei sent with the message

When deploying the contract, the constructor will be called one time, and one time only. This is the perfect opportunity to set the owner (admin), minimum contribution amount, as well as the funding goal for the contract.

pragma solidity 0.5.6;
contract DappFundraiser 
}

Now let’s create the function that allows us to check to contract Ehter balance. This is important because user funds should not be taken if the fundraising goal has already been met! This will act as a helper function in our contract.

function getContributionBalance() external view returns(uint) 

Ok now we are down to the last function before we deploy and test our first smart contract! The last but most import function “contribute()” is responsible for collecting the funds from users, while making sure this rule applies:
* The contribution payment must meet the minimum contribution fund we set in the constructor.

function contribute() external payable 
}

When we put it all together, your contract should look like this:

pragma solidity 0.5.6;
contract DappFundraiser 

function getContributionBalance() external view returns(uint)

function contribute() external payable
}
}

Now it is time to compile our smart contract and test it out. To do this, select the 0.5.6 compiler on the top right side and then click “compile”. If all goes as planned, you should see a green box on the middle of the screen on the right side with the contract name. See screenshot below:

Before doing anything, change your environment to the Javascript VM (see image below)
To deploy the contract, you must enter in the two parameters we included in our constructor (minimumcontribution, and fundingGoal). After these two parameters have been entered in the deploy section, press “transact”. You just deployed your first contract!

You should now see a tab under with the contract name “DappFundraiser”. Click the arrow on the left side to open up the contract functions. You will notice that some of the functions are labeled pink, while others are blue. This goes into a much deeper topic in the blockchain involving gas fees. The pink labeled functions are functions that require the blockchain transaction chains to be changed (mining) which require a small transaction fee. To learn more about this, please click here.

To change wallets (users — each wallet belongs to one user, unless of course one user has multiple ethereum wallets), navigate through the accounts dropdown.

When testing the contribute() function, make sure to add the minimum payment in the value section. This is imitating sending (x) amount of ether as a contribution. It is set at 0 every time you click a new function, so make sure to always re-enter the minimum contribution value or more when testing the contribute function :).

Congrats! 
You have just written your very first smart contract. This was just a quick tutorial on how to get started with contracts, however, if you are interested and you would like to learn more, you can always use this contract as a base and add a few more functions to it. A few ideas..
1) Add an end date to the fundraising project
2) Refund users if the goal was not met before the contract deadline
3) Destroy contract upon completion
4) Connect smart contract to a javacsript/html web app and build your first Dapp!

Thanks for reading my post! If you have any questions or comments, I would love to hear from you!
Best regards

Published at Wed, 24 Apr 2019 20:35:44 +0000

Previous Article

Bitcoin [BTC] fraudster becomes ‘one of the first people in the US to be convicted of stealing cryptocurrency’ |

Next Article

Bitcoin Core 0.17.1 Released

You might be interested in …

Nine solid reasons to buy cofound. It (cfi)

NINE SOLID REASONS TO BUY COFOUND.IT (CFI)

NINE SOLID REASONS TO BUY COFOUND.IT (CFI) Sign up for my FREE monthly investment report: http://eepurl.com/dcFGiD *** KuCoin invitation (referral) link: https://www.kucoin.com/#/signup?r=E3LlL7 *** In it for the money on Twitter: https://twitter.com/NitfortheMONEY *** In it for […]

Crypviser’s CVCoin Trades on OpenLedger; Bigger Exchanges Coming

Crypviser has recently finished the token distribution process, allowing the CVCoin token to be traded on the OpenLedger Decentralized Exchange. Plans for centralized exchanges have also been revealed.


Crypviser CVCoin ICO

Crypviser, CVCoin and the ICO

Online privacy is one of the most pressing issues of today’s internet. Although access to privacy-oriented tools continues to improve over time, other applications that do not focus on privacy often present themselves as a more intuitive alternative. Blockchain technology has been on the fringe of financial privacy and now, thanks to the Crypviser project, it may play an important in communications privacy and its mainstream adoption.

Focusing on privacy and end-to-end message encryption, Crypviser is leveraging the advantages provided by the blockchain technology to create an all-in-one network for secure social and business communications. The platform’s native token, CVCoin, will be required in order to interact with the communications platform and for in-chat payments.

CrypViser: Secure Communications

Following a successful Initial Coin Offering (ICO) period, he token distribution process has been completed with campaign participants receiving their CVCoins in the form of a Bitshares-based asset. A previous Facebook post made by the team explains why the BTS blockchain was chosen:

Crypviser chose the Bitshares platform powered by OpenLedger based on its key features, which match Crypvisers technical requirements and ideology. The Bitshares platform is one of the most powerful, secure and scalable blockchain networks available today.

The team has also released some ICO statistics that show just how popular privacy tools can be. The campaign gathered over $3.4 Million in several cryptocurrencies and distributed 5.5 Million CVCoin tokens to roughly 3000 unique investors. Since then, the Crypviser community has grown at an outstanding speed and currently counts with more than 8000 members in various multi-lingual sub communities.

Bitshares & Openledger

Since the Crypviser network will use the Bitshares blockchain, the CVCoin can be freely traded with no counterparty risk on the OpenLedger decentralized exchange. The Facebook post reads:

The Crypviser team believes that the future of exchanges and trade platforms in decentralized blockhchain world belongs the decentralized exchanges.

Although trading hasn’t been officially announced by the Crypviser team, trades are already taking place within the OpenLedger exchange. The team has warned that the prices seen on these “pre-markets” may not reflect the real market price of the CVCoin token, given their low volume and the lack of availability on traditional platforms.

What is next for Crypviser?

What is next for Crypviser?

With the CVCoin token distributed to ICO participants, Crypviser moves on to the next stages of development, including getting the token listed on traditional exchanges. Although the CVCoin is available on the OpenLedger DEX, Crypviser announced a plan which involves starting with the bigger exchanges like Bittrex, Poloniex and Kraken, and moving on to smaller markets like C-CEX and others.

Crypviser will also commence the development of their own wallet which will provide token holders with an intuitive interface for token interaction. Along with the development of a new wallet, they will also launch an official website for the project and the CrypNews media channel, a platform that will feature the latest news in the world of Blockchain Tech & Cryptography.

Further down the line, the team will release an early Alfa version of the Crypvise App for social communication which will be available for to CVCoin ICO early bird participants.

Can Crypviser help shape the future of online privacy? Let us know what you think in the comment section.


Images courtesy of

The post Crypviser’s CVCoin Trades on OpenLedger; Bigger Exchanges Coming appeared first on Bitcoinist.com.