//The Deployment of the Standard Token smart contract public static async Task DeployStandardTokenAsync() { //Your account address var senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c"; //The private key corresponding to your address used to sign the transactions. var privatekey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"; //The url to the ws var url = "ws://127.0.0.1:8546"; //The smart contract deployment message, as described above, including the "Total Supply" of the Standard Token var deploymentMessage = new StandardTokenDeployment { TotalSupply = 100000, FromAddress = senderAddress }; //Creating a new instance of Web3 to connect to Ethereum, including a new account configured with our private key to sign transactions var web3 = new Web3.Web3(new Account(privatekey), new WebSocketClient(url)); //Deploying using a new handler var deploymentHandler = web3.Eth.GetContractDeploymentHandler <StandardTokenDeployment>(); var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage); ContractAddress = transactionReceipt.ContractAddress; Console.WriteLine("Contract deployed to address: " + ContractAddress); }
public async void PrivateRawTransactionTest() { var account = new QuorumAccount("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"); var web3Quorum = new Web3Quorum(account, $"{url}:9081", $"{url}:22000"); web3Quorum.SetPrivateRequestParameters(new[] { "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=" }, "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo="); var deploymentMessage1 = new StandardTokenDeployment { TotalSupply = 100000 }; var deploymentHandler = web3Quorum.Eth.GetContractDeploymentHandler <StandardTokenDeployment>(); //Deploying var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage1); var contractAddress = transactionReceipt.ContractAddress; var totalSupply = await web3Quorum.Eth.GetContractQueryHandler <TotalSupplyFunction>() .QueryAsync <BigInteger>(contractAddress); //var balance = await web3Quorum.Eth.GetContractQueryHandler<BalanceOfFunction>() // .QueryAsync<BigInteger>(contractAddress, // new BalanceOfFunction() { Owner = "0xed9d02e382b34818e88b88a309c7fe71e65f419d" }); //account.Address }); }
//The Deployment of the Standard Token smart contract public static async Task DeployStandardTokenAsync() { //Your account address var senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c"; //The private key corresponding to your address used to sign the transactions. var privatekey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"; //The url to the Rinkeby testchain in infura // Note: in this sample, a special INFURA API key is used: `7238211010344719ad14a89db874158c`. If you wish to use this sample in your own project you’ll need to [sign up on INFURA](https://infura.io/register) and use your own key. var url = "https:// rinkeby.infura.io/v3/7238211010344719ad14a89db874158c "; //The smart contract deployment message, as described above, including the "Total Supply" of the Standard Token var deploymentMessage = new StandardTokenDeployment { TotalSupply = 100000, FromAddress = senderAddress }; var web3 = new Web3.Web3(new Account(privatekey), url); var deploymentHandler = web3.Eth.GetContractDeploymentHandler <StandardTokenDeployment>(); var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage); ContractAddress = transactionReceipt.ContractAddress; Console.WriteLine("Contract deployed to address: " + ContractAddress); }
async void DeployContract() { var deploymentMessage = new StandardTokenDeployment { TotalSupply = 100000 }; var deploymentHandler = web3.Eth.GetContractDeploymentHandler <StandardTokenDeployment>(); var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage); var contractAddress = transactionReceipt.ContractAddress; Debug.Log(string.Format("deploy complete, address {0}", contractAddress)); }
private async Task <bool> DeployContract() { try { var deploymentMessage = new StandardTokenDeployment { TotalSupply = 100000 }; IContractDeploymentTransactionHandler <StandardTokenDeployment> deploymentHandler = bcNode.Eth.GetContractDeploymentHandler <StandardTokenDeployment>(); transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage); contractAddress = transactionReceipt.ContractAddress; } catch (Exception e) { Console.WriteLine(e); return(false); } return(true); }
public static async Task <StandardTokenService> DeployContractAndGetServiceAsync(Nethereum.Web3.Web3 web3, StandardTokenDeployment standardTokenDeployment, CancellationTokenSource cancellationTokenSource = null) { var receipt = await DeployContractAndWaitForReceiptAsync(web3, standardTokenDeployment, cancellationTokenSource); return(new StandardTokenService(web3, receipt.ContractAddress)); }
public static Task <string> DeployContractAsync(Nethereum.Web3.Web3 web3, StandardTokenDeployment standardTokenDeployment) { return(web3.Eth.GetContractDeploymentHandler <StandardTokenDeployment>().SendRequestAsync(standardTokenDeployment)); }
public static Task <TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.Web3 web3, StandardTokenDeployment standardTokenDeployment, CancellationTokenSource cancellationTokenSource = null) { return(web3.Eth.GetContractDeploymentHandler <StandardTokenDeployment>().SendRequestAndWaitForReceiptAsync(standardTokenDeployment, cancellationTokenSource)); }