Second State
  • What is Second State
  • BUIDL developer tool
    • Why BUIDL
    • Getting started
      • Develop for Ethereum Classic
      • Develop for CyberMiles
      • Develop for Ethereum
      • MetaMask notes
    • Data-driven DApps
      • Create and index contracts
    • Rule-based smart contract
    • Sharing your DApp
    • Working with BaaS
    • DEMO: A voting dapp
      • DevChain
      • Ethereum Classic
      • CyberMiles
  • Oasis Ethereum ParaTime
    • Getting started
    • Tutorial: publish a decentralized social media post
    • Tutorial: mint and trade your own ERC-20 tokens
    • Tutorial: mint and transfer your own ERC-721(NFT) tokens
    • Ethereum flavored WebAssembly (Ewasm)
  • DevChain
    • Getting started
      • Run an ewasm smart contract
      • CyberMiles ewasm testnet
    • Build
    • Run
    • BaaS
  • Data services for contracts
    • Getting started
    • Start a search engine (Docker)
      • Notes on SSL with Docker
    • Start a search engine (Ubuntu)
    • Demos
  • White Papers
    • Enterprise middleware for blockchain smart contracts
    • Google for smart contracts
    • FairPlay: a new type of DApp
Powered by GitBook
On this page

Was this helpful?

  1. BUIDL developer tool

Getting started

The BUIDL online IDE can create complete DApps (smart contracts + web3 + ElasticSearch + JS + HTML / CSS) in minutes without installing any software.

PreviousWhy BUIDLNextDevelop for Ethereum Classic

Last updated 4 years ago

Was this helpful?

In this section, we will walk through the default example that comes with the IDE. The complete source code for this example is .

Access the BUIDL IDE from your browser:

BUIDL works with the by default. It could also work with any service, as well as any Ethereum compatible blockchains.

Step 1: Create and deploy a simple Solidity smart contract

The contract simply allows you to store a number on the blockchain. You can view or update the stored number by calling its functions get() and set().

Click on the Compile button to compile the contract. A side bar will open to show you the compiled ABI and bytecode of the contract.

Step 2: Create a UI in HTML

Once deployed, click on the dapp button on the left bar to work on your DApp.

The HTML tab above shows a simple HTML page with two buttons.

Step 3: Create JS script to interact with the smart contract

Next, go to the JS tab. It shows JavaScript on how to interact with the smart contract.

The JS has four sections. The first section is Don't modify as it is populated by the BUIDL tool itself. It contains information about the contract you just deployed via BUIDL.

The second section shows you the boilerplate to instantiate the contract and instance objects using data from the first section.

var contract = window.web3 && web3.ss && web3.ss.contract(abi);
var instance = contract && contract.at(cAddr);
window.addEventListener('web3Ready', function() {
  contract = web3.ss.contract(abi);
  instance = contract.at(cAddr);
});

The third section is the event handler for the Set Data button. It shows how to call the smart contract's set() function in a transaction from JavaScript.

document.querySelector("#s").addEventListener("click", function() {
  var n = window.prompt("Input the number:");
  n && instance.set(n);
});

The last section is the event handler for the Get Data button. It calls the smart contract’s get() function and displays the result.

document.querySelector("#g").addEventListener("click", function() {
  console.log(instance.get().toString());
});

Step 4: Run the DApp

Finally, click on the Run button to run the DApp. You will see the DApp UI in the right panel. You can click on the Set Data button to store a number, and Get Data button to retrieve the stored number.

Congratulations. You now have a complete DApp deployed on a public blockchain!

Load in your web browser. You will see a simple smart contract already in the online editor window.

Next, you can press the Deploy to the chain button on the left panel to instantiate and deploy the contract to the . You can interact with deployed contracts by calling its public methods from inside -- you can set its value and click on the Transact button to save the value onto the blockchain, and then click on the Call button to see the value in the LOG panel.

Next, you could explore how to develop more complex DApps on BUIDL, such as or .

BUIDL
Second State DevChain
BUIDL
data driven DApps
rules-based DApps
BUIDL
available here
https://buidl.secondstate.io/
Second State DevChain
blockchain started by the Second BaaS
Watch a 4-min video on how to create your first DApp in BUIDL