Skip to main content

Network setup

List available networks

Make a GET call to {{CODEFI_API}}/essentials/network?userId={{issuerId}}.

Execute command
curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
$CODEFI_API/essentials/network?userId=$ISSUER_ID
Example output
{
"networks": [
{
"tenantId": "codefi",
"name": "Polygon Testnet",
"key": "mumbai",
"chainId": "80001",
"type": "pos",
"description": "Polygon Testnet",
"ethRequired": true,
"kaleido": false,
"ace": "0x6f143F72f1214ade68d2edC7aC8fE876C8f86B7C",
"faucetMinEthValue": "300000000000000000",
"symbol": "MATIC",
"rpcEndpoint": "https://polygon-mumbai.infura.io/v3/7203f9a4d3af4664890c64b0ddf02a3d"
},
{
"tenantId": "codefi",
"name": "Polygon Mainnet",
"key": "polygon_mainnet",
"chainId": "137",
"type": "pos",
"description": "Polygon Mainnet",
"ethRequired": true,
"kaleido": false,
"ace": "0xb9Bb032206Da5B033a47E62D905F26269DAbE839",
"faucetMinEthValue": "3000000000000000000",
"symbol": "MATIC",
"rpcEndpoint": "https://polygon-mainnet.infura.io/v3/7203f9a4d3af4664890c64b0ddf02a3d"
},
{
"tenantId": "codefi",
"name": "Codefi Assets Dev Network (Kaleido - Deprecated)",
"key": "codefi_assets_dev_network",
"chainId": "118174032",
"type": "poa",
"description": "Codefi Assets Dev, is a private Kaleido network setup for development, based on Besu nodes",
"ethRequired": false,
"kaleido": true,
"ace": "0x8cec219d10fe2617d207d686df46f0c5b43bc5fd",
"symbol": "ETH",
"faucetMinEthValue": "300000000000000000",
"rpcEndpoint": "https://e0bwzpx1vh:eDpuV0GnHKCg_9Zsow5gHIzw0RE_xBbdKOhCUm1kdFg@e0yt00jvmm-e0rlauwjnb-rpc.de0-aws.kaleido.io"
},
{
"tenantId": "codefi",
"name": "Codefi Testnet",
"key": "codefi_assets_dev_network_2",
"chainId": "10",
"type": "poa",
"description": "Codefi Assets Dev, is a private QBS network setup for development, based on GoQuorum nodes",
"ethRequired": false,
"kaleido": false,
"ace": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"faucetMinEthValue": "300000000000000000",
"rpcEndpoint": "https://transaction-1.codefimember1.codefi-9228.onquorum.net:3200/EJX5yNaaXtv095cS6Srae0pa"
},
{
"tenantId": "codefi",
"name": "Ethereum Mainnet",
"key": "mainnet",
"chainId": "1",
"type": "pow",
"description": "Frontier, Homestead, Metropolis, the Ethereum public PoW main network",
"ethRequired": true,
"kaleido": false,
"ace": "0xb9Bb032206Da5B033a47E62D905F26269DAbE839",
"symbol": "ETH",
"faucetMinEthValue": "300000000000000000",
"rpcEndpoint": "https://mainnet.infura.io/v3/7203f9a4d3af4664890c64b0ddf02a3d"
},
{
"tenantId": "codefi",
"name": "Rinkeby Testnet",
"key": "rinkeby",
"chainId": "4",
"type": "poa",
"description": "Rinkeby, the public Geth-only PoA testnet",
"ethRequired": true,
"kaleido": false,
"ace": "0x6f143F72f1214ade68d2edC7aC8fE876C8f86B7C",
"symbol": "ETH",
"faucetMinEthValue": "300000000000000000",
"rpcEndpoint": "https://rinkeby.infura.io/v3/7203f9a4d3af4664890c64b0ddf02a3d"
}
],
"defaultNetwork": "codefi_assets_dev_network_2",
"message": "6 network(s) listed successfully"
}

Use a public network

Codefi Assets works on a private test network by default but you can also use public testnets and mainnets.

If the network you want to use requires to pay for fees, as most public testnets and mainnets do, you will need to get some of the required cryptocurrency.

Get your wallet address

You wallet address is available on the {{ CODEFI_API }}/utils/identity endpoint:

Execute command
echo WALLET=$(curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
--request GET \
$CODEFI_API/utils/identity?userType=ISSUER | jq -r '.user.defaultWallet')
Example output
WALLET=0x69a382838451C9B0dD38b5f81F44EfE242175462

Faucets

To use most public networks, you will need to pay for fees with ETH or other currencies.

On mainnets (on Ethereum mainnet, Polygon...) you have to purchase it.

On testnets, you can use Faucets to get it for free. Use these network dedicated faucets:

NetworkCurrencyFaucet
RopstenETHhttps://faucet.ropsten.be
RinkebyETHhttps://faucet.rinkeby.io
KovanKETHhttps://github.com/kovan-testnet/faucet
GörliETHhttps://faucet.goerli.mudit.blog
Optimism testnetETHhttps://faucet.paradigm.xyz
Arbitrum testnetAETHGet Rinkeby ETH then use the Arbitrum Bridge
Polygon Mumbai testnetMATIChttps://faucet.polygon.technology
BSC testnetBNBhttps://testnet.binance.org/faucet-smart

You can also use the Chainlink faucet. Chainlink is available for all these networks, except for Ropsten and Optimism testnet. The Chainlink faucet gives you LINK and ETH. Use a decentralized exchange (like Uniswap or Sushiswap) to convert LINK to ETH.

Another solution is Paradigm MultiFaucet: https://faucet.paradigm.xyz/

Set the network in your calls

To use a specific network, you need to add a chainId parameter to the commands interacting with the blockchain.

For example, if you want to create an ERC20 token on the Mumbai Polygon testnet, you can make a POST call to {{CODEFI_API}}/essentials/token/fungible?userId={{issuer}} with the following body:

{
"tokenStandard": "ERC20Token",
"symbol": "{{tokenSymbol}}",
"name": "{{tokenName}}",
"chainId": "80001",
"data": {
"[OPTIONAL]": "[OPTIONAL] Additional use case specific data"
}
}

You can check if the different commands require the chainId parameter by reading the API specifications.