Coder Social home page Coder Social logo

solidity-license-example's Introduction

Solidity License Example

DOI | MythXBadge | Main Workflow

This repository contains a license example to complement my thesis work on comparing formalisms for representation of computable contracts. It uses the brownie framework for tests and can be easily extended with a user interface, however this is only partially present due to time constraints. Please note, this is not meant to be used or deployed anywhere, as for example it purposefully does not use any ERC-721 or similar standards that would make it compatible with other blockchain systems, but instead I aimed for similarity to example contract text and the other examples.

Installation (based on brownie react mix and rimble ui)

  1. Install Brownie, if you haven't already. You must be using version 1.9.0 or newer.

  2. Download the mix.

    brownie bake react-mix
  3. Install the React client dependencies.

    cd client
    yarn install
  4. In MetaMask or another web3 browser extension, load the following seed phrase:

    hill law jazz limb penalty escape public dish stand bracket blue jar

    These accounts will automatically be funded.

Usage

  1. Open the Brownie console. Starting the console launches a fresh Ganache instance in the background.

    $ brownie console
    Brownie v1.9.0 - Python development framework for Ethereum
    
    ReactMixProject is the active project.
    Launching 'ganache-cli'...
    Brownie environment is ready.
  2. Run the deployment script to deploy the project's smart contracts.

    >>> run("deploy")
    Running 'scripts.deploy.main'...
    Transaction sent: 0xd1000d04fe99a07db864bcd1095ddf5cb279b43be8e159f94dbff9d4e4809c70
    Gas price: 0.0 gwei   Gas limit: 6721975
    SolidityStorage.constructor confirmed - Block: 1   Gas used: 110641 (1.65%)
    SolidityStorage deployed at: 0xF104A50668c3b1026E8f9B0d9D404faF8E42e642
    
    Transaction sent: 0xee112392522ed24ac6ab8cc8ba09bfe51c5d699d9d1b39294ba87e5d2a56212c
    Gas price: 0.0 gwei   Gas limit: 6721975
    VyperStorage.constructor confirmed - Block: 2   Gas used: 134750 (2.00%)
    VyperStorage deployed at: 0xB8485421abC325D172652123dBd71D58b8117070
  3. While Brownie is still running, start the React app in a different terminal.

    # make sure to use a different terminal, not the brownie console
    cd client
    yarn start
  4. Connect Metamask to the local Ganache network. In the upper right corner, click the network dropdown menu. Select Localhost 8545, or:

    New Custom RPC
    http://localhost:8545
  5. Interact with the smart contracts using the web interface or via the Brownie console.

    # get the newest vyper storage contract
    >>> vyper_storage = VyperStorage[-1]
    
    # the default sender of the transaction is the contract creator
    >>> vyper_storage.set(1337)

    Any changes to the contracts from the console should show on the website after a refresh, and vice versa.

Ending a Session

When you close the Brownie console, the Ganache instance also terminates and the deployment artifacts are deleted.

To retain your deployment artifacts (and their functionality) you can launch Ganache yourself prior to launching Brownie. Brownie automatically attaches to the ganache instance where you can deploy the contracts. After closing Brownie, the chain and deployment artifacts will persist.

Further Possibilities

Testing

To run the test suite:

brownie test

Deploying to a Live Network

To deploy your contracts to the mainnet or one of the test nets, first modify scripts/deploy.py to use a funded account.

Then:

brownie run deploy --network kovan

Replace kovan with the name of the network you wish you use. You may also wish to adjust Brownie's network settings.

For contracts deployed on a live network, the deployment information is stored permanently unless you:

  • Delete or rename the contract file or
  • Manually remove the client/src/artifacts/ directory

Resources

This mix provides a bare-bones implementation of Create React App, configured to work with Brownie.

To get started with React and building a front-end for your dApps:

  • Rimble is an open-source library of React components and guides to help you make dApps. Along with components they provide guides and tutorials to help you get started.
  • For more in-depth information, read the Create React App documentation

To get started with Brownie:

Any questions? Join our Gitter channel to chat and share with others in the community.

solidity-license-example's People

Contributors

step21 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.