A simple usecase of a Bitcoin compatible coin integration. Not all coins are created equal, so it is possible that extra work must be done to successfully integrate a new cryptocurrency.
- Start the Anoncoin daemon and in the
anoncoin.conf
file add the option "txindex=1"
rpcuser=anoncoinrpc
rpcpassword=MFfySYp9o9qQi0mYbQmxOdE1pEHVS1DQuhhHssOzkO3
rpcport=8022
txindex=1
We start the daemon with the -datadir
parameter:
anoncoind -datadir=/coinomi/coind/anoncoin &
- Use preferably this electrum server with a configuration file similar to the following. You need to find the values
pubkey_address
andscript_address
from the Anoncoin source code and for thegenesis_hash
you can execute the rpc command:getblockhash 0
.
[server]
host = 0.0.0.0
electrum_rpc_port = 2022
#report_host =
stratum_tcp_port = 5022
stratum_http_port = 4022
stratum_tcp_ssl_port =
stratum_http_ssl_port =
#report_stratum_tcp_port = 50001
#report_stratum_http_port = 80
#report_stratum_tcp_ssl_port = 50002
#report_stratum_http_ssl_port = 443
password = secret
banner = Welcome to Electrum!
#irc = no
#irc_nick = <yournickname>
#ssl_certfile = /path/to/electrum-server.crt
#ssl_keyfile = /path/to/electrum-server.key
logfile = /coinomi/logs/elect-monacoin.log
# default backend is leveldb (pruning server)
backend = leveldb
## Change the following to enable testnet
[network]
pubkey_address = 50
script_address = 5
genesis_hash = ff9f1c0116d19de7c9963845e129f9ed1bfc0b376eb54fd7afa42e0d418c8bb6
[leveldb]
#fulltree is the new UTXO tree, required for Electrum 2.0 clients
path = /coinomi/electrum/anoncoin/data
# for each address, history will be pruned if it is longer than this limit
pruning_limit = 100
[bitcoind]
bitcoind_host = localhost
bitcoind_port = 8022
# user and password from bitcoin.conf
bitcoind_user = anoncoinrpc
bitcoind_password = MFfySYp9o9qQi0mYbQmxOdE1pEHVS1DQuhhHssOzkO3
From the electrum folder you can start the electrum daemon like this:
./run_electrum_server --conf /coinomi/electrum/monacoin/conf.txt
NOTICE: If you get errors, check x11hash
, peercoin-family
, blackcoin
branches for specific fixes for various coins. There is a case in some coins where the getrawtransaction
does not return the coinbase (or coinstake in PoS coins) transaction of a orphaned block. One fix can be seen here. So try to observe a blockchain reorg to verify that Electrum server runs without an issue.
After the Electrum server finishes syncronizing, test it by connecting first:
nc localhost 5022
and then pasting the following:
{"id": 1, "method": "blockchain.address.get_history", "params": ["A USED ADDRESS FROM YOUR QT WALLET"]}
You should see all the past transactions of the A USED ADDRESS FROM YOUR QT WALLET
address. Then paste this:
{"id": 2, "method": "blockchain.address.subscribe", "params": ["A USED ADDRESS FROM YOUR QT WALLET"]}
After you send some coins to the A USED ADDRESS FROM YOUR QT WALLET
address, you should see the server replying something after some seconds.
- Create a new subclass of
CoinType
calledMonacoinMain
in thecoinomi-android/core/coins/
path and set the correct values (thebip44Index
must be registered here). AddMonacoinMain
to thecom.coinomi.core.coins.CoinID
class.
public class AnoncoinMain extends CoinType {
private AnoncoinMain() {
id = "anoncoin.main";
addressHeader = 50;
p2shHeader = 5;
acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
spendableCoinbaseDepth = 100;
family = BitFamily.get();
name = "Anoncoin";
symbol = "ANC";
uriScheme = "anoncoin";
bip44Index = 22;
unitExponent = 8;
feePerKb = value(100000);
minNonDust = value(1000); // 0.00001 MNC mininput
softDustLimit = value(100000); // 0.001 ANC
softDustPolicy = SoftDustPolicy.BASE_FEE_FOR_EACH_SOFT_DUST_TXO;
}
private static AnoncoinMain instance = new AnoncoinMain();
public static synchronized AnoncoinMain get() {
return instance;
}
}
-
Create a new flat-style icon that harmonically matches the existing icon set
-
Add this coin to the
com.coinomi.wallet.Constants
class (check theDEFAULT_COINS_SERVERS
,COINS_ICONS
,SUPPORTED_COINS
)
After you compile the android app the coin will appear in the list of the new coins.