Examples
Warning
WARNING! This package is deprecated and is no longer maintained and supported.
Initialization
1using ArkEcosystem.Client;2using ArkEcosystem.Client.API;3 4static void Main(string[] args)5{6 ConnectionManager.Connect(new Connection("http://my.node.ip:port/api/", "main"))7}
Blocks
This service API grants access to the blocks resource . A block is a signed set of transactions created by a delegate and permanently committed to the ARK blockchain.
It is not possible to
POST
a block through the public API. Relay Nodes accept only blocks posted by a delegate at the correct time through the internal API.
List All Blocks
1var blocks = ConnectionManager.Connection("main").Api.Blocks.All();2 3>>> {'meta': {'count': 10, ... }}
Retrieve a Block
1var block = ConnectionManager.Connection("main").Api.Blocks.Show("validBlockId");2 3 4>>> {'data': {'id': 'validBlockId' ... }}
List All Transactions of a Block
1var blockTransactions = ConnectionManager.Connection("main").Api.Blocks.Transactions("validBlockId");2 3>>> {'meta': {'count': 10, ... }}
Search All Blocks
1var parameters = new Dictionary<string, string> {2 {"id": "validBlockId"}3}4var searchedBlocks = ConnectionManager.Connection("main").Api.Blocks.Search(parameters);5 6>>> {'meta': {'count': 100, ... }}
Delegates
The client SDK can be used to query the delegate resource .
A delegate is a regular wallet that has broadcast a registration transaction, acquired a sufficient number of votes, and has a Relay Node configured to forge new blocks through a forger
module. At any time only 51 delegates are active. They are cost-efficient miners running the ARK network.
Voters are wallets which have broadcast a vote transaction on a delegate. A vote remains active until an un-vote transaction is sent (it does not have to be recast unless a wallet wishes to change from delegate). Voting for a delegate does not give the delegate access to the wallet nor does it lock the coins in it.
List All Delegates
1var delegates = ConnectionManager.Connection("main").Api.Delegates.All();2 3>>> {'meta': {'count': 20, ... }}
Retrieve a Delegate
1var delegate = ConnectionManager.Connection("main").Api.Delegates.Show("validId");2 3>>> {'data': {'username': 'delegateName', ... }}
List All Blocks of a Delegate
1var delegateBlocks = ConnectionManager.Connection("main").Api.Delegates.Blocks("validId");2 3>>> {'meta': {'count': 100, ... }}
List All Voters of a Delegate
1var delegateVoters = ConnectionManager.Connection("main").Api.Delegates.voters("validId");2 3>>> {'meta': {'count': 10, ... }}
Node
The ARK network consists of different anonymous nodes (servers), maintaining the public ledger, validating transactions and blocks and providing APIs. The node resource allows for querying the health and configurations of the node used by the instantiated client.
Retrieve the Configuration
1var nodeConfiguration = ConnectionManager.Connection("main").Api.Node.Configuration();2 3>>> {'data': {'nethash': '6e84d08bd299ed97c212c886c98a57e36545c8f5d645ca7eeae63a8bd62d8988', ... }}
Retrieve the Status
1var nodeStatus = ConnectionManager.Connection("main").Api.Node.Status();2 3>>> {'data': {'synced': True, 'now': 6897158, 'blocksCount': -1}}
Retrieve the Syncing Status
1var nodeSyncingStatus = ConnectionManager.Connection("main").Api.Node.Syncing();2 3>>> {'data': {'syncing': False, 'blocks': -1, 'height': 6897160, 'id': '12905037940821862953'}}
Peers
Each node is connected to a set of peers, which are Relay or Delegate Nodes as well. The peers resource provides access to all peers connected to our node.
Peers have made their Public API available for use; however for mission-critical queries and transaction posting you should use a node which is under your control. We provide a guide to setting up a Relay Node here .
List All Peers
1var peers = ConnectionManager.Connection("main").Api.Peers.All();2 3>>> {'meta': {'count': 100, ... }}
Retrieve a Peer
1var peer = ConnectionManager.Connection("main").Api.Peers.Show("validIpAddress");2 3>>> {'data': {'count': 20, ... }} # Need to changes
Transactions
The heart of any blockchain is formed by its transactions; state-altering payloads signed by a wallet. Most likely you will be querying for transactions most often, using the transaction resource .
A transaction is the only object which may be posted by a non-delegate. It requires a signature from a wallet containing a sufficient amount of ARK.
Create a Transaction
1var parameters = new Dictionary<string, dynamic> 2{ 3 { 4 "amount: 1, 5 ... 6 } 7}; 8 9var transaction = ConnectionManager.Connection("main").Api.Transactions.Create(parameters);10 11>>> ...
Retrieve a Transaction
1var transaction = ConnectionManager.Connection("main").Api.Transactions.Show("validId");2 3>>> ...
List All Transactions
1var transactions = ConnectionManager.Connection("main").Api.Transactions.All();2 3>>> {'meta': {'count': 10, ... }}
List All Unconfirmed Transactions
1var unconfirmedTransactions = ConnectionManager.Connection("main").Api.Transactions.AllUnconfirmed();2 3>>> {'meta': {'count': 10, ... }}
Get Unconfirmed Transaction
1var unconfirmedTransaction = ConnectionManager.Connection("main").Api.Transactions.ShowUnconfirmed("validId");2 3>>> ...
Search Transactions
1var parameters = new Dictionary<string, string>2{3 {4 "amount", 15 }6};7var searchedTransactions = ConnectionManager.Connection("main").Api.Transactions.Search(parameters);8 9>>> {'meta': {'count': 10, ... }}
List Transaction Types
1var transactionTypes = ConnectionManager.Connection("main").Api.Transactions.Types();2 3>>> {"data":{...}}
Votes
A vote is a transaction sub-type, where the asset
field contains a votes
object and the transaction.type
is 3
.
List All Votes
1var votes = ConnectionManager.Connection("main").Api.Votes.All();2 3>>> {'meta': {'count': 10, ... }}
Retrieve a Vote
1var vote = ConnectionManager.Connection("main").Api.Votes.Show("validId");2 3>>> {'data': {...}}
Wallets
The wallet resource provides access to:
- Wallets.
- Incoming and outgoing transactions per wallet.
- Each wallet’s votes.
Retrieve All Wallets
1var wallets = ConnectionManager.Connection("main").Api.Wallets.All();2 3>>> {'meta': {'count': 10, ... }}
Retrieve a Wallet
1var wallet = ConnectionManager.Connection("main").Api.Wallets.Show("validId");2 3>>> {'data': {'address': 'validWalletAddress' ... }}
List All Transactions of a Wallet
1var walletTransactions = ConnectionManager.Connection("main").Api.Wallets.Transactions("validId");2 3>>> {'meta': {'count': 10, ... }}
List All Received Transactions of a Wallet
1var receivedTransactions = ConnectionManager.Connection("main").Api.Wallets.ReceivedTransactions();2 3>>> {'meta': {'count': 10, ... }}
List All Sent Transactions of a Wallet
1var sentTransactions = ConnectionManager.Connection("main").Api.Wallets.SentTransactions();2 3>>> {'meta': {'count': 10, ... }}
List All Votes of a Wallet
1var walletVotes = ConnectionManager.Connection("main").Api.Wallets.Votes();2 3>>> {'meta': {'count': 10, ... }}
List All Top Wallets
1var topWallets = ConnectionManager.Connection("main").Api.Wallets.Top();2 3>>> {'meta': {'count': 10, ... }}
Search All Wallets
1var parameters = new Dictionary<string, string> 2{ 3 { 4 "username", "dummy" 5 } 6}; 7 8var searchedWallets = ConnectionManager.Connection("main").Api.Wallets.Search(parameters); 9 10>>> {'meta': {'count': 10, ... }}