Skip to content

virtualeconomy/cs-v-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cs-v-sdk

C# library for V Systems

Install

  1. To use this SDK, we need .Net framework 4.5.1 or above. If your OS does not have this framework, please download it here.

  2. clone this project

    $ git clone https://github.com/virtualeconomy/cs-v-sdk.git
  3. The external libraries using are under libs folder. Here is source code info:

Usage

Create chain object

  1. For testnet chain:

    using v.systems;
    using v.systems.type;
    
    ...
    
    Blockchain chain = new Blockchain(NetworkType.Testnet, "https://test.v.systems:9922");
  2. For mainnet chain:

    using v.systems;
    using v.systems.type;
    
    ...
    
    Blockchain chain = new Blockchain(NetworkType.Mainnet, "https://wallet.v.systems/api");

Create address object

  1. Create account by seed

    using v.systems;
    using v.systems.type;
    
    ...
    
    Account acc = new Account(NetworkType.Testnet, "<your seed>", 0);
  2. Create account by private key

    using v.systems;
    using v.systems.type;
    
    ...
     
    Account acc = new Account(NetworkType.Testnet, "<base58 private key>");
  3. Create account by public key

    using v.systems;
    using v.systems.type;
    
    ...
     
    Account acc = new Account(NetworkType.Testnet, "<base58 public key>", null);
  4. Create account by address

    using v.systems;
    using v.systems.type;
    
    ...
     
    Account acc = new Account(NetworkType.Testnet, null, "<base58 address>");

Send transaction

  1. Send Payment transaction

    long amount = 1 * Blockchain.V_UNITY;  // Send 1.0 V coin
    PaymentTransaction tx = TransactionFactory.BuildPaymentTx("<recipient address>", amount);
    
    // Usage 1: for hot wallet sending payment transaction
    ITransaction result = acc.SendTransaction(chain, tx);
    
    // Usage 2: for cold wallet signing payment transaction
    string signature = acc.GetSignature(tx);
  2. Send Lease transaction

    long amount = 1 * Blockchain.V_UNITY;  // Lease 1.0 V coin
    LeaseTransaction tx = TransactionFactory.BuildLeaseTx("<recipient address>", amount);
    
    // Usage 1: for hot wallet sending lease transaction
    ITransaction result = acc.SendTransaction(chain, tx);
    
    // Usage 2: for cold wallet signing lease transaction
    string signature = acc.GetSignature(tx);