How to create an address and a private key on Insacoin

A “key pair”, a private key with the corresponding public one/address, is all that is needed to use Insacoin. But how to create one ?

With insacoind

You can get a private key by using the CLI of your running node insacoind. It will take car of all the computation and ouput you a private key in WIF format, and a corresponding address assigned or not to an account.

darosior@debian:~/Documents/Projets/insacoin/website/src$ insacoin-cli getnewaddress
iBfco2Aurm99nadDKiXsGfMBgvq2FG1jFR
darosior@debian:~/Documents/Projets/insacoin/website/src$ insacoin-cli dumpprivkey iBfco2Aurm99nadDKiXsGfMBgvq2FG1jFR
T9kxN14fqDbiFSZY1wHYzArkbZ2WFjCtJCQfg4eLmZgyHREnS2Tu

This is the shorter way to do that, but you can also order your addresses with “accounts”. Accounts are a kind of a box where you can store all your related addresses, for example you can have an account “savings”, another “christmas gifts”, and “pocket money”. To create an address for a given account (existing or not) :

darosior@debian:~/Documents/Projets/insacoin/website/src$ insacoin-cli getnewaddress "insacoin.org how-to"
iJvZ7vN8Xt6mtkATeFCtAqH1Fqs8DoL5ro
darosior@debian:~/Documents/Projets/insacoin/website/src$ inascoin-cli listaccounts
{
    "" : -6.97100000,
    "a" : 0.00000000,
    "aa" : 1.00000000,
    "b" : 0.96700001,
    "c" : 2.00000000,
    "insacoin.org how-to" : 0.00000000,
    "shiba" : 10.00000000,
    "test" : 6.99494000,
    "test2" : 1.00006000,
    "theo" : 0.00000000,
    "workshop" : 1.00000000,
    "z" : 0.97900000
}
darosior@debian:~/Documents/Projets/insacoin/website/src$ insacoin-cli getaccountaddress "insacoin.org how-to"
iE2WTAm58Mm2upqQtzu3UV4xe8Db4S9BCa
darosior@debian:~/Documents/Projets/insacoin/website/src$ insacoin-cli dumpprivkey iE2WTAm58Mm2upqQtzu3UV4xe8Db4S9BCa
T3kYDqQPCc3cGecPBLN9gvxj1Xz7paGU9ewcVAGZDmxGtgxQ8JTa

You can see all account related commands with

insacoin-cli help

in the “Wallet” section.

Without insacoind

You can also generate addresses without relying on a node (which is wiser for development of applications). My post about the third session of “shiba to lion” turned out to be a tutorial explaining how to do so. Check it out here.