Skip to content

projectpai/pai_smart_node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smartnode

Structure

  • Paicoin node
  • Counterparty node (API server and client)
  • Worker
  • Database (postgres)

Scheme (draft)

alt text

ICO step by step guide

(preliminary)

1. Register ICO

Initial Registration of ICO, intended for creating initial ICO config, register required parameters and saving address of ICO owner That method returns PAI address on which ICO assets will be created, so to issue new asset on that address we nned to have at least (??) 10 PAI coins

2. Send PAI

Send PAI coins on just created address.

3. Issue asset

Create new asset which will be stored on above address

So after that 3 steps are finished we can start receive payments from differend PAI wallets to new created address nad send assets back to contributor. In ICO initial config parameter "auto_payments" is True by default, so if required amount of PAI is on ICO address, assets will be sent to contributor in auto mode. If that parameter is False need to use workers methods:

get_unpaid_transactions

pay_unpaid_transactions

Worker

Uses DevSmartNodeSQS queue

Methods (to be updated)

Register ICO

Saves primary ICO inforamtion

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "register_ico",
      "params": {
        "return_address": "pai_address",
        "quantity": 10000000,
        "asset": "asset_name",
        "quantity": 10000000000,
        "price": 1,
        "start_date": "2018-08-31 12:00:00",
        "end_date": "2018-08-31 12:00:00",
        "hard_cap": 1000000000,
        "soft_cap": 100000000000,
        "details": {
            "description": "Some TRUE description"
         }
      }
    }
}
Parameters:
Parameter Description
return_address address where income PAIcoins will be transfers
quantity *preliminary number of required tokens
asset short asset name (BTC,XCP,PAI - not allowed)
price desired token price token/pai
start_date **ICO start date
end_date **ICO end date
hard_cap ICO hard cap
soft_cap ICO soft cap
details Optional parameter, saves any additional ICO info

*that can be changed during asset issuance
**transactions before start and after end dates are not accepted and not saved

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "source_address": "source_address"
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}
Get ICO info

Get information about ICO

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "get_ico_info",
      "params": {
        "source": "pai_address_associated_with_ico"
      }
    }
}

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "ico_info": "ico_info_json"
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}
List of all ICO

Get information about all ICO

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "list_ico",
    }
}

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "ico_list": ["ico_list"]
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}
Issue new asset

Create new asset

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "issuance",
      "params": {
        "source": "address",
        "quantity": 10000000,
        "asset": "BTC",
        "description": "description of new asset",
        "fee": 10000
      }
    }
}
Parameter Description
asset short asset name (BTC,XCP,PAI - not allowed)
quantity *preliminary number of required tokens
source *pai address
description short description of asset
fee fee for PAI miners

*address generated by smart node and got in register_ico method

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "signed_tx_hex": "signed_hex"
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}
Get unpaid transactions

Returns list of all unpaid transactions

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "get_unpaid_transactions",
      "params": {
        "ico": "ico_name",
        "params": [params]
      }
    }
}

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "unpaid_transactions": ["transactions_list"]
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}
Pay unpaid transactions

Send required amount of asset to contributor

Example SQS message

{
    "redisData": {
      "redisChannel": "id"
    },
    "input": {
      "method": "pay_unpaid_transactions",
      "params": {
        [transactions_list]
      }
    }
}

Output

{
  "SmartWorker": {
    "status": {
      "status": "SUCCESS",
      "progress": 100,
      "message": "Finished worker"
    },
    "output": {
      "response": {
          "paid_transactions": ["paid_transactiosn_list_with_txids"]
      }
    },
    "worker_data": {
      "workerIpAddress": "172.31.27.70",
      "workerEnvironment": "Environment"
    }
  }
}

Releases

No releases published

Packages

No packages published

Languages