Blockchain and Ethereum

Ever since I became familiar with blockchain, Ethereum, and smart contracts, I’ve been losing sleep.

I’ve been reading, reading and reading, and finally I was able to use some tools, and they suggested building and deploying some smart contracts using the official Ethereum Wallet client application, also known as the Ethereum Wallet.

I was also able to execute smart contracts using ethereum clients. But I thought, I need to use a better tool to build smart contracts, they’re just Code, so I found I could do it in Visual Studio just like Visual Studio Code.

What do I need to do to build a Smart contract with Visual Studio?

To build Ethereum smart contracts using VisualStudio, you need to find the Solidity extension component in the VisualStudio Marketplace.

The first smart contract project

Once the components have been downloaded, you should have a Solidity development template in Visual Studio, go to File => New Project and select the Smart Contract Project template.

You can see in the Solution Explorer that the template has three smart contract files with the.sol extension so that’s our Solidity files.

Where the payout.sol example looks like this:

contract Payout {
     address Victor;
     address Jim;
     address Kieren;

     mapping (address => uint) ownershipDistribution; 

     function Setup() {
       Victor = 0xaabb;
       Jim    = 0xccdd;
       Kieren = 0xeeff;

       ownershipDistribution[Victor] = 35;
       ownershipDistribution[Jim]  = 35;
       ownershipDistribution[Kieren] = 30;
     }

     function Dividend() { uint bal= this.balance; Victor.send(bal * ownershipDistribution[Victor] / 100); Jim.send(bal * ownershipDistribution[Jim] / 100); Kieren.send(bal * ownershipDistribution[Kieren] / 100); }}Copy the code

That’s how you get your first Ethereum smart contract in Visual Studio.

Compile and publish

Here’s how you want to build a smart contract and then compile it.

Right click. Sol file and select Compile:

Now is the time to deploy your smart contract to Ethereum.

To do this, we need to set up the project with blockchain information, so right click on the project and select Properties:

After entering the blockchain password, the blockchain service URL (or RPC URL), you can deploy smart contracts into the network.

Simply right-click on the Smart Contract (.sol file) and select Deploy Smart Contract to Deploy the Smart Contract.

Note: In order for smart contract deployment to work, the Geth console needs to be running on your computer. So, if you are deploying to Testnet, the test chain, open a command prompt and type the following command before clicking Deploy:

geth --testnet
Copy the code

Just so you know. The back-end service of your decentralized application is up and running on the network, and people can execute it as they wish.

other

Interested in querying the smart contract you just deployed to see its transaction details?

You can use the address of the contract you just deployed to go to Testnet on Ethereum using the etherscans. IO site.

The following URL is the one I just deployed:

Note: 0 x061e4d089f5341786fade6277d2a0e9526551500 is smart the public key of the contract.

You will see:

As you can see, every aspect of the contract is 100% transparent to everyone!

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

If you want to get a quick start developing ethereum applications using.net and C#, this course we created will help:

C # the etheric fang

Hui Zhi net original, reproduced please indicate the source. Here is the original text