LogoLogo
  • Introduction
  • Core Concepts
  • Partner setup
  • Tutorials [WIP]
    • Create Identities
    • Create a Blockchain Address
    • Payout Service
  • Public Mint Widget
    • Getting started
    • Embed Widget
      • Deposit of funds
      • Withdraw of funds
  • Public Mint API
    • Getting started
    • Creating identities
    • Connecting to the blockchain
      • Running your own client node
    • Executing Transactions
      • Depositing
      • Wallet Transactions
      • Withdrawing
    • Sandbox
    • API Reference
      • Identities
      • Operations
      • Transfer Methods
      • Transactions
      • Withdrawals (deprecated)
      • Verifications
      • Identity Relations
      • Documents
      • Deposits (deprecated)
      • Authentication
      • Pagination
      • Errors
      • Core Resources
    • Webhooks
  • Public Mint Blockchain
    • Getting started
    • Transacting
    • Configuring Metamask for the Public Mint blockchain
    • Interoperability [WIP]
  • Other Information
    • Public Mint Wallet
    • Users and Accounts
Powered by GitBook
On this page
  • Before you start
  • Creating Addresses

Was this helpful?

  1. Tutorials [WIP]

Create a Blockchain Address

Step-by-step example of how to create a Public Mint blockchain address

PreviousCreate IdentitiesNextPayout Service

Last updated 5 years ago

Was this helpful?

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 .

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

const Web3 = require('web3');
const provider = 'https://public.tst.publicmint.io:8545'; // Public Mint TestNet Blockchain
const opts = {
    defaultBlock: 'latest',
    transactionConfirmationBlocks: 1,
}
const web3 = new Web3(provider, null, opts);
(async function () {
   const passphrase = 'test';
   const account = await web3.eth.accounts.create(passphrase);  
   console.log('PMINT ACCOUNT address:', account.address);
   console.log('PMINT ACCOUNT PK:', account.privateKey);
})();
// OUTPUT
PMINT ACCOUNT address: 0xEa3F2eb61dD221344834eA6a3fd2128dF6641D4E
PMINT ACCOUNT PK: 0x0edd054f73c62fdca08b3940413df4f713a34cd5b702f88641b984499f165565

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.

developers.publicmint.io