Last active
July 3, 2023 20:50
-
-
Save hhanzo/75dfd4a267b7bedd6fd9190d865fc080 to your computer and use it in GitHub Desktop.
BitGo Solutions Engineer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1a) | |
| Wallet ID: 60e6246deeff35000686b29d123df1f7 | |
| Current Receive Address: 2NByZLPkcV9LBZHmGJhvtqVD6Mgy28HfNRR | |
| Balance: 72908154 | |
| Confirmed Balance: 72908154 | |
| Spendable Balance: 72908154 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Get the balance of a multi-sig wallet at BitGo. | |
| * This makes use of the convenience function wallets().get() | |
| * | |
| * This tool will help you see how to use the BitGo API to easily get | |
| * information about a wallet. | |
| * | |
| * Copyright 2022, BitGo, Inc. All Rights Reserved. | |
| */ | |
| import { BitGoAPI } from '@bitgo/sdk-api'; | |
| import { Tbtc } from '@bitgo/sdk-coin-btc'; | |
| require('dotenv').config({ path: '../../.env' }); | |
| const bitgo = new BitGoAPI({ | |
| accessToken: '', | |
| env: 'test', | |
| }); | |
| const coin = 'tbtc'; | |
| bitgo.register(coin, Tbtc.createInstance); | |
| const walletId = ''; | |
| async function main() { | |
| const wallet = await bitgo.coin(coin).wallets().get({ id: walletId }); | |
| console.log('Wallet ID:', wallet.id()); | |
| console.log('Current Receive Address:', wallet.receiveAddress()); | |
| console.log('Balance:', wallet.balanceString()); | |
| console.log('Confirmed Balance:', wallet.confirmedBalanceString()); | |
| console.log('Spendable Balance:', wallet.spendableBalanceString()); | |
| } | |
| main().catch((e) => console.error(e)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1b) | |
| Wallet ID: 60e6246deeff35000686b29d123df1f7 | |
| Received Address: 2NEsLkpCvBt98DnBz7srF23Vnjp2damTobR | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create a new receive address on an existing multi-sig wallet at BitGo. | |
| * | |
| * Copyright 2022, BitGo, Inc. All Rights Reserved. | |
| */ | |
| import { BitGo } from 'bitgo'; | |
| const bitgo = new BitGo({ env: 'test' }); | |
| const coin = 'tbtc'; | |
| const basecoin = bitgo.coin(coin); | |
| // TODO: set your access token here | |
| const accessToken = ''; | |
| // set your wallet from the YYYYY parameter here in the URL on app.bitgo-test.com | |
| // https://test.bitgo.com/enterprise/XXXXXXXXX/coin/talgo/YYYYY/transactions | |
| const walletId = ''; | |
| async function main() { | |
| bitgo.authenticateWithAccessToken({ accessToken }); | |
| const wallet = await basecoin.wallets().get({ id: walletId }); | |
| const newReceiveAddress = await wallet.createAddress(); | |
| console.log('Wallet ID:', wallet.id()); | |
| console.log(`Wallet label: ${wallet.label()}`); | |
| console.log('First Receive Address:', wallet.receiveAddress()); | |
| console.log('Second Receive Address:', newReceiveAddress.address); | |
| } | |
| main().catch((e) => console.error(e)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Wallet Label: Solutions Engineering Candidate Technical Challenge Wallet - TBTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create a new receive address on an existing multi-sig wallet at BitGo. | |
| * | |
| * Copyright 2022, BitGo, Inc. All Rights Reserved. | |
| */ | |
| import { BitGo } from 'bitgo'; | |
| const bitgo = new BitGo({ env: 'test' }); | |
| const coin = 'tbtc'; | |
| const basecoin = bitgo.coin(coin); | |
| // TODO: set your access token here | |
| const accessToken = ''; | |
| // set your wallet from the YYYYY parameter here in the URL on app.bitgo-test.com | |
| // https://test.bitgo.com/enterprise/XXXXXXXXX/coin/talgo/YYYYY/transactions | |
| const walletId = ''; | |
| async function main() { | |
| bitgo.authenticateWithAccessToken({ accessToken }); | |
| const wallet = await basecoin.wallets().get({ id: walletId }); | |
| const newReceiveAddress = await wallet.createAddress(); | |
| console.log('Wallet ID:', wallet.id()); | |
| console.log(`Wallet label: ${wallet.label()}`); | |
| console.log('First Receive Address:', wallet.receiveAddress()); | |
| console.log('Second Receive Address:', newReceiveAddress.address); | |
| } | |
| main().catch((e) => console.error(e)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Wallet ID: 64a321e86af6ae00072e55d8d1307da0 | |
| Receive address: 2N8wo2jH9RnQ9tgFoAg8CdDXqoJQ5AMcfw7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create a multi-sig wallet at BitGo. | |
| * This makes use of the convenience function generateWallet | |
| * | |
| * This tool will help you see how to use the BitGo API to easily create a wallet. | |
| * In this form, it creates 2 keys on the host which runs this example. | |
| * It is HIGHLY RECOMMENDED that you GENERATE THE KEYS ON SEPARATE MACHINES for real money wallets! | |
| * | |
| * To perform more advanced features, such as encrypting keys yourself, please look at createWalletAdvanced.js | |
| * | |
| * Copyright 2022, BitGo, Inc. All Rights Reserved. | |
| */ | |
| /** | |
| * Add Low Fee webhook to a wallet. | |
| * | |
| * Copyright 2022 BitGo, Inc. All Rights Reserved. | |
| */ | |
| import { BitGoAPI } from '@bitgo/sdk-api'; | |
| import { Tbtc } from '@bitgo/sdk-coin-btc'; // Replace with your given coin (e.g. Ltc, Tltc) | |
| require('dotenv').config({ path: '../../.env' }); | |
| const bitgo = new BitGoAPI({ | |
| accessToken: '', | |
| env: 'test', // Change this to env: 'production' when you are ready for production | |
| }); | |
| // Set the coin name to match the blockchain and network | |
| // btc = bitcoin, tbtc = testnet bitcoin | |
| const coin = 'tbtc'; | |
| bitgo.register(coin, Tbtc.createInstance); | |
| // TODO: set a label for your new wallet here | |
| const label = 'BitGo Solutions Engineering Challange Challenge'; | |
| // TODO: set your passphrase for your new wallet here | |
| const passphrase = ''; | |
| async function main() { | |
| const response = await bitgo.coin(coin).wallets().generateWallet({ | |
| label, | |
| passphrase, | |
| }); | |
| const { wallet } = response; | |
| console.log(`Wallet ID: ${wallet.id()}`); | |
| console.log(`Receive address: ${wallet.receiveAddress()}`); | |
| console.log('BACK THIS UP: '); | |
| console.log(`User keychain encrypted xPrv: ${response.userKeychain.encryptedPrv}`); | |
| console.log(`Backup keychain xPrv: ${response.backupKeychain.prv}`); | |
| } | |
| main().catch(e => console.log(e)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment