BLOCKCHAINIZ LIBRARY
Installation
Simply use NPM with the following command :
npm install blockchainiz2 --save
This will download the package and add an entry in your project's package.json
file.
Setup
In your project's source code, you need to start by importing the blockchainiz package and specify the options you want to use:
const blockchainiz = publicKey: 'your public key' privateKey: 'your private key' url: 'https://url-of-blockchainiz-environnement';
There are 3 options that you can set. You NEED to specify them in order for the package to work:
Option | Type | Description |
---|---|---|
publicKey | string | Your Blockchainiz public key |
privateKey | string | Your Blockchainiz private key |
url | string | The API Blockchainiz url (ask our support to have it) |
License
Blockchainiz Library is distributed under MIT license, see the LICENSE file.
Contacts
Report bugs or suggest features using issue tracker on GitHub.
Account creation
You can ask an account (note that validation of your sandbox/production account can take a few days, so think about doing it in advance of when you actually want to go live).
Sample usage
Get Information about Ethereum Node
blockchainiz;
Response
compilerVersion: solc: version: '0.4.21+commit.dfe3193c.Linux.g++' etherPrice: EUR: 42383 USD: 49263 gasPrice: fast: 12000000000 slow: 5000000000 standard: 6000000000 timestamp: 1529323176534
Post an Ethereum contract
blockchainiz;
Response
id: '5b27a100b989df001152e02e' walletAddress: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx'
Get the Ethereum contracts list
blockchainiz;
Response
id: '5a9e5ac283490f0011d87293' abi: Object Object Object Object Object status: 'mined' address: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' language: 'solidity' parameters: '3' name: 'Ballot' gasPriceInWei: 26000000000 infosCompilation: '1:1: Warning: Source file does not specify required compiler version!Consider adding "pragma solidity ^0.4.19;"\ncontract Ballot {\n^\nSpanning multiple lines.\n' etherPrice: BTC: 007502 USD: 84721 EUR: 68868 AUD: 109865 CHF: 80506 CAD: 109997 GBP: 63038 timestampsInMs: requestAPI: 1520327362396 pushedInBlockchain: 1520327366137 minedInBlockchain: 1520327377000 response: 1520327379267 ...
Get an Ethereum contract by id
blockchainiz;
Response
id: '5b27d894b989df001152e0bb' abi: constant: true inputs: name: 'getVersion' outputs: Array payable: false stateMutability: 'pure' type: 'function' constant: false inputs: Array name: 'setStatus' outputs: payable: false stateMutability: 'nonpayable' type: 'function' ... status: 'mined' address: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' amount: 0 language: 'solidity' parameters: 20 name: 'testSmartContract' infosCompilation: '37:9: Warning: Invoking events without "emit" prefix is deprecated.\n statusChange(msg.sender, status);\n ^------------------------------^\n' etherPrice: BTC: 007695 USD: 49714 EUR: 42816 AUD: 66732 CHF: 49337 CAD: 67634 GBP: 37194 timestampsInMs: apiRequest: 1529338004280 pushedInBlockchain: 1529338004529 minedInBlockchain: 1529338018000 response: 1529338028277 gasPriceInWei: 10000000000
Get a no constant function called by id
blockchainiz;
Response
id: '5b27dae1b989df001152e0ca' contract: '5b27dac3b989df001152e0c8' txid: '0xae54089532251676aba760f20760c0ba55bfdf055306efd35365e590b8aa2d5c' functionName: 'setStatus' functionParameters: 10 status: 'mined' pushedCallback: 'http://postb.in/DgmNHcCg?type=pushed' minedCallback: 'http://postb.in/DgmNHcCg?type=mined' errorCallback: 'http://postb.in/DgmNHcCg?type=error' blockHash: '0xb851637721fd2edb3d6a4ef3dd5434adaf94c60199b9ad8607d59ffcb3abfbe1' blockNumber: 3462888 gasUsed: 28378 gasLimit: 31216 gasPriceInWei: 10000000000 timestampsInMs: apiRequest: 1529338593136 pushedInBlockchain: 1529338593250 minedInBlockchain: 1529338608000 response: 1529338610943 etherPrice: BTC: 007692 USD: 49742 EUR: 42815 AUD: 66732 CHF: 49318 CAD: 67901 GBP: 35981
Get a list with all functions no constant called
blockchainiz;
Response
id: '5b195ed7a7215d0011b73906' contract: '5b195ebca7215d0011b73904' txid: '0x66a30db58f6a66940b993f799fcc9fbc48e150d05de858027c6b2886f81aef' functionName: 'setStatus' functionParameters: 10 status: 'mined' pushedCallback: 'http://test/pushedCallback' minedCallback: 'http://test/minedCallback' errorCallback: 'http://test/errorCallback' blockHash: '0x2f3cd5ec71596f8b6896a6b0f5e9a2272042ce4d61a791ab1cbd364edd9caa' blockNumber: 3392382 gasUsed: 43378 gasLimit: 47716 gasPriceInWei: 10000000000 timestampsInMs: apiRequest: 1528389335421 pushedInBlockchain: 1528389335705 minedInBlockchain: 1528389336000 response: 1528389342705 etherPrice: BTC: 007886 USD: 60626 EUR: 51315 AUD: 79373 CHF: 62993 CAD: 78897 GBP: 45581 ...
Call a no constant function for a contract in Ethereum
blockchainiz;
Response
id: '5b28f5adb989df001152e0f6' walletAddress: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx'
Call a constant function for a contract in Ethereum
blockchainiz;
Response
data: '2': '0.0.1' a: '0x2bc2239448959a1ae54747c28827b2ad7d20006c' b: '20'
Subscribe to an Ethereum event in contract
blockchainiz;
Response
id: '5b28f5feb989df001152e0f8' // ID of the subscribtion
Unsubscribe to a specific event in a Ethereum contract
blockchainiz;
Response
No Content
Get infos about a specific subscription
blockchainiz;
Response
id: '5b28f5feb989df001152e0f8' eventName: 'statusChange' contract: '5b28f59eb989df001152e0f4' callback: 'http://postb.in/57pmXc96?type=event'
Get event infos with a specific subscription ID
blockchainiz;
Response
id: '5b28f612b989df001152e0f9' eventName: 'statusChange' parameters: param1: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' param2: '10' contractId: '5b28f59eb989df001152e0f4' blockNumber: 3468496 blockHash: '0x338bf9674d2609830f3031ae69a6423b49c36f647bcc1afd2ff5cc5b8fca4bd3' transactionHash: '0xb86c49cda7fb392e655220aac093eef4d9ad999945ec5776cb5b8debab13d533' ...
Get event infos with a specific event ID
blockchainiz;
Response
id: '5b28f612b989df001152e0f9' eventName: 'statusChange' parameters: param1: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' param2: '10' contract: '5b28f59eb989df001152e0f4' blockNumber: 3468496 blockHash: '0x338bf9674d2609830f3031ae69a6423b49c36f647bcc1afd2ff5cc5b8fca4bd3' transactionHash: '0xb86c49cda7fb392e655220aac093eef4d9ad999945ec5776cb5b8debab13d533'
Create a new Ethereum wallet
blockchainiz;
Response
walletAddress: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' // your new wallet address
Update an Ethereum wallet
blockchainiz;
Response
Update user
blockchainiz;
Response
Get the balance of a specific wallet address
blockchainiz;
Response
balance: '11234654365' address: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' unit: 'wei'
Get the list of yours wallets
blockchainiz;
Response
addresses: address: '0x8f136c013b1c541a7971c9dfbd0866c60f3xxxxx' gasPrice: 'standard' address: '0x2bc2239448959a1ae54747c28827b2ad7d2xxxxx' address: '0x60a30530ec6b7b2ef782d48863f3b6f2146xxxxx' address: '0x7a2cc501c800edb961cced0cae4b073b0b3xxxxx' address: '0xb9cffdf7058662d547816cec29e235702aaxxxxx' address: '0x465b14a5cd0cab3263ca42b3f4881f1501bxxxxx' defaultAddress: '0x2bc2239448959a1ae54747c28827b2ad7d2xxxxx'
Get the signature of a data from one of your wallet
blockchainiz;
Response
message: 'Hello world' messageHash: "0x8144a6fa26be252b86456491fbcd43c1de7e022241845ffea1c3df066f7cfede" v: "0x1c" r: "0x657123506d5f652742e3453e822a3d1686d845a3dc85608d4dcae888be880aed" s: "0x3c7dc96f44afc9105bd32318b3a4d7c528849f849d00aa22e57e3a99e1918b7c" signature:"0x657123506d5f652742e3453e822a3d1686d845a3dc85608d4dcae888be880aed3c7dc96f44afc9105bd32318b3a4d7c528849f849d00aa22e57e3a99e1918b7c1c"
Follow the changelog
You can follow all changes with our changelog file