# Umi and Web3js Differences

When using Umi you may come across some differences between Umi and solana web3js.

Although having the same or similar import names these function differently and are not compatible between the two librarys out the box.

#### PublicKeys <a href="#public-keys" id="public-keys"></a>

Umi PublicKey

JavaScript

```
import { publicKey } from '@metaplex-foundation/umi'
const publicKey = publicKey('tst24HZ6pbcnraCv4r8acexfgXvyQwMSRgZRCg9gEX1')
```

Solana Web3js PublicKey

JavaScript

```
import { PublicKey } from '@solana/web3js'
const publicKey = new PublicKey('tst24HZ6pbcnraCv4r8acexfgXvyQwMSRgZRCg9gEX1')
```

These are just basic examples. To learn more about Umi's keypairs check out [PublicKeys and Signers](https://developers.metaplex.com/umi/public-keys-and-signers). There are also converters between both Umi and web3js [Web3Js Adapters](https://developers.metaplex.com/umi/web3js-adapters)

#### Keypairs <a href="#keypairs" id="keypairs"></a>

Umi Keypair

JavaScript

```
const umi = createUmi(...)
const keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secretKey))
```

Web3js Keypair

JavaScript

```
import { Keypair } from '@solana/web3js'
const publicKey = Keypair.fromSecretKey(new Uint8Array(JSON.parse(Wallet.DEV1)))
```

These are just basic examples. To learn more about Umi's keypairs check out [PublicKeys and Signers](https://developers.metaplex.com/umi/public-keys-and-signers). There are also converters between both Umi and web3js keypair types [Web3Js Adapters](https://developers.metaplex.com/umi/web3js-adapters)

#### Transactions <a href="#transactions" id="transactions"></a>

Umi Transaction

JavaScript

```
const blockhash = await umi.rpc.getLatestBlockhash()

const transaction = const tx = umi.transactions.create({
    version: 0,
    payer: umi.identity.publicKey,
    instructions: ix,
    blockhash: blockhash.blockhash,
  });

await umi.rpc.sendTransaction(tx)
```

Web3js Transaction

JavaScript

```
const wallet = useWallet()

const messageV0 = new TransactionMessage({
  payerKey: SIGNER_WALLET.publicKey,
  recentBlockhash: latestBlockhash.blockhash,
  instructions: txInstructions,
}).compileToV0Message()

const tx = new VersionedTransaction(messageV0)

// send via useWallet hook
await wallet.sendTransaction(tx)
//or send via connection
await connection.sendTransaction(tx)
```

These are just basic examples. To learn more about Umi's Transiactions check out [Transactions](https://developers.metaplex.com/umi/transactions). There are also converters between both Umi and web3js Transaction types [Web3Js Adapters](https://developers.metaplex.com/umi/web3js-adapters)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://8bit-1.gitbook.io/solibrary/umi-and-web3js-differences.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
