Storage DFMS

Storage DFMS

  • Getting Started
  • CLI
  • Guides
  • API Endpoints
  • Help

›Contract

Nodes

  • Create API node
  • Create API HTTP node

Contract

  • Compose Contract
  • Get Contract
  • List contracts
  • Ammends Contracts
  • Verify Contract
  • Accept Contract
  • Accepted Contract
  • Contract Invites
  • Finish Contract

Drive

  • Add
  • Get
  • Get File by CID
  • Copy
  • Move(Rename)
  • Make Dir
  • Stat
  • List
  • Remove
  • Flush
  • Clear

SuperContract

  • Deploy SuperContract
  • Execute SuperContract
  • SuperContract Results
  • List SuperContracts
  • Get SuperContract
  • SuperContract Executions
  • Deactivate SuperContract

Network

  • Node ID
  • Get Node Addresses
  • Connect to Node
  • Get Connected Peers
  • Disconnect from Node

Different flows

  • Guide of connection lifecycle
  • Guide of contract lifecycle
  • Guide of file lifecycle
  • Guide of SuperContract lifecycle

Compose Contract

Requirements

  • IDE or text editor
  • Have one owner node

Example

Prepare a new 1000MB Drive for 12 months with 5 replicas, but the Drive can start when 3 Storage Replicator Nodes are joined. The reward will be 5000 SM every 1 month. To accept transactions needed 66% to approve.

import (
    "context"
    "fmt"
    "time"

    api "github.com/proximax-storage/go-xpx-dfms-api"
    apihttp "github.com/proximax-storage/go-xpx-dfms-api-http"
    "github.com/proximax-storage/go-xpx-dfms/crypto"
)

func main() {
    // Create a new client API by given addres
    client := apihttp.NewClientAPI("127.0.0.1:63666")

    //Not required. Generate your own private key if you want
    private, _, err := crypto.GenerateEd25519CatapultKey()
    if err != nil {
        panic(err)
    }

    //Compose a new contract
    contract, err := client.Contract().Compose(
        context.TODO(),
        // Required. size of drive
        uint64(1000),
        // Required. Duration of one billing (subscription) period when replicators will get rewards
        time.Hour*24*30,
        // Optional. Genarated private key that will use for drive
        api.PrivateKey(private),
        // Optional. The namber of SO units that will be dived between replicators at the end of
        // billing period. Default valu equals to driveSize*PayedReplicas
        api.SubscriptionPrice(5000),
        // Optional. The number of billing (subscripion) periods
        api.NumberSubscriptionPeriods(12),
        // Optional. The minimal amount of replicators for starting billing (subscripion) periods
        // Default value 3
        api.MinReplicators(3),
        // Optional. The count of wanted (and payed) replicas
        // Default 3
        api.Replicas(5),
        // Optional. The percent for approving any transaction sent by contract account
        // Default 66
        api.PercentApprovers(66),
    )
    //Blocked till contract will have been composed or will have got an error
    if err != nil {
        panic(err)
    }
    fmt.Println(contract)
}
← Create API HTTP nodeGet Contract →
  • Requirements
  • Example
Storage DFMS
Roles
SDNSRNVerifierSC Executor
Built-in Features
DriveSuperContractChallengeRewards
Protocols
Cross-block protocolFair streaming
Algorithms
VerificationConsensus
CLI
dfms-clientdfms-replicatorsupercontracts
Giudes
ContractDriveSupercontractsNetwork
Copyright © 2021 ProximaX