# Client Libraries

Metacces uses Geth which supports common smart contract and dapp development, deployment, and operational use cases, using tools such as Hardhat, web3.js and web3js-quorum. The client supports common JSON-RPC API methods, for example eth, net, web3, debug, and miner.

#### Prerequisites​ <a href="#prerequisites" id="prerequisites"></a>

* Node.js version 15 or later.
* The web3 library must be installed in your project.

**web3**[**​**](https://docs.goquorum.consensys.io/develop/client-libraries#web3)

The web3.js library is the most widely used for developing applications.

**Install web3 in your project**[**​**](https://docs.goquorum.consensys.io/develop/client-libraries#install-web3-in-your-project)

npm install web3

**Initialize the web3 client**[**​**](https://docs.goquorum.consensys.io/develop/client-libraries#initialize-the-web3-client)

Initialize your client where:

* <https://oli.accesscan.io> is the JSON-RPC HTTP endpoint of your Metacces node.
* HTTP example

Example connection

`const Web3 = require("web3");`

`const web3 = new Web3("http://oli.accesscan.io");`

### WS example <a href="#ws-example" id="ws-example"></a>

Example connection

const Web3 = require("web3");

const web3 = new Web3("<http://ws.accesscan.io>");

**Deploying a contract**[**​**](https://docs.goquorum.consensys.io/develop/client-libraries#deploying-a-contract)

To deploy a private contract, you need the contract binary. You can use Solidity to get the contract binary.

Copy

```
myContract.deploy({
   data: '0x12345...',
   arguments: [123, 'My String']
})
.send({
   from: '0x1234567890123456789012345678901234567891',
   gas: 1500000,
   gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
 console.log(receipt.contractAddress) // contains the new contract address
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.then(function(newContractInstance){
   console.log(newContractInstance.options.address) // instance with the new contract address
});
```

Alternatively, you can also deploy a contract using eth.sendSignedTransaction

Copy

```
const rawTxOptions = {
 nonce: "0x00",
 from: account.address,
 to: null, //public tx
 value: "0x00",
 data: "0x" + contractBin + contractConstructorInit,
 gasPrice: "0x0", //ETH per unit of gas
 gasLimit: "0x24A22", //max number of gas units the tx is allowed to use
};
console.log("Creating transaction...");
const tx = new Tx(rawTxOptions);
console.log("Signing transaction...");
tx.sign(Buffer.from(account.privateKey.substring(2), "hex"));
console.log("Sending transaction...");
var serializedTx = tx.serialize();
const pTx = await web3.eth.sendSignedTransaction(
 "0x" + serializedTx.toString("hex").toString("hex"),
);
console.log("tx transactionHash: " + pTx.transactionHash);
console.log("tx contractAddress: " + pTx.contractAddress);
return pTx;
```

**web3 methods**[**​**](https://docs.goquorum.consensys.io/develop/client-libraries#web3-methods)

For more information about the web3 methods, see the web3 reference documentation.


---

# 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://docs.metacces.com/whitepaper/metacces-general/blockchain-layer-1/developers/client-libraries.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.
