RecordsKeeperRubyLib 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,29 @@
1
+ # config.yaml
2
+ network:
3
+ url: testurl
4
+ rkuser: rkuser
5
+ passwd: rkpwd
6
+ chain: test-chain
7
+ port: testport
8
+ stream: streamname
9
+ testdata: test_data
10
+ amount: test_amount
11
+ dumptxid: test_txid
12
+ privatekey: test_privkey
13
+ validaddress: valid_address
14
+ invalidaddress: invalid_address
15
+ miningaddress: mining_address
16
+ nonminingaddress: nonmining_address
17
+ multisigaddress: multisig_address
18
+ wrongimportaddress: wrongimport_address
19
+ mainaddress: main_address
20
+ permissionaddress: permission_address
21
+ dumptxhex: dump_txhex
22
+ dumpsignedtxhex: dump_signedtxhex
23
+ samplegetmultisigaddress: sample_multisigaddress
24
+ samplemerkleroot: sample_merkleroot
25
+ sampleblockhash: sample_blockhash
26
+ sampledata: sample_data
27
+ sampletransac: sample_transaction_id
28
+ transactionid: transaction_id
29
+ sampletxid: sample_txid
@@ -0,0 +1,29 @@
1
+ # config.yaml
2
+ network:
3
+ url: testurl
4
+ rkuser: rkuser
5
+ passwd: rkpwd
6
+ chain: test-chain
7
+ port: testport
8
+ stream: streamname
9
+ testdata: test_data
10
+ amount: test_amount
11
+ dumptxid: test_txid
12
+ privatekey: test_privkey
13
+ validaddress: valid_address
14
+ invalidaddress: invalid_address
15
+ miningaddress: mining_address
16
+ nonminingaddress: nonmining_address
17
+ multisigaddress: multisig_address
18
+ wrongimportaddress: wrongimport_address
19
+ mainaddress: main_address
20
+ permissionaddress: permission_address
21
+ dumptxhex: dump_txhex
22
+ dumpsignedtxhex: dump_signedtxhex
23
+ samplegetmultisigaddress: sample_multisigaddress
24
+ samplemerkleroot: sample_merkleroot
25
+ sampleblockhash: sample_blockhash
26
+ sampledata: sample_data
27
+ sampletransac: sample_transaction_id
28
+ transactionid: transaction_id
29
+ sampletxid: sample_txid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RecordsKeeperRubyLib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusra Qureshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-06 00:00:00.000000000 Z
11
+ date: 2018-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -141,27 +141,19 @@ files:
141
141
  - RecordsKeeperRubyLib.gemspec
142
142
  - bin/console
143
143
  - bin/setup
144
- - config.yaml
145
- - docs/address_doc.rb
146
- - docs/asset_doc.rb
147
- - docs/block_doc.rb
148
- - docs/blockchain_doc.rb
149
- - docs/permissions_doc.rb
150
- - docs/stream_doc.rb
151
- - docs/transaction_doc.rb
152
- - docs/wallet_doc.rb
153
144
  - lib/RecordsKeeperRubyLib.rb
154
145
  - lib/RecordsKeeperRubyLib/address.rb
155
146
  - lib/RecordsKeeperRubyLib/assets.rb
156
147
  - lib/RecordsKeeperRubyLib/block.rb
157
148
  - lib/RecordsKeeperRubyLib/blockchain.rb
158
- - lib/RecordsKeeperRubyLib/config.yaml
159
149
  - lib/RecordsKeeperRubyLib/permissions.rb
150
+ - lib/RecordsKeeperRubyLib/sample_config.yaml
160
151
  - lib/RecordsKeeperRubyLib/stream.rb
161
152
  - lib/RecordsKeeperRubyLib/transaction.rb
162
153
  - lib/RecordsKeeperRubyLib/version.rb
163
154
  - lib/RecordsKeeperRubyLib/wallet.rb
164
- - lib/config.yaml
155
+ - lib/sample_config.yaml
156
+ - sample_config.yaml
165
157
  homepage: https://github.com/RecordsKeeper
166
158
  licenses:
167
159
  - MIT
@@ -182,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
174
  version: '0'
183
175
  requirements: []
184
176
  rubyforge_project:
185
- rubygems_version: 2.4.5.2
177
+ rubygems_version: 2.7.7
186
178
  signing_key:
187
179
  specification_version: 4
188
180
  summary: RecordsKeeper-SDK-Ruby
data/config.yaml DELETED
@@ -1,8 +0,0 @@
1
- # config.yaml
2
-
3
- url: testurl
4
- rkuser: rkuser
5
- passwd: rkpwd
6
- chain: test-chain
7
- port: testport
8
-
data/docs/address_doc.rb DELETED
@@ -1,105 +0,0 @@
1
- # = Address Class Usage
2
- # This is a library to work with RecordsKeeper block information.
3
- # You can generate new address, check all addresses, check address validity, check address permissions, check address balance by using Address class. You just have to pass parameters to invoke the pre-defined functions.
4
- # ---------
5
- # == Libraries
6
- # Require these ruby libraries first to get started with the functionality.
7
- # require 'rubygems'
8
- # require 'httparty'
9
- # require 'json'
10
- # require 'binary_parser'
11
- # require 'yaml'
12
- # -----------------
13
- # == Create Connection
14
- # Entry point for accessing Address class resources.
15
- # * URL: Url to connect to the chain ([RPC Host]:[RPC Port])
16
- # * Chain-name: chain name
17
- # cfg = YAML::load(File.open('sample_config.yaml','r')) # Loads the configuration file
18
- # * Set a *network* value.
19
- # network = cfg['network'] # Network variable to store the network that you want to access
20
- # * Set url and chain name:
21
- # @url = cfg['network']['url']
22
- # @chain = cfg['network']['chain']
23
- # -------------------
24
- # == Node Authentication
25
- # Import values from config file.
26
- # * User name: The rpc user is used to call the APIs.
27
- # * Password: The rpc password is used to authenticate the APIs.
28
- # * Set the rpc username and password:
29
- # @user = cfg['network']['rkuser']
30
- # @password = cfg['network']['passwd']
31
- # Now we have node authentication credentials.
32
- # ------------
33
- # = class Address
34
- # Address class is used to call address related functions like generate new address, list all addresses and no of addresses on the node’s wallet, check if given address is valid or not, check if given address has mining permission or not and check a particular address balance on the node functions which are used on the RecordsKeeeper Blockchain.
35
- # === 1. getAddress
36
- # This function generates a new address on the node wallet.
37
- # getAddress
38
- # newAddress = getAddress # Function call
39
- #
40
- # puts newAddress # prints a new address
41
- # === 2. getMultisigAddress nrequired, key
42
- # This function generates a new multisignature address.
43
- #
44
- # You have to pass these two arguments to the getMultisigAddress function call:
45
- # * nrequired: To pass the no of signatures that are a must to sign a transaction.
46
- # * key: To pass any number of comma-separated public addresses that are to be used with this multisig address as a single variable.
47
- # getMultisigAddress nrequired, key
48
- # newAddress = getMultisigAddress nrequired, key # Function call
49
- #
50
- # puts newAddress # prints a new address
51
- # === 3. getMultisigWalletAddress nrequired, key
52
- # This function generates a new multisignature address on the node's wallet.
53
- #
54
- # You have to pass these two arguments to the getMultisigWalletAddress function call:
55
- # * nrequired: This variable is required to pass the number of signatures that are a must to sign a transaction.
56
- # * key: This variable is required to pass a string of comma-separated public addresses that are to be used with this multisig address as a single variable.
57
- # getMultisigWalletAddress nrequired, key
58
- # newAddress = getMultisigWalletAddress nrequired, key # Function call
59
- #
60
- # puts newAddress #prints a new address
61
- # === 4. retrieveAddresses
62
- # To list all the addresses and number of addresses on the node's wallet
63
- # retrieveAddresses
64
- # retrievedinfo = JSON.parse retrieveAddresses # Function call
65
- #
66
- # puts retrievedinfo['address'] # prints all the addresses of the wallet
67
- # puts retrievedinfo['address_count'] # prints the count of addresses in the wallet
68
- # === 5. checkifValid address
69
- # To check validity of the address
70
- #
71
- # You have to pass address as argument to the checkifValid function call:
72
- # * Address: To check its validity.
73
- # checkifValid
74
- # addressC = checkifValid address # Function call
75
- #
76
- # puts addressC # prints validity
77
- # === 6. checkifMineAllowed address
78
- # To check if given address has mining permission or not
79
- #
80
- # You have to pass address as argument to the checkifMineAllowed function call:
81
- # * Address: To check the permission status
82
- # checkifMineAllowed address
83
- # permissionCheck = checkifMineAllowed address # Function call
84
- #
85
- # puts permissionCheck # prints permission status of the given address
86
- # === 7. checkBalance address
87
- # To check address balance on a particular node
88
- #
89
- # You have to pass address as argument to the checkifMineAllowed function call:
90
- # * Address: To check the balance
91
- # checkBalance address
92
- # address_balance = checkBalance address # Function call
93
- #
94
- # puts address_balance # prints balance of the address
95
- # === 8. importAddress public_address
96
- # To import a non-wallet address on RecordsKeeeper Blockchain
97
- #
98
- # You have to pass address as argument to the importAddress function call:
99
- # * Address: A non-wallet address to import on a particular node
100
- # importAddress public_address
101
- # response = importAddress public_address # Function call
102
- #
103
- # puts response # prints response
104
- class Address
105
- end
data/docs/asset_doc.rb DELETED
@@ -1,54 +0,0 @@
1
- # = Assets Class Usage
2
- # This is a library to work with RecordsKeeper assets.
3
- # You can create new assets and list all assets by using Assets class. You just have to pass parameters to invoke the pre-defined functions.
4
- # ---------
5
- # == Libraries
6
- # Require these ruby libraries first to get started with the functionality.
7
- # require 'rubygems'
8
- # require 'httparty'
9
- # require 'json'
10
- # require 'binary_parser'
11
- # require 'yaml'
12
- # -----------------
13
- # == Create Connection
14
- # Entry point for accessing Address class resources.
15
- # * URL: Url to connect to the chain ([RPC Host]:[RPC Port])
16
- # * Chain-name: chain name
17
- # cfg = YAML::load(File.open('sample_config.yaml','r')) # Loads the configuration file
18
- # * Set a *network* value.
19
- # network = cfg['network'] # Network variable to store the network that you want to access
20
- # * Set url and chain name:
21
- # @url = cfg['network']['url']
22
- # @chain = cfg['network']['chain']
23
- # -------------------
24
- # == Node Authentication
25
- # Import values from config file.
26
- # * User name: The rpc user is used to call the APIs.
27
- # * Password: The rpc password is used to authenticate the APIs.
28
- # * Set the rpc username and password:
29
- # @user = cfg['network']['rkuser']
30
- # @password = cfg['network']['passwd']
31
- # Now we have node authentication credentials.
32
- # ------------
33
- # = class Assets
34
- # Assets class is used to call assets related functions like create assets and list assets functions which are used on the RecordsKeeeper Blockchain.
35
- # === 1. createAsset
36
- # This function is used to create or issue an asset.
37
- # txid = createAsset address, asset_name, asset_qty # Function call
38
- #
39
- # puts txid # prints tx id of the issued asset
40
- # === 2. retrieveAssets
41
- # This function is used to list all assets, no of assets, issued quantity and issued transaction id of all the assets on RecordsKeeper Blockchain.
42
- # retrievedinfo = JSON.parse retrieveAssets # Function call
43
- #
44
- # puts retrievedinfo['asset_name'] # prints all the addresses of the wallet
45
- # puts retrievedinfo['asset_count'] # prints the address count
46
- # puts retrievedinfo['issue_qty'] # prints assets issued quantity
47
- # puts retrievedinfo['issue_id'] # prints assets issued transaction id
48
- # === 3. sendAsset
49
- # This function is used to send an asset.
50
- # txid = sendAsset address, asset_name, asset_qty # Function call
51
- #
52
- # puts txid # prints tx id of the sent asset
53
- class Assets
54
- end
data/docs/block_doc.rb DELETED
@@ -1,63 +0,0 @@
1
- # = Block Class Usage
2
- # This is a library to work with RecordsKeeper block information.
3
- # You can generate new address, check all addresses, check address validity, check address permissions, check address balance by using Address class. You just have to pass parameters to invoke the pre-defined functions.
4
- # ---------
5
- # == Libraries
6
- # Require these ruby libraries first to get started with the functionality.
7
- # require 'rubygems'
8
- # require 'httparty'
9
- # require 'json'
10
- # require 'binary_parser'
11
- # require 'yaml'
12
- # -----------------
13
- # == Create Connection
14
- # Entry point for accessing Address class resources.
15
- # * URL: Url to connect to the chain ([RPC Host]:[RPC Port])
16
- # * Chain-name: chain name
17
- # cfg = YAML::load(File.open('sample_config.yaml','r')) # Loads the configuration file
18
- # * Set a *network* value.
19
- # network = cfg['network'] # Network variable to store the network that you want to access
20
- # * Set url and chain name:
21
- # @url = cfg['network']['url']
22
- # @chain = cfg['network']['chain']
23
- # -------------------
24
- # == Node Authentication
25
- # Import values from config file.
26
- # * User name: The rpc user is used to call the APIs.
27
- # * Password: The rpc password is used to authenticate the APIs.
28
- # * Set the rpc username and password:
29
- # @user = cfg['network']['rkuser']
30
- # @password = cfg['network']['passwd']
31
- # Now we have node authentication credentials.
32
- # ------------
33
- # = class Block
34
- # Block class is used to call block related functions like blockinfo which is used to retrieve block details
35
- # like block's hash value, size, nonce, transaction ids, transaction count, miner address, previous block hash,
36
- # next block hash, merkleroot, blocktime and difficulty of the block for which you have made the query.
37
- # === 1. blockinfo block_height
38
- # * You have to pass the block height as an argument in the blockinfo function call (Block height: Height of the block of which you want to collect information.)
39
- # * It will return transaction ids, transaction count, nonce, size, hash value, previous block's hash value, next block hash value, merkle root, difficulty, blocktime and miner address of the block.
40
- # information = JSON.parse blockinfo block_height # Function call
41
- #
42
- # puts information['tx_count'] # prints transaction count of the block
43
- # puts information['tx'] # prints transaction ids of the block
44
- # puts information['size'] # prints size of the block
45
- # puts information['blockHash'] # prints hash value of the block
46
- # puts information['nonce'] # prints nonce of the block
47
- # puts information['miner'] # prints miner's address of the block
48
- # puts information['nextblock'] # prints next block's hash
49
- # puts information['prevblock'] # prints previous block's hash
50
- # puts information['merkleroot'] # prints merkle root of the block
51
- # puts information['blocktime'] # prints time at which block is mined
52
- # puts information['difficulty'] # prints difficulty of the block
53
- # === 2. retrieveBlocks block_range
54
- # * You have to pass the block's height as the argument to the retrieveBlocks function call (Block range: Range of the block of which you want to collect information)
55
- # * It will return blockhash, miner address, blocktime and transaction count of the blocks.
56
- # information = JSON.parse retrieveBlocks block_range # Function call
57
- #
58
- # puts information['block_hash'] # prints hash of the blocks
59
- # puts information['miner_add'] # prints miner of the blocks
60
- # puts information['block_time'] # prints block time of the blocks
61
- # puts information['txcount'] # prints transaction count of the blocks
62
- class Block
63
- end
@@ -1,77 +0,0 @@
1
- # = Blockchain Class Usage
2
- # This is a library to work with Blockchains in RecordsKeeper.
3
- # You can retrieve information about the chain and node, list all the permissions and the pending transactions and check your node's balance.
4
- # ---------
5
- # == Libraries
6
- # Require these ruby libraries first to get started with the functionality.
7
- # require 'rubygems'
8
- # require 'httparty'
9
- # require 'json'
10
- # require 'binary_parser'
11
- # require 'yaml'
12
- # -----------------
13
- # == Create Connection
14
- # Entry point for accessing Address class resources.
15
- # * URL: Url to connect to the chain ([RPC Host]:[RPC Port])
16
- # * Chain-name: chain name
17
- # cfg = YAML::load(File.open('sample_config.yaml','r')) # Loads the configuration file
18
- # * Set a *network* value.
19
- # network = cfg['network'] # Network variable to store the network that you want to access
20
- # * Set url and chain name:
21
- # @url = cfg['network']['url']
22
- # @chain = cfg['network']['chain']
23
- # -------------------
24
- # == Node Authentication
25
- # Import values from config file.
26
- # * User name: The rpc user is used to call the APIs.
27
- # * Password: The rpc password is used to authenticate the APIs.
28
- # * Set the rpc username and password:
29
- # @user = cfg['network']['rkuser']
30
- # @password = cfg['network']['passwd']
31
- # Now we have node authentication credentials.
32
- # ------------
33
- # = class Blockchain
34
- # Blockchain class is used to call blockchain related functions to retrieve information about the chain and node, list all the permissions and the pending transactions and check your node's balance.
35
- # === 1. getChainInfo
36
- # This function retrieves information about the chain.
37
- # getChainInfo
38
- # chainInfo = JSON.parse getChainInfo # Function call
39
- #
40
- # puts chainInfo['chain_protocol'] # prints chain-protocol
41
- # puts chainInfo['chain_description'] # prints chain-description
42
- # puts chainInfo['root_stream'] # prints root-stream-name
43
- # puts chainInfo['max_blocksize'] # prints maximum-block-size
44
- # puts chainInfo['default_networkport'] # prints default-network-port
45
- # puts chainInfo['default_rpcport'] # prints default-rpc-port
46
- # puts chainInfo['mining_diversity'] # prints mining-diversity
47
- # puts chainInfo['chain_name'] # prints chain-name
48
- # === 2. getNodeInfo
49
- # This function retrieves information related to your node.
50
- # getNodeInfo
51
- # nodeInfo = JSON.parse getNodeInfo # Function call
52
- #
53
- # puts nodeInfo['node_balance'] # prints balance
54
- # puts nodeInfo['synced_blocks'] # prints synced-blocks
55
- # puts nodeInfo['node_address'] # prints nodeaddress
56
- # puts nodeInfo['difficulty'] # prints difficulty
57
- # === 3. permissions
58
- # This function lists all the permissions.
59
- # permissions
60
- # listpermissions = permissions # Function call
61
- #
62
- # puts listpermissions # Prints the list of permissions.
63
- # === 4. getpendingTransactions
64
- # This function retrieves information related to your node.
65
- # getpendingTransactions
66
- # pentransac = JSON.parse getpendingTransactions # Function call
67
- #
68
- # puts pentransac['tx_count'] # prints transaction count
69
- # puts pentransac['tx'] # prints the pending transactions
70
- # === 5. checkNodeBalance
71
- # This function retrieves information related to your node.
72
- # checkNodeBalance
73
- # nodeBal = checkNodeBalance # Function call
74
- #
75
- # puts nodeBal # Prints node's balance amount.
76
- class Blockchain
77
- end
@@ -1,54 +0,0 @@
1
- # = Permissions Class Usage
2
- # This is a library to work with RecordsKeeper permissions.
3
- # You can grant and revoke permissions like connect, send, receive, create, issue, mine, activate, admin by using Assets class. You just have to pass parameters to invoke the pre-defined functions.
4
- # ---------
5
- # == Libraries
6
- # Require these ruby libraries first to get started with the functionality.
7
- # require 'rubygems'
8
- # require 'httparty'
9
- # require 'json'
10
- # require 'binary_parser'
11
- # require 'yaml'
12
- # -----------------
13
- # == Create Connection
14
- # Entry point for accessing Address class resources.
15
- # * URL: Url to connect to the chain ([RPC Host]:[RPC Port])
16
- # * Chain-name: chain name
17
- # cfg = YAML::load(File.open('sample_config.yaml','r')) # Loads the configuration file
18
- # * Set a *network* value.
19
- # network = cfg['network'] # Network variable to store the network that you want to access
20
- # * Set url and chain name:
21
- # @url = cfg['network']['url']
22
- # @chain = cfg['network']['chain']
23
- # -------------------
24
- # == Node Authentication
25
- # Import values from config file.
26
- # * User name: The rpc user is used to call the APIs.
27
- # * Password: The rpc password is used to authenticate the APIs.
28
- # * Set the rpc username and password:
29
- # @user = cfg['network']['rkuser']
30
- # @password = cfg['network']['passwd']
31
- # Now we have node authentication credentials.
32
- # ------------
33
- # = class Permissions
34
- # Permissions class is used to call permissions related functions like grant and revoke permissions for an address functions which are used on the RecordsKeeeper Blockchain.
35
- # === 1. grantPermission address, permissions
36
- # This function is used to grant permissions like connect, send, receive, create, issue, mine, activate, admin to an address on RecordsKeeper Blockchain.
37
- #
38
- # You have to pass these two arguments to the grantPermission function call:
39
- # * Permissions: list of comma-seperated permissions passed as a string
40
- # * Address: to which you have to grant permission
41
- # result = grantPermission address, permissions
42
- #
43
- # puts txid # prints response of the grant permision transaction
44
- # === 2. revokePermission address, permissions
45
- # This function is used to revoke permissions like connect, send, receive, create, issue, mine, activate, admin to an address on RecordsKeeper Blockchain.
46
- #
47
- # You have to pass these two arguments to the grantPermission function call:
48
- # * Permissions: list of comma-seperated permissions passed as a string
49
- # * Address: to which you have to grant permission
50
- # result = revokePermission address, permissions
51
- #
52
- # puts result # prints response of the revoke permision transaction
53
- class Permissions
54
- end