Fired up Alethzero. Cut and pasted Gavin's splitter contract into the "Data" box. Submitted it as a contract creation. Everything looks ok. Now, I cannot seem to perform a "split". I believe I need to enter something into the data box, i.e., the addresses of the recipients and send it to the contract address?
Somehow I cannot get it working. Sorry, this may sound trivial, but the reality is I am a novice trying to understand how to execute a contract. Need to get past this.
A cut and paste of the data to be sent will be good.
Additionally, I am trying to understand this part in the init part of the program:
[0] "Splitter"
(call 0x929b11b8eeea00966e873a241d4b67f7540d1f38 0 0 0 8 0 0)
What exactly is it doing in calling and putting the "Splitter" into this address?
Thanks
0 ·
Comments
"Splitter"
to NameReg, which is essentially like namecoin, but for contracts.(currently) Namereg is on0x929b11b8eeea00966e873a241d4b67f7540d1f38
. Ethereum premines to ensure we have those adresses and they dont change between test versions.(perhaps if you have a contract and want the address to stay the samebut it may well just be the Ether byte across test versions, you could ask them to include it in the premine) Names can only be given once, if the given one already exists, the registrar will do nothing. So since others may have submitted the splitter too, the name may be taken.Looks like the POC-5 LLL on the wiki doesnt explain it entirely, the first zero is the amount in ethers sent, then one of the zeros is the address of the name
"Splitter"
and the8
is the number of characters; the length in bytes of the message. Not clear on what the other zeros are about.Nevertheless, I have tried both versions, i.e., 20 and 32 bytes but to no avail. I realise my Namereg as shown in the contract panel is the original one, i.e., 929b11b8eeea00966e873a241d4b67f7540d1f38.
The log says it has "split" and sent, but the wallet doesn't show the amount.
Thanks a lot anyway. I now get the gist of how to do it. I believe it may still be a buggy wallet for the windows version as the ethers that I mined kept disappearing and resetting itself.
The unfortunate thing is I am just a user and not a programmer and therefore don't really know how to compile one. Guess I just have to wait a little longer for an updated version of Alethzero in Windows.
"In the case of executing a message call, several parameters are required: sender (s), transaction originator (o), recipient (r), available gas (g), value (v) and gas price (p) together with an arbitrary length byte array, d, the
input data of the call."
They are not necessary called in that order. It appears that "8" may not be needed in POC-5 but instead substituted by a string of bytes starting from [0] and possibly 0x00 as the "End of Line" call.
There is also an output message coming back from the call. I can understand gas price, but I am not so sure about the need to send available gas. s and o is the same if it is a transaction sending a value. If it is a message call from a contract initiated by the originator, s is the contract address (I think) and o is the originator who called this contract to execute the message call.
Please correct me if I am wrong. Many parts of Gavin's paper still remain cryptic for me...:(
{
[0] "Red132"
(call 0x929b11b8eeea00966e873a241d4b67f7540d1f38 0 0 0 6 0 0)
}
{
[count] (/ (calldatasize) 32)
[pay] (/ (callvalue) @count)
;; Cycle through each address
[i] 0
(for () (< @i @count) ()
{
(call (calldataload (* @i 32)) @pay 0 0 0 0 0)
[i]:(+ @i 1)
}
)
}
Basically, I believe the Alethzero is a POC-4 version and that the for loop needs some modification. [i] increment happens at the end of the loop and I have to initialize [i] : 0 before the loop starts.
This then works!!
The compiler is therefore not compiling properly.
* Note that a colon was added inadvertently in the last "[i]:(+ @i 1)". I guess this is still ok, with or without the colon, which should be the case anyway.