Skip to content

Instantly share code, notes, and snippets.

@ConanMishler
Last active June 11, 2021 07:31
Show Gist options
  • Save ConanMishler/3aee51be9cade3284cfa1e57ddb254ff to your computer and use it in GitHub Desktop.
Save ConanMishler/3aee51be9cade3284cfa1e57ddb254ff to your computer and use it in GitHub Desktop.
Accessing Blocknet RPC URL (for Linux using Command Line Interface)
  1. Download Blocknet Core Wallet (v4.3.1) and extract it in your home (~) directory:
    cd ~
    wget https://github.com/blocknetdx/blocknet/releases/download/v4.3.1/blocknet-4.3.1-x86_64-linux-gnu.tar.gz
    tar xzvf blocknet-4.3.1-x86_64-linux-gnu.tar.gz

  2. cd ~/blocknet-4.3.1/bin

  3. Start Blocknet daemon to create the ~/.blocknet directory:
    ./blocknetd -daemon

  4. Without waiting for the wallet to sync, issue stop command:
    ./blocknet-cli stop

  5. To save time in syncing, use the bootstrap method:
    a) First Make sure unzip is installed:
    sudo apt install unzip (for ubuntu & debian)
    sudo yum install unzip (for centOS & Fedora)
    b) Remove existing blocks & chainstate directories:
    rm -rf ~/.blocknet/{blocks,chainstate,indexes}
    c) Get the latest bootstrap file, unzip it and move required dirs into the .blocknet directory:
    wget https://github.com/blocknetdx/blocknet-blockchain-bootstrap/releases/download/v4.0/Blocknet.zip
    unzip Blocknet.zip
    mv Blocknet/{blocks,chainstate,indexes} ~/.blocknet/

  6. Start Blocknet daemon again:
    ./blocknetd -daemon

  7. Issue the command ./blocknet-cli getblockcount every 5 minutes
    until the block count matches that of https://chainz.cryptoid.info/block/

  8. Find (or set) RPC user name and password:
    cat ~/.blocknet/.cookie
    This file contains the default RPC user and password in the following format:
    __cookie__:<big_long_number>
    where "__cookie__" is the default RPC user and <big_long_number> is the default password
    Note: If you prefer to set your own RPC user and password, you can do so by
    adding these 2 lines to ~/.blocknet/blocknet.conf:
    rpcuser=<YourRPCUserName>
    rpcpassword=<YourRPCPassword>
    Then (if setting your own rpcuser & rpcpassword) restart your wallet with these 2 commands:
    ./blocknet-cli stop
    ./blocknetd -daemon

  9. Examples of accessing RPC URL with curl using default rpcuser & rpcpassword from ~/.blocknet/.cookie:
    curl -H "Content-Type: application/json" -d '{"method": "getblockcount"}' 'http://__cookie__:<big_long_number>@localhost:41414'
    curl -H "Content-Type: application/json" -d '{"method": "getbalance"}' 'http://__cookie__:<big_long_number>@localhost:41414'
    curl -H "Content-Type: application/json" -d '{"jsonrpc":"1.0", "id":"curltext","method":"xrservice","params":["eth_blocknumber"]}' http://__cookie__:<big_long_number>@localhost:41414

Note: As requested, I've provided the RPC URL for Blocknet, which you can now access by following the above instructions. However, if you just want to see what commands the Blocknet Core Wallet supports and learn the details of those commands, you can do so through the Command Line Interface as follows:

~/blocknet-4.3.1/bin/blocknet-cli help

This will give you a complete list of Blocknet Core Wallet commands.
Then, if you want more details on any of those commands, you can type:
~/blocknet-4.3.1/bin/blocknet-cli help <CoreWalletCommand>
For Example:
~/blocknet-4.3.1/bin/blocknet-cli help getblockhash

FYI, here is the complete list of commands available in the Blocknet Core Wallet
(i.e. the output of ~/blocknet-4.3.1/bin/blocknet-cli help):

== Blockchain ==
getbestblockhash
getblock "blockhash" ( verbosity )
getblockchaininfo
getblockcount
getblockhash height
getblockheader "blockhash" ( verbose )
getblockstats hash_or_height ( stats )
getchaintips
getchaintxstats ( nblocks "blockhash" )
getdifficulty
getmempoolancestors "txid" ( verbose )
getmempooldescendants "txid" ( verbose )
getmempoolentry "txid"
getmempoolinfo
getrawmempool ( verbose )
gettxout "txid" n ( include_mempool )
gettxoutproof ["txid",...] ( "blockhash" )
gettxoutsetinfo
preciousblock "blockhash"
pruneblockchain height
savemempool
scantxoutset "action" [scanobjects,...]
verifychain ( checklevel nblocks )
verifytxoutproof "proof"

== Control ==
getmemoryinfo ( "mode" )
getrpcinfo
help ( "command" )
logging ( ["include_category",...] ["exclude_category",...] )
stop
uptime

== Generating ==
generate nblocks ( maxtries )
generatetoaddress nblocks "address" ( maxtries )

== Governance ==
createproposal "name" superblock amount "address" ( "url" "description" )
listproposals ( sinceblock )
nextsuperblock
proposalfee
vote "proposal" "vote" ( "address" )

== Mining ==
getblocktemplate "template_request"
getmininginfo
getnetworkhashps ( nblocks height )
getstakingstatus
prioritisetransaction "txid" ( dummy ) fee_delta
submitblock "hexdata" ( "dummy" )
submitheader "hexdata"

== Network ==
addnode "node" "command"
clearbanned
disconnectnode ( "address" nodeid )
getaddednodeinfo ( "node" )
getconnectioncount
getnettotals
getnetworkinfo
getnodeaddresses ( count )
getpeerinfo
listbanned
ping
setban "subnet" "command" ( bantime absolute )
setnetworkactive state

== Rawtransactions ==
analyzepsbt "psbt"
combinepsbt ["psbt",...]
combinerawtransaction ["hexstring",...]
converttopsbt "hexstring" ( permitsigdata iswitness )
createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] (\ locktime replaceable ) createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...]\ [{"address":amount},{"data":"hex"},...] ( locktime replaceable )
decodepsbt "psbt"
decoderawtransaction "hexstring" ( iswitness )
decodescript "hexstring"
finalizepsbt "psbt" ( extract )
fundrawtransaction "hexstring" ( options iswitness )
getrawtransaction "txid" ( verbose "blockhash" )
joinpsbts ["psbt",...]
sendrawtransaction "hexstring" ( allowhighfees )
signrawtransactionwithkey "hexstring" ["privatekey",...] (\ [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","a\mount":amount},...] "sighashtype" ) testmempoolaccept ["rawtx",...] ( allowhighfees )
utxoupdatepsbt "psbt"

== Servicenode ==
servicenode "command"
servicenodecount
servicenodecreateinputs "nodeaddress" ( nodecount inputsize )
servicenodeexport "alias" "password"
servicenodegenkey
servicenodeimport "importdata" "password"
servicenodelist
servicenoderegister ( "alias" )
servicenoderemove ( "alias" )
servicenodesendping
servicenodesetup "address" ( "alias" )
servicenodesetuplist [{"key":"hex","alias":"str","tier":"str","address":"str"},...]
servicenodestatus

== Util ==
createmultisig nrequired ["key",...] ( "address_type" )
deriveaddresses "descriptor" ( range )
estimatesmartfee conf_target ( "estimate_mode" )
getdescriptorinfo "descriptor"
signmessagewithprivkey "privkey" "message"
validateaddress "address"
verifymessage "address" "signature" "message"

== Wallet ==
abandontransaction "txid"
abortrescan
addmultisigaddress nrequired ["key",...] ( "label" "address_type" )
backupwallet "destination"
bumpfee "txid" ( options )
createwallet "wallet_name" ( disable_private_keys blank )
dumpprivkey "address"
dumpwallet "filename"
encryptwallet "passphrase"
getaddressesbylabel "label"
getaddressinfo "address"
getbalance ( "dummy" minconf include_watchonly )
getnewaddress ( "label" "address_type" )
getrawchangeaddress ( "address_type" )
getreceivedbyaddress "address" ( minconf )
getreceivedbylabel "label" ( minconf )
gettransaction "txid" ( include_watchonly )
getunconfirmedbalance
getwalletinfo
importaddress "address" ( "label" rescan p2sh )
importmulti "requests" ( "options" )
importprivkey "privkey" ( "label" rescan )
importprunedfunds "rawtransaction" "txoutproof"
importpubkey "pubkey" ( "label" rescan )
importwallet "filename"
keypoolrefill ( newsize )
listaddressgroupings
listlabels ( "purpose" )
listlockunspent
listreceivedbyaddress ( minconf include_empty include_watchonly "address_filter" )
listreceivedbylabel ( minconf include_empty include_watchonly )
listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed )
listtransactions ( "label" count skip include_watchonly )
listunspent ( minconf maxconf ["address",...] include_unsafe query_options )
listwalletdir
listwallets
loadwallet "filename"
lockunspent unlock ( [{"txid":"hex","vout":n},...] )
removeprunedfunds "txid"
rescanblockchain ( start_height stop_height )
sendmany "" {"address":amount} ( minconf "comment" ["address",...] replaceable\ conf_target "estimate_mode" )
sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount\ replaceable conf_target "estimate_mode" )
sethdseed ( newkeypool "seed" )
setlabel "address" "label"
settxfee amount
signmessage "address" "message"
signrawtransactionwithwallet "hexstring" (\ [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","a\mount":amount},...] "sighashtype" ) splitbalance amount "address" ( Return the transaction hex only, does not submit\ transaction. )
unloadwallet ( "wallet_name" )
walletcreatefundedpsbt [{"txid":"hex","vout":n,"sequence":n},...]\ [{"address":amount},{"data":"hex"},...] ( locktime options bip32derivs )
walletlock
walletpassphrase "passphrase" timeout ( unlockforstakingonly )
walletpassphrasechange "oldpassphrase" "newpassphrase"
walletprocesspsbt "psbt" ( sign "sighashtype" bip32derivs )

== XBridge ==
dxCancelOrder "id"
dxFlushCancelledOrders ( ageMillis )
dxGetLocalTokens
dxGetLockedUtxos ( "id" )
dxGetMyOrders
dxGetMyPartialOrderChain "order_id"
dxGetNetworkTokens
dxGetNewTokenAddress "ticker"
dxGetOrder "id"
dxGetOrderBook detail "maker" "taker" ( max_orders )
dxGetOrderFills "maker" "taker" ( combined )
dxGetOrderHistory "maker" "taker" start_time end_time granularity ( order_ids\ with_inverse limit )
dxGetOrders
dxGetTokenBalances
dxGetTradingData ( blocks errors )
dxGetUtxos "token" ( include_used )
dxLoadXBridgeConf
dxMakeOrder "maker" "maker_size" "maker_address" "taker" "taker_size"\ "taker_address" "type" ( "dryrun" )
dxMakePartialOrder "maker" "maker_size" "maker_address" "taker" "taker_size"\ "taker_address" "minimum_size" ( "repost" "dryrun" )
dxPartialOrderChainDetails "order_id"
dxSplitAddress "token" "split_amount" "address" ( include_fees show_rawtx submit )
dxSplitInputs "token" "split_amount" "address" include_fees show_rawtx submit\ [{"txid":"hex","vout":n},...]
dxTakeOrder "id" "from_address" "to_address" ( "amount" "dryrun" )
gettradingdata ( blocks errors )

== XRouter ==
xrConnect "fully_qualified_service_name" ( node_count )
xrConnectedNodes
xrDecodeRawTransaction "blockchain" "tx_hex" ( node_count )
xrGetBlock "blockchain" "block_hash" ( node_count )
xrGetBlockCount "blockchain" ( node_count )
xrGetBlockHash "blockchain" "block_number" ( node_count )
xrGetBlocks "blockchain" "block_hashes" ( node_count )
xrGetNetworkServices
xrGetReply "uuid"
xrGetTransaction "blockchain" "tx_id" ( node_count )
xrGetTransactions "blockchain" "tx_ids" ( node_count )
xrReloadConfigs
xrSendTransaction "blockchain" "signed_tx_hex" ( node_count )
xrService "service_name" ( "parameters" )
xrServiceConsensus node_count "service_name" ( "parameters" )
xrShowConfigs
xrStatus
xrUpdateNetworkServices ( Query at most this number of service nodes. It's possible\ that fewer or none are available. )

== Zmq ==
getzmqnotifications

@luusluus
Copy link

luusluus commented Oct 8, 2020

Comment for 5d,e,f.

Or remove files first, then unzip to .blocknet dir instead of mving.
Otherwise if unzip is not installed, then this sequence is fine

@luusluus
Copy link

luusluus commented Oct 8, 2020

Comment for 8

I'd do getblockcount and then check w/ https://chainz.cryptoid.info/block/

@luusluus
Copy link

luusluus commented Oct 8, 2020

Comment 9a

Also encapsulate cat in code block.

@luusluus
Copy link

luusluus commented Oct 8, 2020

Comment 9b.

One cURL example w/ params

curl -H "Content-Type: application/json" -d '{"jsonrpc":"1.0", "id":"curltext","method":"xrservice","params":["eth_blocknumber"]}' http://cookie:<big_long_number>@localhost:41414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment