Search…
Create a Blockchain Address
Step-by-step example of how to create a Public Mint blockchain address
In this example you'll learn how to create a valid blockchain address that can be used on Public Mint's blockchain.

Before you start

Public Mint's service APIs offer a series of methods that can be used to integrate with Public Mint services and blockchain. Before you start, it's recommended that you review the full documentation available online on developers.publicmint.io.

Creating Addresses

There are many ways of creating a blockchain address. In this example, we'll use NodeJS with the Web3 lib to communicate with the blockchain.
Example
1
const Web3 = require('web3');
2
const provider = 'https://public.tst.publicmint.io:8545'; // Public Mint TestNet Blockchain
3
const opts = {
4
defaultBlock: 'latest',
5
transactionConfirmationBlocks: 1,
6
}
7
const web3 = new Web3(provider, null, opts);
8
(async function () {
9
const passphrase = 'test';
10
const account = await web3.eth.accounts.create(passphrase);
11
console.log('PMINT ACCOUNT address:', account.address);
12
console.log('PMINT ACCOUNT PK:', account.privateKey);
13
})();
Copied!
// OUTPUT
1
PMINT ACCOUNT address: 0xEa3F2eb61dD221344834eA6a3fd2128dF6641D4E
2
PMINT ACCOUNT PK: 0x0edd054f73c62fdca08b3940413df4f713a34cd5b702f88641b984499f165565
Copied!
This example will return the private key and the public address of the newly created account. Both will be necessary to integrate with Public Mint's blockchain and service APIs.