Code Monkey home page Code Monkey logo

ibm-blockchain / blockchain-vscode-extension Goto Github PK

View Code? Open in Web Editor NEW
267.0 18.0 157.0 345.4 MB

IBM Blockchain Platform extension for Visual Studio Code (this project is no longer active)

Home Page: https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform

License: Other

Shell 0.61% JavaScript 0.46% TypeScript 93.61% Batchfile 0.30% HTML 0.06% Gherkin 1.30% Dockerfile 0.06% SCSS 0.72% Go 0.26% Java 0.38% EJS 2.07% PEG.js 0.04% Jinja 0.12%

blockchain-vscode-extension's Introduction

⚠️ Attention! The IBM Blockchain Platform Extension for VS Code project is no longer active

IBM Blockchain Platform Extension for VS Code

The IBM Blockchain Platform extension helps developers to create, test and debug smart contracts, connect to Hyperledger Fabric environments, and build applications that transact on your blockchain network.

For a step-by-step guide on getting started with the extension's features, access our Beginner Tutorial via our integrated Home page. Alternatively, explore, clone and open the Hyperledger Fabric samples, all without leaving VS Code. For more comprehensive documentation, follow this link

IBP Extension Homepage

Want to learn more about the IBM Blockchain Platform?

Join us for the IBM Blockchain Platform User Series where product and technical experts share their expertise and educate on a specific feature, function or capability of the IBM Blockchain Platform. Get the answers to your questions and engage live with the experts, while ensuring you're leveraging all that the IBM Blockchain Platform has to offer.

Click here to find out more information about the IBM Blockchain Platform User Series webcast!

Click here to schedule a free 1:1 consultation with an IBM Blockchain Platform expert!

Installation

Please visit the Visual Studio Code Marketplace for installation and more details.

Requirements

The first time you install this extension, it will check your system for the prequisites, and guide you to install any that you are missing.

Windows 10, Linux, or Mac OS are currently the supported operating systems. Each of these operating systems have their own additional requirements.

For the full list of requirements that the extension will check for, please refer to the 'Dependency Installation' section at the end of the README.

Smart Contract Development Lifecycle

Please note that all commands contributed by this extension are accessible via the VS Code Command Palette. The commands outlined below are available from burger menus located on the panel headers, or by right-clicking tree items, in the extension's side bar view.

The expected smart contract development lifecycle follows several broad points, all possible entirely within VS Code using this extension:

  1. Creating and packaging a smart contract
  2. Connecting to an instance of Hyperledger Fabric
  3. Deploying a smart contract
  4. Submitting transactions and generating functional-level smart contract tests

Common tasks and how to complete them

Once you have installed the IBM Blockchain Platform VS Code extension, it is possible to access a large set of tutorials using the >View Tutorial Gallery command.

The tutorial gallery is best place to start once you have installed the extension and will teach you mostly everything that you need to know!

Some information on how to complete other undocumented tasks can be found here.

Useful Commands

The IBM Blockchain Platform extension provides an explorer and commands accessible from the Command Palette, for developing smart contracts quickly:

Command Description
Add Environment Add a Hyperledger Fabric instance environment
Add Gateway Add a Hyperledger Fabric instance gateway
Add Identity To Wallet Add an identity into a wallet to be used when connecting to a Hyperledger Fabric gateway
Add Wallet Add a wallet containing identities to be used when connecting to a gateway
Associate A Wallet Associate a wallet with a gateway to be used when connecting
Associate Directory for Transaction Data Associate a directory of transasction data with a smart contract
Associate Identity with a Node Associate an identity with a node to enable the extension to connect to that node
Connect Via Gateway Connect to a Hyperledger Fabric instance using a gateway
Create New Project Create a new smart contract project
Create Identity (register and enroll) Create, register and enroll a new identity from the local Fabric runtime certificate authority
Delete Environment Delete a Hyperledger Fabric instance environment
Delete Identity Delete an identity from a wallet
Delete Gateway Delete a Hyperledger Fabric instance gateway
Delete Package Delete a smart contract package
Deploy Smart Contract Deploy a smart contract package to an environment
Dissociate A Wallet Remove the association between a wallet and a gateway
Dissociate Directory for Transaction Data Remove the association between a directory of transaction data and a smart contract
Disconnect From Environment Disconnect from the environment you're currently connected to
Disconnect From Gateway Disconnect from the blockchain gateway you're currently connected to
Export Connection Profile Export connection profile for a blockchain gateway
Export Package Export a smart contract package to use outside VS Code
Export Wallet Export a wallet to use outside VS Code
Generate Tests for All Smart Contracts Create functional level test files for all contracts
Generate Tests for Smart Contract(s) Create functional level test files for single or multiple contracts
Import a Package Import a smart contract package
Import nodes into environment Import more nodes into an environment
Open Release Notes Open the release notes page
Package Open Project Create a new smart contract package from a project in the Explorer
Remove Wallet Remove a wallet from the Fabric Wallets view
Replace Identity Associated with a Node Replace which identity is associated with a node
Restart Fabric Runtime Restart the local Fabric instance
Start Fabric Runtime Start the local Fabric instance
Stop Fabric Runtime Stop the local Fabric instance
Subscribe to Event Subscribe to an event emitted from a smart contract
Teardown Fabric Environment Teardown the local Fabric runtime (hard reset)
Transact with Smart Contract Submit & evalutate transactions to deployed smart contracts
Upgrade Smart Contract Upgrade an instantiated smart contract
View Homepage View the extensions homepage
View Sample Gallery View the smart contract and application sample gallery
View Prerequisites View the required and optional dependencies on the prerequisites page

Dependency Installation

Click to view installation instructions

The following dependencies are required on all operating systems:

VS Code version can be found by running: code --version

The following dependencies are optional:

Node version can be found by running: node --version

npm version can be found by running: npm --version

If installing Node and npm using a manager such as 'nvm' or 'nodenv', you will need to set the default/global version and restart VS Code for the version to be detected by the Prerequisites page.

Go version can be found by running: go version

Java version can be found by running: java -version

Additional requirements for Windows

  • You are using Windows 10 Pro or Enterprise and have the Anniversary Update 1607

1 Org Local Fabric functionality

This extension can use Docker to run a simple pre-configured local Hyperledger Fabric network on your machine. By default this feature is enabled as we highly recommend using it, however you may disable this feature if required.

You will need the following:

Docker version can be found by running: docker --version

Additional requirements for Windows

  • Docker for Windows is configured to use Linux containers (this is the default)
  • You will need to install OpenSSL v1.0.2 OpenSSL binaries
    • Install the normal version, not the version marked as "light"
    • Install the Win64 version into C:\OpenSSL-Win64 on 64-bit systems

For more information see the 1 Org Local Fabric section.

Additional information

To open the Prerequisites page manually, run the View Prerequisites command inside VS Code from the Command Palette.

Please note: the extension doesn't currently work with the VSCode Remote Development feature, we plan to make this work in the future, follow progress here.

Contact Us

If you have find any problems or want to make suggestions for future features please create issues and suggestions on Github.

Just so you know

The extension uses telemetry reporting to track usage data and help improve future extension versions. Disabling VS Code telemetry reporting also disables the extension's telemetry reporting. For instructions on how to disable telemetry reporting, please visit the Visual Studio Code FAQ

License

The source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file.

This software uses the IBM Plex Sans font licensed under the SIL Open Font License, Version 1.1. Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL

blockchain-vscode-extension's People

Contributors

au-shah avatar cazfletch avatar dependabot[bot] avatar dobicinaitis avatar edmoffatt avatar erin-hughes avatar heatherlp avatar ibmblockchaindev avatar jakeeyturner avatar james-wallis avatar jt-nti avatar justinjdaniel avatar kemi04 avatar korbiniank avatar lehors avatar lesleyannjordan avatar lquintai avatar mastersingh24 avatar mazyblue avatar mbwhite avatar mergify[bot] avatar niv23 avatar nklincoln avatar riehab avatar rthatcher avatar sammyrasha avatar simran-sohanpal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockchain-vscode-extension's Issues

A developer can get syntax highlighting for their smart contract project

Most likely a testing story only; ensure that a smart contract project in JavaScript and Golang has syntax highlighting for the smart contract code. This should be provided by the extensions for the respective programming languages, but those plugins might not be installed out of the box - what happens in this case? Do we need to add documentation to say if you want to write smart contracts in Golang, you must first install the Golang extension?

As a developer I can debug my smart contracts

Can we use the Fabric in development mode to do this?
Can we get the existing programming language extension debug functionality to start the chaincode to connect to a Fabric in development mode?

Add a progress box when loading chaincode languages

in createSmartContractProjectCommands.ts, at the point where it runs yo fabric:chaincode to determine available chaincode languages, add in a progress/loading box so the user knows to wait (there's one implemented in the grpc/dependency code)

A developer can understand the high-level features from the marketplace

As well as being searchable from within VSCode's extensions catalog, published extensions appear in a web marketplace.

The Docker extension is a good example of how these can look:
https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker

The top of the page features the extension icon and a banner colour (already mentioned in #34 ). Below that is a kind of single-page documentation for the extension. The docker one bullet-points some key benefits, then has sections for each of the features that installing it will add to VSCode complete with a selection of looping videos and screenshots.

I'd like us to start working on the catalog page for our extension. Firstly because we're going to need one, and secondly because if we describe what we're planning for it to be in this way then we can show it to people and say "would you download this? If not, what else would you be looking for?" etc.to validate whether we're making an extension folks will want to use!

Before we publish the extension, the GitHub readme seems a great place to do this work. In fact, just look at the GitHub readme for the Docker extension:
https://github.com/microsoft/vscode-docker
(Spoiler: it looks the same as the marketplace page!)

Let's include the highest fidelity we have for anything we want to show in there e.g. if we talk about the "start a new Fabric chaincode project" bit, we could include a video of this actually happening since @Heatherp has already got an implementation of that bit :)
Meanwhile if we're talking about automatically spinning up the local_fabric connection, we could include a screenshot from @simran-sohanpal 's latest mockups.

I'd like us to create the page now, then update it as the project continues - it'll also form an excellent basis to give us a headstart on writing the docs once we know where they are going to live.

A developer can get code completion for their smart contract project

Most likely a testing story only; ensure that a smart contract project in JavaScript and Golang has code completion for the smart contract code. This should be provided by the extensions for the respective programming languages, but those plugins might not be installed out of the box - what happens in this case? Do we need to add documentation to say if you want to write smart contracts in Golang, you must first install the Golang extension?

Also, might require updates on Fabric itself. For example, VS Code will not provide code completion for the fabric-shim module unless it provides a Typescript definition file for those APIs. This team might need to add those into Fabric to enable this functionality.

A developer can cancel creating a connection and carry on where they left off

If while creating a connection the user decides to cancel they can then carry on where they left off. The half created connection will appear in the list but will have appropriate icons to show that it is not complete and it won't let the user connect until it is complete

untitled

Suggested phase 1 behaviour is that abandoning part way through will mean the Connection does not get created (they start again if they want to continue creating it).

Yeoman generator checks don't actually check installed version

npm view generator-fabric version checks npmjs.org to see if the specified package exists, and then returns the latest version of that package. It does not actually check to see if the specified package is installed locally, or if it's the right version - and we need to do both!

npm ls -g --depth=0 generator-fabric will check to see if the specified package is installed locally. We also need to check if it's of a version that is compatible with the extension, e.g. the work in issue #51 will require [email protected] or greater to be installed. We will need to prompt the user that they must upgrade their installed version if this is the case.

A developer can look up how to achieve a given task

Set of tasks in documentation:

Start a new project
Create package
View, Edit, Delete packages
Add a connection
Automatic local Fabric
Specific connection
Remove a connection
Use a connection
Understand the resource tree of a network
Install a smart contract to a peer (using a package)
Instantiate a smart contract on a channel
Test the functions in a deployed smart contract

As a developer I can generate tests for my smart contract project once it's instantiated

A developer can right click on instantiated chaincode and it will generate a test file that has all the skeleton code needed to run integration tests
e.g

describe('myContract', () => {
   before(() => {
        \\ connect to a client based on the connection details from the connection they chose
    });

    describe('myFunction', () => {
         it('should do something useful', () => {
              assert('something', 'something');
         });
    });
});

A developer can launch an editing session from the package view

Opens the source project for editing, only if the source project is available on the users workspace/system (as opposed to editing a package that someone gave to me that I do not have the source for).

From current low-fis:

image

This would mean we need info about where it "came from"... Which does feel kind of weird. Need more thought & discussion to decide whether we want to do this.

Suggest extension installation for devs who don't have it

A developer opening a project that was created using the Fabric VSCode extension should have it suggested that they install said extension if they don't already have it.

(There is apparently a file that can do this!)

We need a better story about why this makes sense! But probably not Phase 1 anyhow.

fix npm version checking for generator_fabric and yo

npm view generator-fabric version returns the latest available version, npm ls -g generator-fabric | grep . returns the globally installed version, fix this in createSmartContractProjectCommand.ts
add a check for ensuring the user has the latest version of generator-fabric (and yo?), update it if they haven't

A developer can use the Fabric extension in their native language

How we enable translation of the Fabric extension, so it can be used in Chinese, Spanish, Pirate?

If we put the infrastructure in place to enable this, then we could potentially crowd source the translations from the community, or try to get some IBM translation budget.

"create fabric project" loads new project in a new window

window's features (e.g. outputChannel or terminal) only accessible via first window
Found during implementing #1
Tried:

openFolder (current implementation, with new window flag set to true)
updateWorkspaceFolders - errors because fabric project isn't a workspace
Probably not fixable because vscode API doesn't allow you to cycle through windows.

Next to try:

making the new window an activation event of the extension
look at alternative activation events once the folder's opened: https://code.visualstudio.com/docs/extensionAPI/activation-events#_activationeventsworkspacecontains
looking at https://code.visualstudio.com/docs/extensionAPI/vscode-api#ExtensionContext and globalState/workplaceState
look at: https://code.visualstudio.com/updates/v1_26#_uri-handler-api

A developer can automatically create a local Fabric runtime

Original content:

  • If they go to add a connection, check whether they have a local Fabric running.
  • If not, offer to create one.
  • Connection name, connection profile, cert, public key can all be automatically set/generated

Update from @EdMoffatt

Low-fi here:

https://xd.adobe.com/view/0bd1f7aa-4358-4526-550b-841b4ba2c81f-7de0/

This is suggesting that ideally we'd like everything to just happen automagically ;) . The logic of what's happening behind the scenes is:

  • Detect that the Fabric docker images that would be running if a local fabric were available aren't there, AND there's no local_fabric connection already configured
  • In that case, offer the option to auto-configure a local_fabric connection
  • When selected, this will pull down the images, start them up, name a new connection local_fabric, generate a connection profile, certificate and private key for it, and use those to complete the connection

One thing we'll need to consider is that this will probably take quite a while to happen! Is there any established convention for operations that take a while once started and don't require any user intervention?

The level of simplicity shown in the lowfi is probably skipping out too much detail, but it gives something to start looking into!

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.