For the contract that you are referring to, it involves 2 steps to make a bid:
- First you hash your bid so that public cannot see your bid, but you can reveal and the contract can validate it after the bidding ends. This is done via
sha3()
call as what you have done.
- Next, you submit the bid to the contract via the method
bid(bytes32 _blindedBid)
.
Here is sample code in JavaScript with web3:
// Instantiate the contract
var ABI = ...; // ABI of the contract
var address = '0x.............'; // Address of the contract
var contract = web3.eth.contract(ABI).at(address);
// Step 1. Hash your bid
var blindedBid = sha3(10, true, 'abcd');
// Step 2: Submit the bid
web3.eth.defaultAccount = web3.eth.accounts[0]; // Set a default account to send from
contract.bid(blindedBid);
bid
method?